View Single Post
Author Message
lantimilan
Senior Member
Join Date: May 2016
Old 06-23-2020 , 14:22   Auto Gag problem with save
Reply With Quote #1

Hello i have one plugin its auto gag but when somebody have gag when i retry gag remove its possible to blocked this i have this code witch im using :
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cromchat>

#define ACCESS             ADMIN_KICK
#define WORDS            64
#define SWEAR_GAGMINUTES    1
#define SHOW

new const tag[] = "";
new const 
g_FileName[] = "redndalofjalet.ini";

new 
bool:g_Gaged33 ], g_GagTime33 ],
bool:g_SwearGag33 ], bool:g_CmdGag33 ],
bool:g_NameChanged[33];

new 
g_reason32 ], g_admin32 ], g_name33 ][ 32 ];

new 
g_WordsFile128 ];
new 
g_WordsWORDS ][ 32 ], g_Countg_Len;

new 
pointg_msgsaytext;
new 
toggle_tag

public plugin_init() 
{
    
register_plugin("Auto GaG""3.0""extreamcs")
    
    
register_concmd"amx_gag""gag_cmd"ACCESS,"- <emri> <minutat> <arsyeja> - Per te bere gag" );
    
register_concmd"amx_ungag""ungag_cmd"ACCESS"- <emri> - Per me fshi gag" );
    
register_clcmd"say""check" );
    
register_clcmd"say_team""check" );
    
    
toggle_tag register_cvar"gag_tag""0" );
    
point get_cvar_pointer"amx_show_activity" );
    
g_msgsaytext get_user_msgid"SayText" );
    
}

public 
plugin_cfg()
{
    static 
dir64 ];
    
get_localinfo"amxx_configsdir"dir63 );
    
formatexg_WordsFile 127 "%s/%s" dirg_FileName );
    
    if( !
file_existsg_WordsFile ) )
        
write_fileg_WordsFile"[Fjalet e Ndaluara]", -);
        
    new 
Len;
    
    while( 
g_Count WORDS && read_fileg_WordsFileg_Count ,g_Wordsg_Count ][ ], 30Len ) )
    {
        
g_Wordsg_Count ][ ] = Len;
        
g_Count++;
    }
}

public 
gag_cmdidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;      
        
    new 
arg32 ], arg2], reason32 ];
    new 
name32 ], namet32 ];
    new 
minutes;
    
      
read_argv(1arg31)

      new 
player cmd_target(idarg9)

      if (!
player
          return 
PLUGIN_HANDLED
    
    read_argv
1argsizeof arg );
    
read_argv2arg2sizeof arg2 );
    
read_argv3reasonsizeof reason );
        
    
get_user_nameidname31 );
    
    
copyg_admin31name );
    
copyg_reason31reason );
    
remove_quotesreason );
    
    
minutes str_to_numarg2 );
    
    new 
target cmd_targetidarg10 );
    if( !
target)
        return 
PLUGIN_HANDLED;
    
    if( 
g_Gagedtarget ] )
    {
        
console_printid"Lojtari tani ka GAG!" );
        return 
PLUGIN_HANDLED;
    }
    
    
get_user_nametargetnamet31 );
    
copyg_nametarget ], 31namet );
    
    
g_CmdGagtarget ] = true;
    
g_Gaged[target] = true;
    
g_GagTimetarget ] = minutes;
    
    
CC_SendMessage(0"&x01[&x04R3D D3V!L GaG&x01] &x04%s: &x01beri gag lojtarin &x04%s &x01per &x04[%d] &x01minuta. Arseyja: &x04%s",get_pcvar_numpoint ) == name ""nametminutesreason );
    
    if( 
get_pcvar_numtoggle_tag ) == )
    {
        new 
Buffer64 ];
        
formatexBuffersizeof Buffer 1"%s %s"tagnamet );
        
        
g_NameChangedtarget ] = true;
        
client_cmdtarget"name ^"%s^"",Buffer );
    }
    
    
set_task60.0"count"target 123__"b" );
    
    return 
PLUGIN_HANDLED;
}

public 
ungag_cmdid,levelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
        
    new 
arg32 ], reason32 ], name32 ];
    
read_argv1argsizeof arg );
    
read_argv2reasonsizeof reason );
    
get_user_nameidnamesizeof name );
    
remove_quotesreason );
    
    new 
target cmd_targetidarg11 );
    if( !
target )
        return 
PLUGIN_HANDLED;
    new 
namet32 ];
    
get_user_nametargetnametsizeof namet );
    
    if( !
g_Gagedtarget ] )
    {
        
console_printid"Lojtari %s nuk ka gag."namet );
        return 
PLUGIN_HANDLED;
    }
    
    
g_Gagedtarget ] = false;
    
g_SwearGagtarget ] = false;
    
    if( 
g_NameChangedtarget ] )
        
