Doresc modificare acestui plugin daca se poate.
Vreau ca adminii care au acces la ban sa nu fie nevoiti sa scrie /chat pentru a putea scrie in chat.
Spoiler
;>
#include
#include
#define passwd "/chat"
//Bools
new bool:g_Gaged[33];
new bool:g_allowed[33];
new g_GagTime[33];
new SayText;
//Cvars
new cvar_gag_time,cvar_file;
//Words file
new const g_FileName[] = "gag_words.ini";
new g_Words[64][32], g_Count;
public plugin_init() {
register_plugin("AMXX GAG BAN", "0.09.1", "Ex3cuTioN");
//Comenzi admin
register_concmd("amx_gag", "cmdGag", ADMIN_KICK,"- " );
register_concmd("amx_sysgag", "cmdGagSys", ADMIN_MENU,"- " );
register_concmd("amx_ungag", "cmdUngag", ADMIN_KICK, "- ");
//Comanda de chat
register_clcmd("say", "sayHandle");
register_clcmd("say_team", "sayHandle");
//Cvar-uri
cvar_gag_time = register_cvar("amx_gag_time", "3");
cvar_file = register_cvar("amx_gag_file", "1");
SayText = get_user_msgid("SayText")
}
public plugin_cfg() {
if(get_pcvar_num(cvar_file)) {
static dir[64], g_File[128];
get_localinfo( "amxx_configsdir", dir, 63 );
formatex(g_File, 127 , "%s/%s" , dir, g_FileName);
if(!file_exists(g_File))
write_file(g_File, "[lista de cuvinte vulgare]", -1);
new Len;
while(g_Count < 64 && read_file(g_File, g_Count ,g_Words[g_Count][ 1 ], 30, Len)) {
g_Words[g_Count][0] = Len;
g_Count++;
}
}
}
public client_connect(id) {
g_Gaged[id] = false;
g_GagTime[id] = 0;
g_allowed[id] = false;
}
public client_disconnect(id) {
if(g_Gaged[id]) {
client_printcolor(0, "!g[CSTRIKE] !yJucatorul cu gag %s s-a deconectat.",get_name(id))
}
g_Gaged[id] = false
g_GagTime[id] = 0;
g_allowed[id] = false;
}
public sayHandle(id) {
new said[192];
new save[192];
read_args(said, 191);
read_args(save, 191);
//if(containi(said, passwd) && !g_allowed[id])
if (contain(said, passwd) != -1 && !g_allowed[id])
{
g_allowed[id] = true;
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yAi primit permisiunea de a folosi chatul")
return PLUGIN_HANDLED;
}
if(!g_allowed[id])
{
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yScrie !t/chat !ypentru a putea folosi chatul.")
return PLUGIN_HANDLED;
}
if(!strlen(said))
return PLUGIN_CONTINUE;
if(g_Gaged[id]) {
client_printcolor(id, "!g[CSTRIKE] !yMai ai de asteptat %i minute din gag.", g_GagTime[id])
return PLUGIN_HANDLED;
}
else if(get_pcvar_num(cvar_file)) {
new bool:Injura, i, pos;
new g_Len;
for(i = 0; i if((pos = containi(said, g_Words[i][1])) != -1) {
g_Len = g_Words[i][0];
while(g_Len--)
said[pos++] = '*';
Injura = true;
continue;
}
}
if(Injura) {
new timp = get_pcvar_num(cvar_gag_time);
g_Gaged[id] = true;
g_GagTime[id] = timp;
client_printcolor(0, "!g[CSTRIKE] !yJucatorul %s a primit gag automat datorita limbajului pentru %i minute",get_name(id),timp)
client_printcolor(id, "!g[CSTRIKE] !yAi primit gag pentru %i minute",timp)
client_printcolor(id, "!g[CSTRIKE] !yRetry la gag se pedepseste cu ban 120 minute")
set_task(60.0, "count", id+123, _, _, "b");
log_to_file("gaglist.txt", "%s : %s",get_name(id),save);
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public cmdGag(id, level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[32], arg2[6];
read_argv(1, arg, 31);
read_argv(2, arg2, 5);
new player = cmd_target(id, arg, 8);
if(!player)
return PLUGIN_HANDLED;
if(g_Gaged[player]) {
console_print(id,"Jucatorul %s are deja gag.",get_name(player));
return PLUGIN_HANDLED;
}
if(equal(arg2,""))
g_GagTime[player] = get_pcvar_num(cvar_gag_time);
else
g_GagTime[player] = str_to_num(arg2);
g_Gaged[player] = true;
client_printcolor(0, "!g[CSTRIKE] !yJucatorul %s a primit gag de la adminul %s pentru %i minute",get_name(player),get_name(id),g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yAi primit gag pentru %i minute",g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yRetry la gag se pedepseste cu ban 120 minute")
set_task(60.0, "count", player+123, _, _, "b");
return PLUGIN_HANDLED;
}
public cmdGagSys(id, level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[32], arg2[6];
read_argv(1, arg, 31);
read_argv(2, arg2, 5);
new player = cmd_target(id, arg, 8);
if(!player)
return PLUGIN_HANDLED;
if(g_Gaged[player]) {
client_printcolor(0, "!g[SYSTEM] !yJucatorul %s are deja gag",get_name(player));
return PLUGIN_HANDLED;
}
if(equal(arg2,""))
g_GagTime[player] = get_pcvar_num(cvar_gag_time);
else
g_GagTime[player] = str_to_num(arg2);
g_Gaged[player] = true;
client_printcolor(0, "!g[CSTRIKE] !yJucatorul %s a primit gag in urma votului jucatorilor pentru %i minute",get_name(player), g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yAi primit gag pentru %i minute.",g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yRetry la gag se pedepseste cu ban 120 minute")
set_task(60.0, "count", player+123, _, _, "b");
return PLUGIN_HANDLED;
}
public cmdUngag(id,level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[32];
read_argv(1, arg, 31);
new player = cmd_target(id, arg, 8);
if(!player)
return PLUGIN_HANDLED;
if(!g_Gaged[player]) {
console_print( id, "Jucatorul %s nu are gag.",get_name(player));
return PLUGIN_HANDLED;
}
g_Gaged[player] = false;
remove_task(player + 123);
client_printcolor(player, "!g[CSTRIKE] !yAi primit ungag")
return PLUGIN_HANDLED;
}
public count(task) {
new player = task - 123;
if(!is_user_connected(player))
return PLUGIN_HANDLED;
g_GagTime[player] -= 1;
if(g_GagTime[player] <= 0) {
remove_task(player + 123);
client_printcolor(player, "!g[CSTRIKE] !yAi primit ungag")
g_Gaged[player] = false;
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
stock get_name(id) {
new name[32];
get_user_name(id,name,31);
return name;
}
stock get_steamid(id) {
static steamid[32];
get_user_authid(id,steamid,31);
return steamid;
}
stock get_ip(id) {
static ip[32];
get_user_ip(id,ip,31);
return ip;
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for ( new i = 0; i < count; i++ )
{
if ( is_user_connected(players[i]) )
{
message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
#include
#define passwd "/chat"
//Bools
new bool:g_Gaged[33];
new bool:g_allowed[33];
new g_GagTime[33];
new SayText;
//Cvars
new cvar_gag_time,cvar_file;
//Words file
new const g_FileName[] = "gag_words.ini";
new g_Words[64][32], g_Count;
public plugin_init() {
register_plugin("AMXX GAG BAN", "0.09.1", "Ex3cuTioN");
//Comenzi admin
register_concmd("amx_gag", "cmdGag", ADMIN_KICK,"- " );
register_concmd("amx_sysgag", "cmdGagSys", ADMIN_MENU,"- " );
register_concmd("amx_ungag", "cmdUngag", ADMIN_KICK, "- ");
//Comanda de chat
register_clcmd("say", "sayHandle");
register_clcmd("say_team", "sayHandle");
//Cvar-uri
cvar_gag_time = register_cvar("amx_gag_time", "3");
cvar_file = register_cvar("amx_gag_file", "1");
SayText = get_user_msgid("SayText")
}
public plugin_cfg() {
if(get_pcvar_num(cvar_file)) {
static dir[64], g_File[128];
get_localinfo( "amxx_configsdir", dir, 63 );
formatex(g_File, 127 , "%s/%s" , dir, g_FileName);
if(!file_exists(g_File))
write_file(g_File, "[lista de cuvinte vulgare]", -1);
new Len;
while(g_Count < 64 && read_file(g_File, g_Count ,g_Words[g_Count][ 1 ], 30, Len)) {
g_Words[g_Count][0] = Len;
g_Count++;
}
}
}
public client_connect(id) {
g_Gaged[id] = false;
g_GagTime[id] = 0;
g_allowed[id] = false;
}
public client_disconnect(id) {
if(g_Gaged[id]) {
client_printcolor(0, "!g[CSTRIKE] !yJucatorul cu gag %s s-a deconectat.",get_name(id))
}
g_Gaged[id] = false
g_GagTime[id] = 0;
g_allowed[id] = false;
}
public sayHandle(id) {
new said[192];
new save[192];
read_args(said, 191);
read_args(save, 191);
//if(containi(said, passwd) && !g_allowed[id])
if (contain(said, passwd) != -1 && !g_allowed[id])
{
g_allowed[id] = true;
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yAi primit permisiunea de a folosi chatul")
return PLUGIN_HANDLED;
}
if(!g_allowed[id])
{
client_printcolor(id, "!g[!yCHAT MANAGER!g] !yScrie !t/chat !ypentru a putea folosi chatul.")
return PLUGIN_HANDLED;
}
if(!strlen(said))
return PLUGIN_CONTINUE;
if(g_Gaged[id]) {
client_printcolor(id, "!g[CSTRIKE] !yMai ai de asteptat %i minute din gag.", g_GagTime[id])
return PLUGIN_HANDLED;
}
else if(get_pcvar_num(cvar_file)) {
new bool:Injura, i, pos;
new g_Len;
for(i = 0; i if((pos = containi(said, g_Words[i][1])) != -1) {
g_Len = g_Words[i][0];
while(g_Len--)
said[pos++] = '*';
Injura = true;
continue;
}
}
if(Injura) {
new timp = get_pcvar_num(cvar_gag_time);
g_Gaged[id] = true;
g_GagTime[id] = timp;
client_printcolor(0, "!g[CSTRIKE] !yJucatorul %s a primit gag automat datorita limbajului pentru %i minute",get_name(id),timp)
client_printcolor(id, "!g[CSTRIKE] !yAi primit gag pentru %i minute",timp)
client_printcolor(id, "!g[CSTRIKE] !yRetry la gag se pedepseste cu ban 120 minute")
set_task(60.0, "count", id+123, _, _, "b");
log_to_file("gaglist.txt", "%s : %s",get_name(id),save);
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public cmdGag(id, level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[32], arg2[6];
read_argv(1, arg, 31);
read_argv(2, arg2, 5);
new player = cmd_target(id, arg, 8);
if(!player)
return PLUGIN_HANDLED;
if(g_Gaged[player]) {
console_print(id,"Jucatorul %s are deja gag.",get_name(player));
return PLUGIN_HANDLED;
}
if(equal(arg2,""))
g_GagTime[player] = get_pcvar_num(cvar_gag_time);
else
g_GagTime[player] = str_to_num(arg2);
g_Gaged[player] = true;
client_printcolor(0, "!g[CSTRIKE] !yJucatorul %s a primit gag de la adminul %s pentru %i minute",get_name(player),get_name(id),g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yAi primit gag pentru %i minute",g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yRetry la gag se pedepseste cu ban 120 minute")
set_task(60.0, "count", player+123, _, _, "b");
return PLUGIN_HANDLED;
}
public cmdGagSys(id, level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[32], arg2[6];
read_argv(1, arg, 31);
read_argv(2, arg2, 5);
new player = cmd_target(id, arg, 8);
if(!player)
return PLUGIN_HANDLED;
if(g_Gaged[player]) {
client_printcolor(0, "!g[SYSTEM] !yJucatorul %s are deja gag",get_name(player));
return PLUGIN_HANDLED;
}
if(equal(arg2,""))
g_GagTime[player] = get_pcvar_num(cvar_gag_time);
else
g_GagTime[player] = str_to_num(arg2);
g_Gaged[player] = true;
client_printcolor(0, "!g[CSTRIKE] !yJucatorul %s a primit gag in urma votului jucatorilor pentru %i minute",get_name(player), g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yAi primit gag pentru %i minute.",g_GagTime[player])
client_printcolor(player, "!g[CSTRIKE] !yRetry la gag se pedepseste cu ban 120 minute")
set_task(60.0, "count", player+123, _, _, "b");
return PLUGIN_HANDLED;
}
public cmdUngag(id,level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[32];
read_argv(1, arg, 31);
new player = cmd_target(id, arg, 8);
if(!player)
return PLUGIN_HANDLED;
if(!g_Gaged[player]) {
console_print( id, "Jucatorul %s nu are gag.",get_name(player));
return PLUGIN_HANDLED;
}
g_Gaged[player] = false;
remove_task(player + 123);
client_printcolor(player, "!g[CSTRIKE] !yAi primit ungag")
return PLUGIN_HANDLED;
}
public count(task) {
new player = task - 123;
if(!is_user_connected(player))
return PLUGIN_HANDLED;
g_GagTime[player] -= 1;
if(g_GagTime[player] <= 0) {
remove_task(player + 123);
client_printcolor(player, "!g[CSTRIKE] !yAi primit ungag")
g_Gaged[player] = false;
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
stock get_name(id) {
new name[32];
get_user_name(id,name,31);
return name;
}
stock get_steamid(id) {
static steamid[32];
get_user_authid(id,steamid,31);
return steamid;
}
stock get_ip(id) {
static ip[32];
get_user_ip(id,ip,31);
return ip;
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for ( new i = 0; i < count; i++ )
{
if ( is_user_connected(players[i]) )
{
message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}