Raised This Month: $29 Target: $400
 7% 

Gag dont save


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lantimilan
Senior Member
Join Date: May 2016
Location: KOSOVA
Old 09-27-2020 , 04:31   Gag dont save
Reply With Quote #1

Hello i use one plugin for gag i make gag player but he can talk again in server i dont know why, i make just some thing i set with color i add cromchat i dont touch in code, do you have anybody any idea how to fix to make gag and to have gag with time and if he retry to have again gag, or if you know like this any plugin to suggest me :

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <time>
#include <cromchat>

#define PLUGIN "AMXX GAG"
#define VERSION "1.0"
#define AUTHOR "extream-cs"

#define GAGGED_SAY 1
#define GAGGED_SAY_TEAM 2
#define GAGGED_VOICE 3
#define GAGGED_NAME 4
#define GAG_TIME_LIMIT SECONDS_IN_DAY

new dataDir[64];
new 
amx_defaut_gag_time;
new 
amx_gag_by_authid;

new 
bool:wasgagged[33];
new 
bool:wasmuted[33];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_dictionary("common.txt");
    
register_dictionary("time.txt");
    
register_concmd("amx_gag""cmdGag"ADMIN_LEVEL_B"<name or #userid> <time (1m/60)> <flags abcd> [reason]");
    
register_concmd("amx_ungag""cmdUnGag"ADMIN_LEVEL_B"<name or #userid / ip or authid> <ip/authid=1> [reason]");
    
register_concmd("say""cmdSay", -1" - check gagged player");
    
register_concmd("say_team""cmdSayTeam", -1" - check gagged player");
    
amx_defaut_gag_time register_cvar("amx_defaut_gag_time""20");
    
amx_gag_by_authid register_cvar("amx_gag_by_authid""1")
    
register_message(get_user_msgid("SayText"), "block_namechange_msg");
    
get_datadir(dataDir63);
}

public 
plugin_modules()
    
require_module("engine");

public 
cmdGagInfo(id)
{
    new 
filename[128], playerip[32], gagtime[128], fileDir[96];
    
fileDir get_gagsdir();
    if( 
get_pcvar_num(amx_gag_by_authid) )
    {
        
get_user_authid(idplayerip31);
        
replace_all(playerip31":""_");
        
format(filename127"%s/%s.txt"fileDirplayerip);
    }
    else
    {
        
get_user_ip(idplayerip311);
        
format(filename127"%s/%s.txt"fileDirplayerip);
        if( !
file_exists(filename) )
        {
            new 
server_ip[32];
            
get_user_ip(0server_ip311);
            if( 
equal(playeripserver_ip) )
                
format(filename127"%s/loopback.txt"fileDir);
            else if( 
equal(playerip"loopback") )
                
format(filename127"%s/%s.txt"fileDirserver_ip);
        }
    }
    
    if( 
file_exists(filename) )
    {
        new 
gag_saygag_say_teamgag_voicegag_nameauthid_gags get_pcvar_num(amx_gag_by_authid);
        
gag_say is_user_gagged(idGAGGED_SAYauthid_gags);
        
gag_say_team is_user_gagged(idGAGGED_SAY_TEAMauthid_gags);
        
gag_voice is_user_gagged(idGAGGED_VOICEauthid_gags);
        
gag_name is_user_gagged(idGAGGED_NAMEauthid_gags);
        if( 
gag_say && gag_say_team )
            
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Ju morret GAG nga:&x04 say(_team)%s%s.", (gag_voice) ? " voice" "", (gag_name) ? " namechange" "");
        else
            
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Ju morret GAG nga:&x04%s%s%s%s.", (gag_say) ? " say" "", (gag_say_team) ? " say_team" "", (gag_voice) ? " voice" "", (gag_name) ? " namechange" "");
        
        new 
reason[64], txtsizetime;
        
read_file(filename7reason63txtsize);
        if( 
reason[0] )
            
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Arsyeja pse keni marr GAG: &x04%s."reason);
        else
            
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Arsyeja pse keni marr GAG: &x04Paspecifikueshme.");
            
        
read_file(filename1gagtime127txtsize);
        
time str_to_num(gagtime)-get_systime(1);
        
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Ju do te beheni &x04UNGAG &x01per &x04%s."convert_time(time));
    }
    else
        
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Urime, &x04GAGU &x01juaj eshte larguar, kujdes sjelljet.");
}