client_cmdtarget"name ^"%s^""g_nametarget ] );
        
    
g_NameChangedtarget ] = false;
    
    
remove_tasktarget 123 );
    
    
CC_SendMessage(0"&x01[&x04R3D D3V!L GaG&x01] &x04%s: &x01beri ungag lojtarin &x04%s",get_pcvar_numpoint ) == name ""namet );
    
    return 
PLUGIN_HANDLED;
}
    
public 
counttask )
{
    new 
index task 123;
    if( !
is_user_connectedindex ) )
        return 
0;
        
    
g_GagTime[index] -= 1;
    
    if( 
g_GagTimeindex ] <= )
    {
        
remove_taskindex 123 );
        
        print( 
index"[R3D D3V!L] GAG juaj u largua me sukse ju lutem kujdes fjalorin!" );
        
g_Gagedindex ] = false;
    
        if( 
g_NameChangedindex ] )
            
client_cmdindex"name ^"%s^""g_nameindex ] );
        
        return 
0;
    }
    
    return 
1;
}

public 
checkid )
{
    new 
said192 ];
    
read_argssaidsizeof said );
    
    if( !
strlensaid ) )
        return 
PLUGIN_CONTINUE;
        
    if( 
g_Gagedid ] )
    {
        if( 
g_CmdGagid ] )
        {
            
CC_SendMessage(id"&x01[&x04R3D D3V!L GAG&x01] Keni marre GaG: &x04%s. &x01Kane mbetur &x04%d &x01minuta" ,g_adming_GagTimeid ], g_GagTimeid ] == "" "s" );
            
CC_SendMessage(id"&x01[&x04R3D D3V!L GAG&x01] Arsyeja : &x04%s"g_reason );
            
            return 
PLUGIN_HANDLED;
        
        } else if( 
g_SwearGagid ] ) {
                  
CC_SendMessage(id"&x01[&x04R3D D3V!L GAG&x01] Morret Gag per arsye &x04Ofendim&x01/&x04Reklamim.")
            
CC_SendMessage(id"&x01[&x04R3D D3V!L GAG&x01] Kane mbetur edhe &x04%d &x01minut",  g_GagTimeid ], g_GagTimeid ] == "" "s" );
            return 
PLUGIN_HANDLED;
        }
    } else {
        
        new 
bool:g_Swearedipos;
        
        for( 
0g_Count; ++)
        {
            if( ( 
pos containisaidg_Words][ ] ) ) != -)
            {
                
g_Len g_Words][ ];
                
                while( 
g_Len-- )
                    
saidpos++ ] = '*';
                    
                
g_Sweared true;
                continue;
            }
        }
        
        if( 
g_Sweared )
        {
            new 
cmd32 ], name32 ];
            
            
get_user_nameidnamesizeof name );
            
read_argv0cmdsizeof cmd );
            
copyg_nameid ], 31name );
            
            
engclient_cmdidcmdsaid );
            
g_Gagedid ] = true;
            
g_CmdGagid ] = false;
            
            if( 
get_pcvar_numtoggle_tag ) == )
            {
                new 
Buffer64 ];
                
formatexBuffersizeof Buffer 1"%s %s"tagname );
        
                
g_NameChangedid ] = true;
                
client_cmdid"name ^"%s^""Buffer) ;
            }
            
            
g_SwearGagid ] = true;
            
g_GagTimeid ] = SWEAR_GAGMINUTES;
            
            print( 
id"Ju nuk mund te perdorni kete fjale." );
        
            
set_task60.0"count",id+123,_,_,"b");
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
client_disconnect(id

    if(
g_Gaged[id]) 
    {
     new 
Nick[32],Authid[35],usrip[32]
     
get_user_name(id,Nick,31)
     
get_user_ip(id,usrip,31);
     
get_user_authid(id,Authid,34
     print(
0"^1[^4R3D D3V!L GaG^1] ^1Lojtari me gag^4 %s ^1[IP:^4 %s^x01] u largua nga serveri.",Nick,usrip)        
        
     
g_Gagedid ] = false;
         
g_SwearGagid ] = false;    
         
remove_taskid );
        
    }
}

print( 
id, const message[ ], { FloatSqlResult}:... )
{
    new 
Buffer128 ], Buffer2128 ];
    
    
formatexBuffer2sizeof Buffer2 1"%s"message );
    
vformatBuffersizeof Buffer 1Buffer2);
    
    if( 
id )
    {
        
message_beginMSG_ONEg_msgsaytext_,id );
        
write_byteid );
        
write_stringBuffer) ;
        
message_end();
    
    } else {
        new 
players32 ], indexnumi;
        
get_playersplayersnum"ch" );
        
        for( 
0numi++ )
        {
            
index players];
            if( !
is_user_connectedindex ) ) continue;
            
            
message_beginMSG_ONEg_msgsaytext_index );
            
write_byteindex );
            
write_stringBuffer );
            
message_end();
        }
    }

lantimilan is offline
Send a message via MSN to lantimilan