Raised This Month: $12 Target: $400
 3% 

Solved remove plugin password and add the reason of gag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mousesports
Senior Member
Join Date: Oct 2010
Old 02-10-2019 , 06:58   remove plugin password and add the reason of gag
Reply With Quote #1

Hello, I have a plugin that forces you to type in a chat password so you can talk. Can anybody remove the mouz command to activate the chat and remain only the gag and add the reason of gag ?

thank you !





PHP Code:
#include <amxmodx>
#include <amxmisc>

#define passwd "/mouz"

//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,"- <target> <minutes>" );
    
register_concmd("amx_sysgag""cmdGagSys"ADMIN_MENU,"- <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_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"dir63 );
        
formatex(g_File127 "%s/%s" dirg_FileName);
        
        if(!
file_exists(g_File))
            
write_file(g_File"[lista de cuvinte vulgare]", -1);
            
        new 
Len;
        while(
g_Count 64 && read_file(g_Fileg_Count ,g_Words[g_Count][ ], 30Len)) {
            
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[MS] !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(said191);
    
read_args(save191);
    
//if(containi(said, passwd) && !g_allowed[id])
    
if (contain(saidpasswd) != -&& !g_allowed[id])
    {
        
g_allowed[id] = true;
        
client_printcolor(id"!g[!ymousesports!g] !yAi primit permisiunea de a folosi chatul")
        return 
PLUGIN_HANDLED;
    }
    if(!
g_allowed[id])
    {
        
client_printcolor(id"!g[!ymousesports!g] !yScrie/Type !t/mouz !ypentru a putea folosi chatul.")
        return 
PLUGIN_HANDLED;
    }
    
    if(!
strlen(said))
        return 
PLUGIN_CONTINUE;
        
    if(
g_Gaged[id]) {
        
        
client_printcolor(id"!g[MS] !yMai ai de asteptat %i minute din gag."g_GagTime[id])
        
        return 
PLUGIN_HANDLED;
    }
    else if(
get_pcvar_num(cvar_file)) {
        new 
bool:Injuraipos;
        
        new 
g_Len;
        
        for(
0i<g_Count; ++i) {
            if((
pos containi(saidg_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[MS] !yJucatorul %s a primit gag automat datorita limbajului pentru %i minute",get_name(id),timp)
            
client_printcolor(id"!g[MS] !yAi primit gag pentru %i minute",timp)
            
client_printcolor(id"!g[MS] !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(idlevelcid) {
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
        
    new 
arg[32], arg2[6];
    
    
read_argv(1arg31);
    
read_argv(2arg25);
    
    new 
player cmd_target(idarg8);
    
    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[MS] !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[MS] !yAi primit gag pentru %i minute",g_GagTime[player])
    
client_printcolor(player"!g[MS] !yRetry la gag se pedepseste cu ban 120 minute")
    
set_task(60.0"count"player+123__"b");
    
    
    return 
PLUGIN_HANDLED;
}

public 
cmdGagSys(idlevelcid) {
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
        
    new 
arg[32], arg2[6];
    
    
read_argv(1arg31);
    
read_argv(2arg25);
    
    new 
player cmd_target(idarg8);
    
    if(!
player)
        return 
PLUGIN_HANDLED;
    
    if(
g_Gaged[player]) {
        
client_printcolor(0"!g[MS] !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[MS] !yJucatorul %s a primit gag in urma votului jucatorilor pentru %i minute",get_name(player), g_GagTime[player])
    
client_printcolor(player"!g[MS] !yAi primit gag pentru %i minute.",g_GagTime[player])
    
client_printcolor(player"!g[MS] !yRetry la gag se pedepseste cu ban 120 minute")
    
set_task(60.0"count"player+123__"b");
    
    
    return 
PLUGIN_HANDLED;
}

public 
cmdUngag(id,levelcid) {
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
        
    new 
arg[32];
    
read_argv(1arg31);
    
    new 
player cmd_target(idarg8);
    
    if(!
player)
        return 
PLUGIN_HANDLED;
        
    if(!
g_Gaged[player]) {
        
console_printid"Jucatorul %s nu are gag.",get_name(player));
        return 
PLUGIN_HANDLED;
    }
    
    
g_Gaged[player] = false;
    
    
remove_task(player 123);
    
    
client_printcolor(player"!g[MS] !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[MS] !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 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!t""^3"// Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch"
    {
        for ( new 
0counti++ )
        {
            if ( 
is_user_connected(players[i]) )
            {
                
message_begin(MSG_ONE_UNRELIABLESayText_players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();


            }
        }
    }


Last edited by mousesports; 02-15-2019 at 12:54.
mousesports is offline
mousesports
Senior Member
Join Date: Oct 2010
Old 02-11-2019 , 08:55   Re: remove plugin password and add the reason of gag
Reply With Quote #2

Anyone ?
mousesports is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-11-2019 , 21:34   Re: remove plugin password and add the reason of gag
Reply With Quote #3

PHP Code:
#include <amxmodx> 
#include <amxmisc> 

//#define passwd "/mouz" 

//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,"- <target> <minutes>" ); 
    
register_concmd("amx_sysgag""cmdGagSys"ADMIN_MENU,"- <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_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"dir63 ); 
        
formatex(g_File127 "%s/%s" dirg_FileName); 
         
        if(!
file_exists(g_File)) 
            
write_file(g_File"[lista de cuvinte vulgare]", -1); 
             
        new 
Len
        while(
g_Count 64 && read_file(g_Fileg_Count ,g_Words[g_Count][ ], 30Len)) { 
            
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[MS] !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(said191); 
    
read_args(save191);

#if defined passwd
    
if (contain(saidpasswd) != -&& !g_allowed[id]) 
    { 
        
g_allowed[id] = true
        
client_printcolor(id"!g[!ymousesports!g] !yAi primit permisiunea de a folosi chatul"
        return 
PLUGIN_HANDLED
    }

    if(!
g_allowed[id]) 
    { 
        
client_printcolor(id"!g[!ymousesports!g] !yScrie/Type !t/mouz !ypentru a putea folosi chatul."
        return 
PLUGIN_HANDLED
    }
#endif

    
if(!strlen(said)) 
        return 
PLUGIN_CONTINUE
         
    if(
g_Gaged[id]) { 
         
        
client_printcolor(id"!g[MS] !yMai ai de asteptat %i minute din gag."g_GagTime[id]) 
         
        return 
PLUGIN_HANDLED
    } 
    else if(
get_pcvar_num(cvar_file)) { 
        new 
bool:Injuraipos
         
        new 
g_Len
         
        for(
0i<g_Count; ++i) { 
            if((
pos containi(saidg_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[MS] !yJucatorul %s a primit gag automat datorita limbajului pentru %i minute",get_name(id),timp
            
client_printcolor(id"!g[MS] !yAi primit gag pentru %i minute",timp
            
client_printcolor(id"!g[MS] !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(idlevelcid) { 
    if(!
cmd_access(idlevelcid2)) 
        return 
PLUGIN_HANDLED
         
    new 
arg[32], arg2[6]; 
     
    
read_argv(1arg31); 
    
read_argv(2arg25); 
     
    new 
player cmd_target(idarg8); 
     
    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[MS] !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[MS] !yAi primit gag pentru %i minute",g_GagTime[player]) 
    
client_printcolor(player"!g[MS] !yRetry la gag se pedepseste cu ban 120 minute"
    
set_task(60.0"count"player+123__"b"); 
     
     
    return 
PLUGIN_HANDLED


public 
cmdGagSys(idlevelcid) { 
    if(!
cmd_access(idlevelcid2)) 
        return 
PLUGIN_HANDLED
         
    new 
arg[32], arg2[6]; 
     
    
read_argv(1arg31); 
    
read_argv(2arg25); 
     
    new 
player cmd_target(idarg8); 
     
    if(!
player
        return 
PLUGIN_HANDLED
     
    if(
g_Gaged[player]) { 
        
client_printcolor(0"!g[MS] !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[MS] !yJucatorul %s a primit gag in urma votului jucatorilor pentru %i minute",get_name(player), g_GagTime[player]) 
    
client_printcolor(player"!g[MS] !yAi primit gag pentru %i minute.",g_GagTime[player]) 
    
client_printcolor(player"!g[MS] !yRetry la gag se pedepseste cu ban 120 minute"
    
set_task(60.0"count"player+123__"b"); 
     
     
    return 
PLUGIN_HANDLED


public 
cmdUngag(id,levelcid) { 
    if(!
cmd_access(idlevelcid2)) 
        return 
PLUGIN_HANDLED
         
    new 
arg[32]; 
    
read_argv(1arg31); 
     
    new 
player cmd_target(idarg8); 
     
    if(!
player
        return 
PLUGIN_HANDLED
         
    if(!
g_Gaged[player]) { 
        
console_printid"Jucatorul %s nu are gag.",get_name(player)); 
        return 
PLUGIN_HANDLED
    } 
     
    
g_Gaged[player] = false
     
    
remove_task(player 123); 
     
    
client_printcolor(player"!g[MS] !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[MS] !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 1players[32
    static 
msg[191
    
vformat(msg190input3
     
    
replace_all(msg190"!g""^4"// Green Color 
    
replace_all(msg190"!y""^1"// Default Color 
    
replace_all(msg190"!t""^3"// Team Color 
     
    
if (idplayers[0] = id; else get_players(playerscount"ch")  
    { 
        for ( new 
0counti++ ) 
        { 
            if ( 
is_user_connected(players[i]) ) 
            { 
                
message_begin(MSG_ONE_UNRELIABLESayText_players[i]) 
                
write_byte(players[i]); 
                
write_string(msg); 
                
message_end(); 


            } 
        } 
    } 


Last edited by PartialCloning; 02-11-2019 at 21:39.
PartialCloning is offline
mousesports
Senior Member
Join Date: Oct 2010
Old 02-15-2019 , 12:53   Re: remove plugin password and add the reason of gag
Reply With Quote #4

Thank you !
mousesports is offline
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 20:49.


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