public 
cmdSay(id)
{
    new 
text[192], gaggedtext_len;
    
read_argv(1text191);
    
text_len strlen(text);
    if( 
text_len )
    {
        if( 
text[0] == '"' && text[text_len-1] == '"' )
            
format(texttext_len-2"%s"text[1]);
    }
    
    
gagged is_user_gagged(idGAGGED_SAYget_pcvar_num(amx_gag_by_authid));
    if( (
equal(text"/gaginfo") || equal(text".gaginfo")) && read_argc() == )
    {
        
cmdGagInfo(id);
        if( 
gagged )
            return 
PLUGIN_HANDLED;
    }
    if( 
gagged )
    {
        
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Ju jeni &x04Gagged&x01. Shkruaj &x04/gaginfo &x01,per me shum informacione.");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
cmdSayTeam(id)
{
    new 
text[192], gaggedtext_len;
    
read_argv(1text191);
    
text_len strlen(text);
    if( 
text_len )
    {
        if( 
text[0] == '"' && text[text_len-1] == '"' )
            
format(texttext_len-2"%s"text[1]);
    }
    
    
gagged is_user_gagged(idGAGGED_SAY_TEAMget_pcvar_num(amx_gag_by_authid));
    if( (
equal(text"/gaginfo") || equal(text".gaginfo")) && read_argc() == )
    {
        
cmdGagInfo(id);
        if( 
gagged )
            return 
PLUGIN_HANDLED;
    }
    if( 
gagged )
    {
        
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Ju jeni &x04Gagged&x01. Shkruaj &x04/gaginfo &x01,per me shum informacione.");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id)
{
    
set_task(1.0"client_connected"id);
    if( 
is_user_gagged(id0get_pcvar_num(amx_gag_by_authid)) )
        
wasgagged[id] = true;
    else
        
wasgagged[id] = false;
}

public 
client_connected(id)
{
    if( 
is_user_gagged(idGAGGED_VOICEget_pcvar_num(amx_gag_by_authid)) )
    {
        
client_cmd(id"-voicerecord");
        
set_speak(idSPEAK_MUTED);
        
wasmuted[id] = true;
    }
    else
        
wasmuted[id] = false;
    
check_gagged_name(id0);
}

public 
block_namechange_msg(msgidmsgdestmsgent)
{
    new 
msgtype[32];
    
get_msg_arg_string(2msgtype31);
    if( 
equal(msgtype"#Cstrike_Name_Change") )
    {
        new 
playernewname[32], custom_newname[32];
        
get_msg_arg_string(4newname31);
        for( 
player 1player 33player++ )
        {
            if( 
is_valid_ent(player) && is_user_connected(player) && is_user_alive(player) )
            {
                
custom_newname "";
                
get_user_info(player"name"custom_newname31);
                if( 
equal(newnamecustom_newname) )
                    break;
            }
            
            if( 
player == 32 )
            {
                
player 0;
                break;
            }
        }
        
        if( 
player )
        {
            if( 
is_user_gagged(playerGAGGED_NAMEget_pcvar_num(amx_gag_by_authid)) )
                return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_infochanged(id)
{
    if( 
is_user_gagged(idGAGGED_NAMEget_pcvar_num(amx_gag_by_authid)) )
    {
        
check_gagged_name(id1);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
check_gagged_name(idnamechange)
{
    new 
authid_gags get_pcvar_num(amx_gag_by_authid);
    if( 
is_user_gagged(idGAGGED_NAMEauthid_gags) )
    {
        new 
filename[128], fileDir[96], playerip[32], gaggedname[32], newname[32];
        
fileDir get_gagsdir();
        if( 
authid_gags )
        {
            
get_user_authid(idplayerip31);
            
replace_all(playerip31":""_");
        }
        else
            
get_user_ip(idplayerip311);
        
        
format(filename127"%s/%s.txt"fileDirplayerip);
        
        if( !
file_exists(filename) && !authid_gags )
        {
            new 
server_ip[32];
            
get_user_ip(0server_ip311);
            if( 
equal(playeripserver_ip) )
                
format(filename127"%s/loopback.txt"fileDir);
            else if( 
equal(playerip"loopback") )
                
format(filename127"%s/%s.txt"fileDirserver_ip);
            
            if( !
file_exists(filename) )
                return;
        }
        
        new 
txtsize;
        
read_file(filename5gaggedname31txtsize);
        
get_user_info(id"name"newname31);
        
        if( !
equal(gaggednamenewname) )
        {
            if( 
namechange )
            {
                
CC_SendMessage(id"&x01[&x04DPS GAG&x01] Ju jeni &x04Gagged&x01. Nuk mund ta ndryshoni &x04Emrin &x01tuaj.");
                
set_user_info(id"name"gaggedname);
            }
            else
                
client_cmd(id"name ^"%s^""gaggedname);
        }
    }
}

public 
client_PreThink(id)
{
    if( 
is_user_connected(id) )
    {
        static 
authid_gags;
        
authid_gags get_pcvar_num(amx_gag_by_authid);
        if( !
is_user_gagged(idGAGGED_VOICEauthid_gags) && wasmuted[id] )
        {
            
set_speak(idSPEAK_NORMAL);
            
wasmuted[id] = false;
        }
        
        if( 
is_user_gagged(id0authid_gags) )
            
wasgagged[id] = true;
        else if( 
wasgagged[id] )
        {
            
wasgagged[id] = false;
            if( 
get_user_time(id0) > )
                
CC_SendMessage(id"&x01[&x04DPS GAG SYSTEM&x01] Gagu juaj eshte larguar.");
        }
    }
}

public 
cmdGag(idlevelcid)
{
    if( !
cmd_access(idlevelcid2) )
        return 
PLUGIN_HANDLED

    
new target[32], player;
    
read_argv(1target31);
    
player cmd_target(idtarget9);
    
    if( !
player)
        return 
PLUGIN_HANDLED;
    
    new 
sgagtime[32], flags[32], reason[64], gagtime;
    
read_argv(2sgagtime31);
    
read_argv(3flags31);
    
read_argv(4reason63);
    
remove_quotes(reason);
    
    if( 
sgagtime[0] )
    {
        if( 
contain(sgagtime,"m") > )
        {
            new 
sgagtime2[32];
            
copyc(sgagtime231sgagtime'm');
            
gagtime str_to_num(sgagtime2)*60;
        }
        else
            
gagtime str_to_num(sgagtime);
    }
    else
        
gagtime get_pcvar_num(amx_defaut_gag_time)*60;
    if( 
gagtime || gagtime GAG_TIME_LIMIT )
        
gagtime GAG_TIME_LIMIT;
    
    new 
newflags[32];
    
format(flags31"_%s"flags);
    if( 
contain(flags"d") > )
        
format(newflags7"d");
    if( 
contain(flags"c") > )
        
format(newflags7"c%s"newflags);
    if( 
contain(flags"b") > )
        
format(newflags7"b%s"newflags);
    if( 
contain(flags"a") > )
        
format(newflags7"a%s"newflags);
    if( !
newflags[0] )
        
newflags "abcd";
    
format(flags31"_%s_"newflags);
    
    new 
authid[32], authid2[32], playerip[32], playerip2[32], name[32], name2[32], useriduserid2;
    
get_user_authid(idauthid31);
    
get_user_authid(playerauthid231);
    
get_user_ip(idplayerip311);
    
get_user_ip(playerplayerip2311);
    
get_user_name(idname31);
    
get_user_name(playername231);
    
userid get_user_userid(id);
    
userid2 get_user_userid(player);
    
    new 
gag_saygag_say_teamgag_voicegag_name;
    
gag_say = (contain(flags"a") > 0);
    
gag_say_team = (contain(flags"b") > 0);
    
gag_voice = (contain(flags"c") > 0);
    
gag_name = (contain(flags"d") > 0);
    if( !
reason[0] )
        
reason "Unspecified";
    
    if( 
gag_voice )
    {
        
client_cmd(player"-voicerecord");
        
set_speak(playerSPEAK_MUTED);
        
wasmuted[player] = true;
    }
    new 
gaggedtimefilename[128];
    
gaggedtime gagtime get_systime(1);
    
    if( 
get_pcvar_num(amx_gag_by_authid) )
    {
        
filename authid2;
        
replace_all(filename31":""_");
        
format(filename127"%s/%s.txt"get_gagsdir(), filename);
    }
    else
        
format(filename127"%s/%s.txt"get_gagsdir(), playerip2);
    
    if( 
file_exists(filename) )
        
delete_file(filename);
        
    new 
sgagtime3[128];
    
num_to_str(gaggedtimesgagtime3127);
    
write_file(filename"Time data:");
    
write_file(filenamesgagtime3);
    
write_file(filename"Flags:");
    
write_file(filenameflags);
    
write_file(filename"Player name:");
    
write_file(filenamename2);
    
write_file(filename"Reason:");
    
write_file(filenamereason);
    
    
log_amx("DPS Gag: ^"%s<#%d><%s><%s>^" gagged ^"%s<#%d><%s><%s>^" <%s> per <%ds> (arsyeja: ^"%s^")", name, userid, authid, playerip, name2, userid2, authid2, playerip2, newflags, gagtime, reason);
    
    
format(reason127"per %s (%s)"convert_time(gagtime), reason);
    
    if( 
gag_say && gag_say_team )
    {
        switch(
get_cvar_num("amx_show_activity"))
        {
            case 
2client_print(0print_chat"ADMIN %s : Gagged %s nga say(_team)%s%s %s"namename2, (gag_voice) ? " voice" "", (gag_name) ? " namechange" ""reason);
            case 
1client_print(0print_chat"ADMIN: Gagged %s nga say(_team)%s%s %s"name2, (gag_voice) ? " voice" "", (gag_name) ? " namechange" ""reason);
        }
    }
    else
    {
        switch(
get_cvar_num("amx_show_activity"))
        {
            case 
2client_print(0print_chat"ADMIN %s : Gagged %s nga%s%s%s%s %s"namename2, (gag_say) ? " say" "", (gag_say_team) ? " say_team" "", (gag_voice) ? " voice" "", (gag_name) ? " namechange" ""reason);
            case 
1client_print(0print_chat"ADMIN: Gagged %s nga%s%s%s%s %s"name2, (gag_say) ? " say" "", (gag_say_team) ? " say_team" "", (gag_voice) ? " voice" "", (gag_name) ? " namechange" ""reason);
        }
    }
        
    
console_print(id"[DPS GAG] Lojtari ^"%s^" gagged"name2);
    
    return 
PLUGIN_HANDLED;
}

public 
cmdUnGag(idlevelcid)
{
    if( !
cmd_access(idlevelcid2) )
        return 
PLUGIN_HANDLED

    
new target[32], playerip[32], reason[64];
    
read_argv(1target31);
    
read_argv(2ip31);
    
read_argv(3reason63);
    
remove_quotes(reason);
    if( !
reason[0] )
        
reason "Paspecifikuar";
    
    new 
authid[32], playerip[32], name[32], userid;
    
get_user_authid(idauthid31);
    
get_user_ip(idplayerip311);
    
get_user_name(idname31);
    
userid get_user_userid(id);
    if( !
str_to_num(ip) )
    {
        
player cmd_target(idtarget9);
        
        if(!
player)
            return 
PLUGIN_HANDLED;
        
        new 
authid2[32], playerip2[32], name2[32], userid2;
        
get_user_authid(playerauthid231);
        
get_user_ip(playerplayerip2311);
        
get_user_name(playername231);
        
userid2 get_user_userid(player);
        
        new 
filename[128], fileDir[96], authid_gags get_pcvar_num(amx_gag_by_authid);
        
fileDir get_gagsdir();
        
        if( 
authid_gags )
        {
            
filename authid2;
            
replace_all(filename31":""_");
            
format(filename127"%s/%s.txt"fileDirfilename);
        }
        else
            
format(filename127"%s/%s.txt"fileDirplayerip2);
        
        
format(filename127"%s/%s.txt"fileDirplayerip2);
        if( 
file_exists(filename) )
            
delete_file(filename);
        else if( !
authid_gags )
        {
            new 
server_ip[32];
            
get_user_ip(0server_ip311);
            if( 
equal(playerip2server_ip) )
                
format(filename127"%s/loopback.txt"fileDir);
            else if( 
equal(playerip2"loopback") )
                
format(filename127"%s/%s.txt"fileDirserver_ip);
            if( !
file_exists(filename) )
            {
                
console_print(id"[DPS GAG] Gabim: Lojtari ^"%s^" nuk eshte gagged"name2);
                return 
PLUGIN_HANDLED;
            }
        }
        else
        {
            
console_print(id"[DPS GAG] Gabim: Lojtari ^"%s^" nuk eshte gagged"name2);
            return 
PLUGIN_HANDLED;
        }
        
        
log_amx("DPS Gag: ^"%s<#%d><%s><%s>^" ungagged ^"%s<#%d><%s><%s>^" (arsyeja: ^"%s^")", name, userid, authid, playerip, name2, userid2, authid2, playerip2, reason);
        
        
switch(get_cvar_num("amx_show_activity"))
        {
            case 
2client_print(0print_chat"ADMIN %s : UnGagged %s (%s)"namename2reason);
            case 
1client_print(0print_chat"ADMIN: UnGagged %s (%s)"name2reason);
        }
        
        
console_print(id"[DPS GAG] Lojtari ^"%s^" ungagged"name2);
        return 
PLUGIN_HANDLED;
    }
    new 
filename[128], fileDir[96], authid_gags get_pcvar_num(amx_gag_by_authid);
    
fileDir get_gagsdir();
    
    if( 
authid_gags )
    {
        
filename target;
        
replace_all(filename31":""_");
        
format(filename127"%s/%s.txt"fileDirfilename);
    }
    else
        
format(filename127"%s/%s.txt"fileDirtarget);
    
    if( !
file_exists(filename) )
    {
        if( !
authid_gags )
        {
            new 
server_ip[32];
            
get_user_ip(0server_ip311);
            if( 
equal(targetserver_ip) )
                
format(filename127"%s/loopback.txt"fileDir);
            else if( 
equal(target"loopback") || equal(target"localhost") )
                
format(filename127"%s/%s.txt"fileDirserver_ip);
            if( !
file_exists(filename) )
            {
                
console_print(id"[DPS GAG] Gabim: IP ^"%s^" nuk u gjet"target);
                return 
PLUGIN_HANDLED;
            }
        }
        else
        {
            
console_print(id"[DPS GAG] Gabim: IP ^"%s^" nuk u gjet"target);
            return 
PLUGIN_HANDLED;
        }
    }
    
    new 
name2[32], txtsize;
    
read_file(filename5name231txtsize);
    
    new 
userplayerip2[32], playerip3[32], authid2[32], userid2;
    for( 
user 1user 33user++ )
    {
        if( 
is_user_connected(user) )
        {
            if( 
authid_gags )
                
get_user_authid(userplayerip331);
            else
                
get_user_ip(userplayerip3311);
            
            if( 
equal(targetplayerip3) > )
            {
                
userid2 get_user_userid(user);
                if( 
authid_gags )
                {
                    
authid2 playerip3;
                    
get_user_ip(userplayerip2311);
                }
                else
                {
                    
playerip2 playerip3;
                    
get_user_authid(userauthid231);
                }    
                if( 
is_user_gagged(userGAGGED_NAMEauthid_gags) )
                    
client_cmd(user"name ^"%s^""name2);
                else
                    
get_user_name(username231);
            }
        }
    }
    
    
delete_file(filename);
    
    
log_amx("DPS Gag: ^"%s<#%d><%s><%s>^" ungagged nga ip/authid ^"%s<#%d><%s><%s>^" (arsyeja: ^"%s^")", name, userid, authid, playerip, name2, userid2, authid2, playerip2, reason);
    
    
switch(get_cvar_num("amx_show_activity"))
    {
        case 
2client_print(0print_chat"ADMIN %s : UnGagged ^"%s^" %s (%s)"nametargetname2reason);
        case 
1client_print(0print_chat"ADMIN: UnGagged ^"%s^" %s (%s)"targetname2reason);
    }
    
    
console_print(id"[DPS GAG] Lojtari ^"%s^" me ^"%s^" ip/authid ungagged"name2target);
    
    return 
PLUGIN_HANDLED;
}

stock is_user_gagged(idflagauthid_gags)
{
    
    new 
filename[128], fileDir[96], playerip[32];
    
fileDir get_gagsdir();
    
    if( 
authid_gags )
    {
        
get_user_authid(idplayerip31);
        
replace_all(playerip31":""_");
        
format(filename127"%s/%s.txt"fileDirplayerip);
    }
    else
    {
        
get_user_ip(idplayerip311);
        
format(filename127"%s/%s.txt"fileDirplayerip);
    }
    
    if( !
file_exists(filename) )
    {
        if( 
authid_gags )
            return 
0;
        
        new 
server_ip[32];
        
get_user_ip(0server_ip311);
        if( 
equal(playeripserver_ip) )
            
format(filename127"%s/loopback.txt"fileDir);
        else if( 
equal(playerip"loopback") )
            
format(filename127"%s/%s.txt"fileDirserver_ip);
        if( !
file_exists(filename) )
            return 
0;
    }
    
    new 
gagtime[128], gagflags[32], txtsize;
    
read_file(filename1gagtime127txtsize);
    if( !(
str_to_num(gagtime) > get_systime(1)) )
    {
        
delete_file(filename);
        return 
0;
    }
    
    
read_file(filename3gagflags31txtsize);
    new 
g_sayg_say_teamg_voiceg_name;
    
g_say = (contain(gagflags"a") > 0);
    
g_say_team = (contain(gagflags"b") > 0);
    
g_voice = (contain(gagflags"c") > 0);
    
g_name = (contain(gagflags"d") > 0);
    if( !(
g_say || g_say_team || g_voice || g_name ) )
    {
        
log_amx("[DPS GAG] Gabim: Nuk u gjet akcesi <^"%s^"> ne file! Fshijeni file."filename);
        
delete_file(filename);
        return 
0;
    }
    
    if( 
flag == GAGGED_SAY )
    {
        if( 
g_say )
            return 
1;
    }
    else if( 
flag == GAGGED_SAY_TEAM )
    {
        if( 
g_say_team )
            return 
1;
    }
    else if( 
flag == GAGGED_VOICE )
    {
        if( 
g_voice )
            return 
1;
    }
    else if( 
flag == GAGGED_NAME )
    {
        if( 
g_name )
            return 
1;
    }
    else
        return 
1;
    
    return 
0;
}

stock convert_time(time)
{
    new 
TimeMsg[128];
    
get_time_length(0timetimeunit_secondsTimeMsg127);
    return 
TimeMsg;
}

stock get_gagsdir()
{
    new 
gagDir[96];
    
format(gagDir95"%s/gags"dataDir);
    if( !
dir_exists(gagDir) )
        
mkdir(gagDir);
    return 
gagDir;

lantimilan is offline
Send a message via MSN to lantimilan
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:53.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode