Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <colorchat>
- //Bools
- new bool:g_Gaged[33];
- new g_GagTime[33];
- //Cvars
- new cvar_gag_time, cvar_gag_ban_reason,cvar_gag_ban_time,cvar_ban,cvar_file,cvar_sound, cvar_tag;
- new g_Tag;
- //Sound
- new const g_Sound[] = "amxx_gag_sound.wav";
- //Words file
- new const g_FileName[] = "amx_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,"- <target> <minutes>" );
- register_concmd("amx_ungag", "cmdUngag", ADMIN_KICK, "- <target>");
- //Comanda de chat
- register_clcmd("say", "sayHandle");
- register_clcmd("say_team", "sayHandle");
- //Cvar-uri
- cvar_gag_time = register_cvar("amx_gag_time", "3");
- cvar_ban = register_cvar("amx_gag_ban", "1");
- cvar_gag_ban_reason = register_cvar("amx_gag_ban_reason", "deconectare cu gag");
- cvar_gag_ban_time = register_cvar("amx_gag_ban_time", "15");
- cvar_file = register_cvar("amx_gag_file", "0");
- cvar_sound = register_cvar("amx_gag_sound", "1");
- cvar_tag = register_cvar("amx_gag_tag", "AMXX");
- new tag[32];
- g_Tag = get_pcvar_string(cvar_tag, tag, 31);
- }
- 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 plugin_precache()
- precache_sound(g_Sound);
- public client_connect(id) {
- g_Gaged[id] = false;
- g_GagTime[id] = 0;
- }
- public client_disconnect(id) {
- //Daca are gag primeste ban
- if(get_pcvar_num(cvar_ban) && g_Gaged[id]) {
- new reason[32];
- get_pcvar_string(cvar_gag_ban_reason, reason, 31);
- server_cmd("amx_ban ^"%s^" %i ^"%s^"",get_name(id),get_pcvar_num(cvar_gag_ban_time),reason);
- ColorChat(0,GREEN,"[%s]^x03 %s^x01 a primit ban^x04 %d^x01 minute.Motiv : ^x04 %s",g_Tag,get_name(id),get_pcvar_num(cvar_gag_ban_time),reason);
- remove_task(id + 123);
- ColorChat(0, GREEN, "[%s]^x03 %s^x01<%s><%s> s-a deconectat dupa gag.",g_Tag,get_name(id), get_steamid(id), get_ip(id));
- }
- g_Gaged[id] = false
- g_GagTime[id] = 0;
- }
- public sayHandle(id) {
- new said[192];
- read_args(said, 191);
- if(!strlen(said))
- return PLUGIN_CONTINUE;
- if(g_Gaged[id]) {
- ColorChat(id,GREEN,"[%s]^x01 Mai ai^x04 %i^x01 minute din gag.", g_Tag, 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<g_Count; ++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;
- ColorChat(0,GREEN,"[%s]^x01 Jucatorul^x04 %s^x01 a primit mut pentru^x04 %i^x01 minute datorita limbajului.",g_Tag,get_name(id),timp);
- set_task(60.0, "count", id+123, _, _, "b");
- if(get_pcvar_num(cvar_sound))
- client_cmd(0, "spk ^"sound/%s^"", g_Sound);
- 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;
- ColorChat(0,GREEN,"[%s]^x01 Jucatorul^x04 %s^x01 a primit mut de la adminul^x04 %s^x01 pentru^x04 %i^x01 minute.",g_Tag,get_name(player),get_name(id),g_GagTime[player]);
- set_task(60.0, "count", player+123, _, _, "b");
- if(get_pcvar_num(cvar_sound))
- client_cmd(0, "spk ^"sound/%s^"", g_Sound);
- 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 mut.",get_name(player));
- return PLUGIN_HANDLED;
- }
- g_Gaged[player] = false;
- remove_task(player + 123);
- ColorChat(0,GREEN,"[%s]^x03 %s^x01 ii da voie sa vorbeasca lui^x04 %s.",g_Tag,get_name(id),get_name(player));
- 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);
- ColorChat(0,GREEN,"[%s]^x01 Jucatorul^x04 %s^x01 are voie sa vorbeasca.",g_Tag,get_name(player));
- 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;
- }
Add Comment
Please, Sign In to add comment