AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amx_gag (https://forums.alliedmods.net/showthread.php?t=213747)

yanke3 04-18-2013 11:38

amx_gag
 
Hi, so i have this plugin and i want the command "amx_gag name time" to be only "amx_gag name" the time option for the admin to not exist and to be 600 seconds like default, so the next time admin gag someone use "amx_gag name" and take automaticaly #define DEFAULT_TIME 600.0 . I know that is optionaly and i can use only "amx_gag name" right now but i want the function optional "time" to be removed so admin don't use.


PHP Code:

#include <amxmodx>
#include <amxmisc>

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

new const tag[] = "[Gag]";
new const 
g_FileName[] = "gag_words.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("Advance Gag""2.1""anakin_cstrike/ update -B1ng0-")
    
    
register_concmd"amx_gag""gag_cmd"ACCESS,"- <nume> <minute> <motiv> - Da gag jucatorului" );
    
register_concmd"amx_ungag""ungag_cmd"ACCESS"- <nume> - Scoate gagul" );
    
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"[Gag Words]", -);
        
    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"Jucatorul are deja gag!" );
        return 
PLUGIN_HANDLED;
    }
    
    
get_user_nametargetnamet31 );
    
copyg_nametarget ], 31namet );
    
    
g_CmdGagtarget ] = true;
    
g_Gaged[target] = true;
    
g_GagTimetarget ] = minutes;
    
    
client_print0print_chat"ADMIN %s: gag %s %d minute. Motiv: %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"Jucatorul %s nu are 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 );
    
    
client_print0print_chat"ADMIN %s: ungag %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"Ai primit ungag cu succes!" );
        
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 ] )
        {
            print( 
id,"Ai primit gag de la: %s. Au mai ramas %d minut(e)" ,g_adming_GagTimeid ], g_GagTimeid ] == "" "s" );
            print( 
id,"Motivul Gagului: %s"g_reason );
            
            return 
PLUGIN_HANDLED;
        
        } else if( 
g_SwearGagid ] ) {
                  print( 
id"Ai gag pentru limbaj vulgar sau reclama.")
            print( 
id"Au mai ramas %d minut(e)",  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"Ai gag pentru limbaj vulgar sau reclama." );
        
            
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
     
        
     
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();
        }
    }



fysiks 04-19-2013 00:56

Re: amx_gag
 
Immediately after line 84, add:

PHP Code:

    if( read_argc() < )
    {
        
minutes 600;
    } 


yanke3 04-19-2013 03:04

Re: amx_gag
 
Its not working.

fysiks 04-19-2013 03:24

Re: amx_gag
 
Quote:

Originally Posted by yanke3 (Post 1935569)
Its not working.

That statement is not very helpful.

yanke3 04-19-2013 03:29

Re: amx_gag
 
I added . But when i try amx_gag name its not working.

fysiks 04-19-2013 03:34

Re: amx_gag
 
Change the 4 on line 60 to 2.

P.S. When you post for help you need to give more details. Saying that "it doesn't work" several times rarely helps. When you type the command in the console it doesn't do nothing.


All times are GMT -4. The time now is 10:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.