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

problem with gag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-23-2019 , 06:53   problem with gag
Reply With Quote #1

Hi all . i use this slash commands .
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fakemeta> 
#include <cstrike> 
#include <colorchat> 

#pragma tabsize 0
#pragma compress 1

#define PLUGIN    "slash commands" 
#define VERSION    "10.3" 
#define AUTHOR    "Thew_ConFIger" 
#define ACCESS ADMIN_CVAR 
#define ADMINLEVEL  ADMIN_KICK 
#define CHAT_ACCESS ADMIN_KICK 

#define NoPass "" 


new g_pCvarchname 
new g_pCvarNoSay 
new block 
new maxplayers

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
     
    
g_pCvarchname register_cvar("sv_noname""0"
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged"

        
//pw 
    
register_clcmd("_Password""mmPass",ACCESS

    
// cvar to change pw  
     
        
register_cvar("pw_minplayer","6")  
     
    
g_pCvarNoSay register_cvar("sv_nosay""0"
    
register_clcmd("say""ClCmd_Say"
     
    
register_clcmd("chooseteam","choose_team"
    
register_clcmd("jointeam""choose_team"
    
block register_cvar("sv_chooseteam","1"
     
    
register_clcmd("say /r","restart",ACCESS
    
register_clcmd("say /a","amxmodmenu",ACCESS
    
register_clcmd("say /am","adminsmanager",ACCESS
    
register_clcmd("say /sxe","amx_sxe_menu",ACCESS
    
register_clcmd("say /ucp","ucp_menu",ACCESS
    
register_clcmd("say /bm","amx_banmenu",ACCESS
    
register_clcmd("say /k","amx_kickmenu",ACCESS
    
register_clcmd("say /ubm","amx_unbanmenu",ACCESS
      
register_clcmd("say /map","amx_mapmenu",ACCESS
      
register_clcmd("say /vote","amx_votemapmenu",ACCESS
    
register_clcmd("say /all1","all1",ACCESS
    
register_clcmd("say /all0","all0",ACCESS
    
register_clcmd("say /lv","lv",ACCESS
    
register_clcmd("say /last","last",ACCESS
    
register_clcmd("say /gg","gg",ACCESS
    
register_clcmd("say /dd2","de_dust2",ACCESS
    
register_clcmd("say /inferno","de_inferno",ACCESS
    
register_clcmd("say /nuke","de_nuke",ACCESS
    
register_clcmd("say /tuscan","de_tuscan",ACCESS)
    
register_clcmd("say /mirage","de_mirage",ACCESS
    
register_clcmd("say /train","de_train",ACCESS
    
register_clcmd("say /mix","mix",ACCESS
    
register_clcmd("say /warm","warm",ACCESS
    
register_clcmd("say /pub","pub",ACCESS
    
register_clcmd("say /p","puase",ACCESS
    
register_clcmd("say /g","gag",ACCESS
    
register_clcmd("say /t1","ontalk",ACCESS
    
register_clcmd("say /t0","offtalk",ACCESS
    
register_clcmd("say /v1","onvoice",ACCESS
    
register_clcmd("say /v0","offvoice",ACCESS
    
register_clcmd("say /dm1","ondm",ACCESS
    
register_clcmd("say /dm0","offdm",ACCESS
    
register_clcmd("say /s","swap",ACCESS
    
register_clcmd("say /pw""pw",ACCESS
    
register_clcmd("say /nopw","nopw",ACCESS
    
register_clcmd("say /team","team",ACCESS
    
register_clcmd("say /dl1","allowdownload1",ACCESS
    
register_clcmd("say /dl0","allowdownload0",ACCESS
    
register_clcmd("say /say0","say0",ACCESS
    
register_clcmd("say /say1","say1",ACCESS
    
register_clcmd("say /name0","name0",ACCESS
    
register_clcmd("say /name1","name1",ACCESS
    
register_clcmd("say /j1","join1",ACCESS
    
register_clcmd("say /j0","join0",ACCESS
    
register_clcmd("say /spec","spec",ACCESS
    
register_clcmd("say /kspec","KickSpec",ACCESS)
    
register_clcmd("say /knife1","kniferound",ACCESS)
    
register_clcmd("say /knife0","ukniferound",ACCESS)
    
    
maxplayers get_maxplayers();



public 
ClientUserInfoChanged(id

if( (
get_pcvar_numg_pCvarchname )==1) && !is_user_admin(id) ) 

static const 
name[] = "name" 
static szOldName[32], szNewName[32
pev(idpev_netnameszOldNamecharsmax(szOldName)) 
if( 
szOldName[0] ) 

get_user_info(idnameszNewNamecharsmax(szNewName)) 
if( !
equal(szOldNameszNewName) ) 

set_user_info(idnameszOldName
return 
FMRES_HANDLED 


client_print(idprint_chat".:: Change nick is blocked by admin ::."
client_print(idprint_chat"*** this plugin made by Thew ConFIger  ***"

if( (
get_pcvar_numg_pCvarchname )==0) && !is_user_admin(id) ) 

static const 
name[] = "name" 
static szOldName[32], szNewName[32
pev(idpev_netnameszOldNamecharsmax(szOldName)) 
if( 
szOldName[0] ) 

get_user_info(idnameszNewNamecharsmax(szNewName)) 
if( !
equal(szOldNameszNewName) ) 

set_user_info(idnameszNewName
return 
FMRES_HANDLED 


client_print(idprint_chat"::: www.MadMaxCs.ir :::"
client_print(idprint_chat"*** this plugin made by ThewConFIger ***"

return 
FMRES_IGNORED 
}  

public 
ClCmd_Sayid 

    if( 
get_pcvar_numg_pCvarNoSay ) && !is_user_admin(id) ) 
    { 
        
client_print(idprint_chat".:: Say is disabled, only admins can use it ::."
        
client_print(idprint_chat"*** this plugin made by ThewConfiger ***"
        return 
PLUGIN_HANDLED_MAIN 
    

    return 
PLUGIN_CONTINUE 


public 
choose_team(id

    new 
n_block get_pcvar_num(block
     
    if(
n_block != 1) return PLUGIN_HANDLED 

    
return PLUGIN_CONTINUE 


public 
restart(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_restart 1"); 
        
ColorChat(0BLUE,"%s: /r",name

    } 
    return 
PLUGIN_HANDLED 

public 
amxmodmenu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amxmodmenu"); 
        
ColorChat(0BLUE,"%s: /a",name
    } 
    return 
PLUGIN_HANDLED 

public 
adminsmanager(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"adminsmanager"); 
        
ColorChat(0BLUE,"%s: /am",name); 
    } 
    return 
PLUGIN_HANDLED 

public 
amx_sxe_menu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_sxe_menu"); 
        
ColorChat(0BLUE,"%s: /sxe",name
    } 
    return 
PLUGIN_HANDLED 

public 
ucp_menu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"ucp_menu"); 
        
ColorChat(0BLUE,"%s: /ucp",name
    } 
    return 
PLUGIN_HANDLED 

public 
amx_banmenu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_banmenu"); 
        
ColorChat(0BLUE,"%s: /bm",name
    } 
    return 
PLUGIN_HANDLED 

public 
amx_kickmenu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_kickmenu"); 
        
ColorChat(0BLUE,"%s: /k",name
    } 
    return 
PLUGIN_HANDLED 

public 
dm1(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("spawn_wait_time = 0.25")
    
client_cmd(id,"say /r");
        
ColorChat(0BLUE,"%s: /dm1",name
    
ColorChat(0RED,"*** DeathMatch Round Started  ***");
    } 
    return 
PLUGIN_HANDLED 

public 
amx_unbanmenu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_unbanmenu"); 
        
ColorChat(0BLUE,"%s: /ubm",name
    } 
    return 
PLUGIN_HANDLED 

public 
amx_mapmenu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_mapmenu"); 
        
ColorChat(0BLUE,"%s: /map",name
        }     
        return 
PLUGIN_HANDLED 

public 
amx_votemapmenu(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_votemapmenu"); 
        
ColorChat(0BLUE,"%s: /vote",name
            } 
    return 
PLUGIN_HANDLED 

public 
all1(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_allowdownload 1"); 
        
server_cmd("sv_allowupload 1"); 
        
server_cmd("sv_voiceenable 1"); 
        
server_cmd("sv_alltalk 1"); 
        
server_cmd("sv_password "); 
                
server_cmd("sv_nosay 0"); 
        
server_cmd("sv_chooseteam 1"); 
        
server_cmd("sv_noname 0"); 

        
ColorChat(0BLUE,"%s: /all1",name); 
        
ColorChat(0GREEN,"*** | ALL1 | Say1 | Dl1 | Talk1 |Join1 | Name1 |***"); 
        
ColorChat(0RED,"*** This plugin made by ThewConfiger  ***"); 

            } 
    return 
PLUGIN_HANDLED 

public 
all0(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_allowdownload 0"); 
        
server_cmd("sv_allowupload 0"); 
        
server_cmd("sv_voiceenable 1"); 
        
server_cmd("sv_alltalk 0"); 
        
server_cmd("sv_password "); 
                
server_cmd("sv_nosay 1"); 
        
server_cmd("sv_chooseteam 0"); 
        
server_cmd("sv_noname 1"); 

        
ColorChat(0BLUE,"%s: /all0",name); 
        
ColorChat(0GREEN,"*** | All0 | Say0 | Dl0 | Talk0 |Join0 | Name0 |***"); 
        
ColorChat(0RED,"*** this plugin made by ThewConfiger ***"); 
             } 
    return 
PLUGIN_HANDLED 

public 
lv(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_restart 3"); 

        
ColorChat(0BLUE,"%s: /lv",name); 
        
ColorChat(0GREEN,"*** Live ***"); 
        
ColorChat(0GREEN,"*** Live ***"); 
        
ColorChat(0GREEN,"*** Live ***"); 
        
ColorChat(0GREEN,"*** Live ***"); 
ColorChat(0RED,"*** This plugin made by ThewConfiger  ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
de_dust2(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_map de_dust2"); 

        
ColorChat(0BLUE,"%s: /dd2",name); 
        
ColorChat(0GREEN,"*** Map change to de_dust2 ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
de_inferno(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_map de_inferno"); 

        
ColorChat(0BLUE,"%s: /inferno",name); 
        
ColorChat(0GREEN,"*** Map change to de_inferno ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
de_nuke(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_map de_nuke"); 

        
ColorChat(0BLUE,"%s: /nuke",name); 
        
ColorChat(0GREEN,"*** Map change to de_nuke ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
de_tuscan(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_map de_tuscan"); 

        
ColorChat(0BLUE,"%s: /tuscan",name); 
        
ColorChat(0GREEN,"*** Map change to de_tuscan ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
de_mirage(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_map de_mirage"); 

        
ColorChat(0BLUE,"%s: /mirage",name); 
        
ColorChat(0GREEN,"*** Map change to de_mirage ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
de_train(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_map de_train"); 

        
ColorChat(0BLUE,"%s: /train",name); 
        
ColorChat(0GREEN,"*** Map change to de_train ***"); 


             } 
    return 
PLUGIN_HANDLED 

public 
last(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31

        
ColorChat(0BLUE,"%s: /last",name); 
        
ColorChat(0GREEN,"*** Last ***"); 
        
ColorChat(0GREEN,"*** Last ***"); 
        
ColorChat(0GREEN,"*** Last ***"); 
        
ColorChat(0GREEN,"*** Last ***"); 
ColorChat(0RED,"*** this plugin made by ThewConfiger ***"); 

         } 
    return 
PLUGIN_HANDLED 

public 
gg(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("mp_autokick 0"); 
        
server_cmd("mp_fadetoblack 0"); 
        
server_cmd("mp_autocrosshair 0"); 
        
server_cmd("mp_autoteambalance 0"); 
        
server_cmd("mp_buytime 0.25"); 
        
server_cmd("mp_consistency 1"); 
        
server_cmd("mp_c4timer 35"); 
        
server_cmd("mp_flashlight 1"); 
        
server_cmd("mp_forcechasecam 2"); 
        
server_cmd("mp_forcecamera 2"); 
        
server_cmd("mp_footsteps 1"); 
        
server_cmd("mp_freezetime 0"); 
        
server_cmd("mp_friendlyfire 0"); 
        
server_cmd("mp_limitteams 0"); 
        
server_cmd("mp_maxrounds 0"); 
        
server_cmd("mp_roundtime 2"); 
        
server_cmd("mp_timelimit 0"); 
        
server_cmd("mp_tkpunish 0"); 
        
server_cmd("mp_friendly_grenade_damage 0"); 
        
server_cmd("mp_startmoney 16000"); 
        
server_cmd("sv_allowdownload 1"); 
        
server_cmd("sv_allowupload 1"); 
        
server_cmd("sv_voiceenable 1"); 
        
server_cmd("sv_alltalk 1"); 
        
server_cmd("sv_proxies 1"); 
        
server_cmd("sv_cheats 0"); 
        
server_cmd("sv_gravity 800"); 
        
server_cmd("allow_spectators 1"); 
        
server_cmd("sys_ticrate 10000"); 
        
server_cmd("sv_timeout 65"); 
        
server_cmd("sv_aim 0"); 
        
server_cmd("statsme_off"); 
        
server_cmd("sv_password ^"^""); 
        
server_cmd("sv_restart 1"); 
        
server_cmd("sv_allowdownload 1"); 
        
server_cmd("sv_allowupload 1"); 
        
server_cmd("sv_voiceenable 1"); 
        
server_cmd("sv_alltalk 1"); 
        
server_cmd("sv_password "); 
                
server_cmd("sv_nosay 0"); 
        
server_cmd("sv_chooseteam 1"); 
        
server_cmd("sv_noname 0"); 

        
ColorChat(0BLUE,"%s: /gg",name); 
        
ColorChat(0GREEN,"*** GOOD GAME ***"); 
        
ColorChat(0GREEN,"*** GOOD GAME ***"); 
        
ColorChat(0GREEN,"*** GOOD GAME ***"); 
        
ColorChat(0GREEN,"*** GOOD GAME ***"); 
        
ColorChat(0RED,"*** this plugin made by ThewConfiger ***"); 

             } 
    return 
PLUGIN_HANDLED 

public 
mix(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
    {      
    for( new 
ii<maxplayersi++ )

        
user_kill(i)    
    } 
           
server_cmd("mp_autokick 0"); 
            
server_cmd("mp_fadetoblack 0"); 
            
server_cmd("mp_autocrosshair 0"); 
            
server_cmd("mp_autoteambalance 0"); 
            
server_cmd("mp_buytime 0.25"); 
            
server_cmd("mp_consistency 1"); 
            
server_cmd("mp_c4timer 35"); 
            
server_cmd("mp_flashlight 1"); 
            
server_cmd("mp_forcechasecam 2"); 
            
server_cmd("mp_forcecamera 2"); 
            
server_cmd("mp_footsteps 1"); 
            
server_cmd("mp_freezetime 15"); 
            
server_cmd("mp_friendlyfire 1"); 
            
server_cmd("mp_limitteams 0"); 
            
server_cmd("mp_maxrounds 0"); 
            
server_cmd("mp_roundtime 2"); 
            
server_cmd("mp_timelimit 0"); 
            
server_cmd("mp_tkpunish 0"); 
            
server_cmd("mp_friendly_grenade_damage 1"); 
            
server_cmd("mp_startmoney 800"); 
            
server_cmd("sv_allowdownload 0"); 
            
server_cmd("sv_allowupload 0"); 
            
server_cmd("sv_voiceenable 1"); 
            
server_cmd("sv_alltalk 0"); 
            
server_cmd("sv_proxies 1"); 
            
server_cmd("sv_cheats 0"); 
            
server_cmd("sv_gravity 800"); 
            
server_cmd("sys_ticrate 10000"); 
            
server_cmd("sv_timeout 65"); 
            
server_cmd("sv_aim 0"); 
            
server_cmd("statsme_off"); 
            
server_cmd("sv_password "); 
            
server_cmd("sv_restart 1"); 
            
server_cmd("sv_restart 5"); 
         
            
ColorChat(0BLUE,"%s: /mix",name); 
            
ColorChat(0GREEN,"*** Mix ***"); 
            
ColorChat(0GREEN,"*** Mix ***"); 
            
ColorChat(0GREEN,"*** Mix ***"); 
            
ColorChat(0RED,"*** Please all Go to spect ***"); 
            
ColorChat(0RED,"*** Please all Go to spect ***"); 
            
ColorChat(0RED,"*** this plugin made by ThewConfiger ***"); 

            } 
    return 
PLUGIN_HANDLED 

public 
warm(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("mp_autokick 0"); 
        
server_cmd("mp_fadetoblack 0"); 
        
server_cmd("mp_autocrosshair 0"); 
        
server_cmd("mp_autoteambalance 0"); 
        
server_cmd("mp_buytime 0.25"); 
        
server_cmd("mp_consistency 1"); 
        
server_cmd("mp_c4timer 35"); 
        
server_cmd("mp_flashlight 1"); 
        
server_cmd("mp_forcechasecam 2"); 
        
server_cmd("mp_forcecamera 2"); 
        
server_cmd("mp_footsteps 1"); 
        
server_cmd("mp_freezetime 0"); 
        
server_cmd("mp_friendlyfire 0"); 
        
server_cmd("mp_limitteams 0"); 
        
server_cmd("mp_maxrounds 0"); 
        
server_cmd("mp_roundtime 2"); 
        
server_cmd("mp_timelimit 0"); 
        
server_cmd("mp_tkpunish 0"); 
        
server_cmd("mp_friendly_grenade_damage 0"); 
        
server_cmd("mp_startmoney 16000"); 
        
server_cmd("sv_allowdownload 1"); 
        
server_cmd("sv_allowupload 1"); 
        
server_cmd("sv_voiceenable 1"); 
        
server_cmd("sv_alltalk 1"); 
        
server_cmd("sv_proxies 1"); 
        
server_cmd("sv_cheats 0"); 
        
server_cmd("sv_gravity 800"); 
        
server_cmd("allow_spectators 1"); 
        
server_cmd("sys_ticrate 10000"); 
        
server_cmd("sv_timeout 65"); 
        
server_cmd("sv_aim 0"); 
        
server_cmd("statsme_off"); 
        
server_cmd("sv_password ^"^""); 
        
server_cmd("sv_restart 1"); 
        
server_cmd("sv_restart 5"); 
         
        
ColorChat(0BLUE,"%s: /warm",name); 
        
ColorChat(0GREEN,"*** Warm  ***"); 
        
ColorChat(0GREEN,"*** Warm  ***"); 
        
ColorChat(0GREEN,"*** Warm  ***"); 
        
ColorChat(0RED,"*** this plugin made by ThewConfiger ***"); 
    } 
    return 
PLUGIN_HANDLED 

public 
pub(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("mp_autokick 0"); 
        
server_cmd("mp_fadetoblack 0"); 
        
server_cmd("mp_autocrosshair 0"); 
        
server_cmd("mp_autoteambalance 0"); 
        
server_cmd("mp_buytime 0.25"); 
        
server_cmd("mp_consistency 1"); 
        
server_cmd("mp_c4timer 35"); 
        
server_cmd("mp_flashlight 1"); 
        
server_cmd("mp_forcechasecam 0"); 
        
server_cmd("mp_forcecamera 0"); 
        
server_cmd("mp_footsteps 1"); 
        
server_cmd("mp_freezetime 5"); 
        
server_cmd("mp_friendlyfire 0"); 
        
server_cmd("mp_limitteams 0"); 
        
server_cmd("mp_maxrounds 50"); 
        
server_cmd("mp_roundtime 3"); 
        
server_cmd("mp_timelimit 0"); 
        
server_cmd("mp_tkpunish 0"); 
        
server_cmd("mp_friendly_grenade_damage 1"); 
        
server_cmd("mp_startmoney 800"); 
        
server_cmd("sv_allowdownload 1"); 
        
server_cmd("sv_allowupload 1"); 
        
server_cmd("sv_voiceenable 1"); 
        
server_cmd("sv_alltalk 0"); 
        
server_cmd("sv_proxies 1"); 
        
server_cmd("sv_cheats 0"); 
        
server_cmd("sv_gravity 800"); 
        
server_cmd("allow_spectators 1"); 
        
server_cmd("sys_ticrate 10000"); 
        
server_cmd("sv_timeout 65"); 
        
server_cmd("sv_aim 0"); 
        
server_cmd("sv_password ^"^""); 
        
server_cmd("sv_restart 1"); 
        
server_cmd("sv_restart 5"); 
         
        
ColorChat(0BLUE,"%s: /pub",name); 
        
ColorChat(0GREEN,"*** Public  ***"); 
        
ColorChat(0GREEN,"*** Public  ***"); 
        
ColorChat(0GREEN,"*** Public  ***"); 
        
ColorChat(0RED,"*** this plugin made by ThewConfiger ***"); 
    } 
    return 
PLUGIN_HANDLED 

public 
puase(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_pause"); 
        
ColorChat(0BLUE,"%s: /p",name
    } 
    return 
PLUGIN_HANDLED 

public 
gag(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("amx_gagmenu"); 
        
ColorChat(0BLUE,"%s: /g",name
    } 
    return 
PLUGIN_HANDLED 

public 
ontalk(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_alltalk 1"); 
        
ColorChat(0BLUE,"%s: /t1",name
    } 
    return 
PLUGIN_HANDLED 

public 
offtalk(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_alltalk 0"); 
        
ColorChat(0BLUE,"%s: /t0",name
    } 
    return 
PLUGIN_HANDLED 

public 
onvoice(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_voiceenable 1"); 
        
ColorChat(0BLUE,"%s: /v1",name
    } 
    return 
PLUGIN_HANDLED 

public 
offvoice(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_voiceenable 0"); 
        
ColorChat(0BLUE,"%s: /v0",name
    } 
    return 
PLUGIN_HANDLED 

public 
ondm(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_respawn 1"); 
        
ColorChat(0BLUE,"%s: /dm1",name
    } 
    return 
PLUGIN_HANDLED 

public 
offdm(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_respawn 0"); 
        
ColorChat(0BLUE,"%s: /dm0",name
    
ColorChat(0RED,"*** DeathMatch Round Ended  ***");
    } 
    return 
PLUGIN_HANDLED 

public 
swap(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
         
        new 
players[32], num 
        get_players
(playersnum
        new 
player 
        
for(new 0numi++) 
            { 
                
player players[i
                if(
is_user_connected(player)) 
                { 
                    switch( 
cs_get_user_teamplayer ) ) 
                    { 
                        case 
CS_TEAM_Tcs_set_user_teamplayerCS_TEAM_CT 
                        case 
CS_TEAM_CTcs_set_user_teamplayerCS_TEAM_T 
                    } 
                } 

            } 
        
server_cmd("sv_restart 1"
        
ColorChat(0BLUE,"%s: /s",name
    } 
    return 
PLUGIN_HANDLED 

public 
pwidlevelcid
{   
            if(!
cmd_access(id,level,cid,1)) 

            return  


            
client_cmd(id"messagemode _Password")  
              
}  

public 
mmPass(id)  
{  
                new 
szTemp[64]  
                
read_args(szTempcharsmax(szTemp))  
                
server_cmd("sv_password %s",szTemp
        
ColorChat(0GREEN,"Admin Set Server Password Now %s",szTemp


             

public 
nopw(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_password ^"^""); 
        
ColorChat(0BLUE,"%s: /nopw",name
    } 
    return 
PLUGIN_HANDLED 

public 
team(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_teammenu"); 
        
ColorChat(0BLUE,"%s: /team",name
    } 
    return 
PLUGIN_HANDLED 

public 
allowdownload1(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_allowdownload 1"); 
        
ColorChat(0BLUE,"%s: /dl1",name

    } 
    return 
PLUGIN_HANDLED 

public 
allowdownload0(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_allowdownload 0"); 
        
ColorChat(0BLUE,"%s: /dl0",name

    } 
    return 
PLUGIN_HANDLED 

public 
say0(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_nosay 1"); 
        
ColorChat(0BLUE,"%s: /say0",name

    } 
    return 
PLUGIN_HANDLED 

public 
say1(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_nosay 0"); 
        
ColorChat(0BLUE,"%s: /say1",name

    } 
    return 
PLUGIN_HANDLED 

public 
name0(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_noname 1"); 
        
ColorChat(0BLUE,"%s: /name0",name

    } 
    return 
PLUGIN_HANDLED 

public 
name1(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_noname 0"); 
        
ColorChat(0BLUE,"%s: /name1",name

    } 
    return 
PLUGIN_HANDLED 

public 
join1(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_chooseteam 1"); 
        
ColorChat(0BLUE,"%s: /join1",name

    } 
    return 
PLUGIN_HANDLED 

public 
join0(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
server_cmd("sv_chooseteam 0"); 
        
ColorChat(0BLUE,"%s: /join0",name

    } 
    return 
PLUGIN_HANDLED 

public 
spec(idlevelcid

    if(
cmd_access(id,levelcid1)) 
            { 
            new 
name[32
            
get_user_info(id"name"name31
            {     
    new 
players[32], pnumtempid 
    get_players
(playerspnum
     
    for( new 
ii<pnumi++ )  
    { 
        
tempid players[i
        
user_kill(tempid
        
cs_set_user_team(tempidCS_TEAM_SPECTATOR
    } 


            } 
            
server_cmd("sv_restart 1"
            
ColorChat(0BLUE,"%s: /spec",name
            } 
    return 
PLUGIN_HANDLED 

public 
KickSpec(idlevelcid

if (!
cmd_access(idlevelcid1)) 
return 
PLUGIN_HANDLED
new 
Players[32], iCount
get_players(PlayersiCount"e""SPECTATOR"); 
new 
name[32
get_user_info(id"name"name31
if (
iCount 0

for (new 
0iCountk++) 

server_cmd("kick #%d"get_user_userid(Players[k])); 
ColorChat(0BLUE,"%s: /kspec",name

server_exec(); 

return 
PLUGIN_HANDLED
}
public 
kniferound(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_knivesonly 1");
        
ColorChat(0GREEN,"%s: /knife1",name)
    
client_cmd(id,"say /r");
    
ColorChat(0RED,"*** SerVer StarTed Knife***");
    } 
    return 
PLUGIN_HANDLED 

public 
ukniferound(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_knivesonly 0");
        
ColorChat(0GREEN,"%s: /knife0",name)
    
client_cmd(id,"say /r");
    
ColorChat(0RED,"*** SerVer Ended Knife***");
    } 
    return 
PLUGIN_HANDLED 

and this gag menu
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < engine >
#include < sqlx >

#define MAX_PLAYERS 32

#define MAX_PATTERN_LEN 255

enum ( <<= )
{
    
GAG_CHAT 1,
    
GAG_TEAMSAY,
    
GAG_VOICE
};

enum _:GagData
{
    
GAG_AUTHID35 ],
    
GAG_TIME,
    
GAG_START,
    
GAG_FLAGS
};

enum _:TimeUnit
{
    
TIMEUNIT_SECONDS 0,
    
TIMEUNIT_MINUTES,
    
TIMEUNIT_HOURS,
    
TIMEUNIT_DAYS,
    
TIMEUNIT_WEEKS
};

new const 
g_szTimeUnitNameTimeUnit ][ ][ ] =
{
    { 
"second""seconds" },
    { 
"minute""minutes" },
    { 
"hour",   "hours"   },
    { 
"day",    "days"    },
    { 
"week",   "weeks"   }
};

new const 
g_iTimeUnitMultTimeUnit ] =
{
    
1,
    
60,
    
3600,
    
86400,
    
604800
};

new const 
DATETIME_FORMAT[ ] = "%Y-%m-%d %H:%M:%S";
const 
DATE_SIZE 20;

new Array:
g_aGagTimes;
new Array:
g_aGagData;
new 
Trie:g_tArrayPos;
new 
Trie:g_tTimeUnitWords;

new 
g_iGagged;
new 
g_iThinker;
new 
g_iTotalGagTimes;
new 
g_iMsgSayText;

new 
g_szAuthidMAX_PLAYERS ][ 35 ];
new 
g_iMenuOptionMAX_PLAYERS ];
new 
g_iMenuPositionMAX_PLAYERS ];
new 
g_iMenuPlayersMAX_PLAYERS ][ 32 ];
new 
g_iMenuFlagsMAX_PLAYERS ];

new 
g_szGagFile64 ];

new 
bool:g_bColorSupported;

new 
g_pCvarDefaultFlags;
new 
g_pCvarDefaultTime;
new 
g_pCvarTimeUnit;
new 
g_pCvarMaxTime;
new 
g_pCvarSQL;
new 
g_pCvarSQLHost;
new 
g_pCvarSQLUser;
new 
g_pCvarSQLPass;
new 
g_pCvarSQLDb;

new 
bool:g_bUsingSQL false;
new 
Handle:g_hSqlTuple;

public 
plugin_init( )
{
    
register_plugin"AMXX Gag""1.4.9""xPaw & Exolent" );
    
    
register_clcmd"say",        "CmdSay" );
    
register_clcmd"say_team",   "CmdTeamSay" );
    
    
register_concmd"amx_gag",       "CmdGagPlayer",   ADMIN_KICK"<nick or #userid> <time> <a|b|c> -- Use 0 time for permanent" );
    
register_concmd"amx_addgag",    "CmdAddGag",      ADMIN_KICK"<authid> <time> <a|b|c> -- Use 0 time for permanent" );
    
register_concmd"amx_ungag",     "CmdUnGagPlayer"ADMIN_KICK"<nick or #userid>" );
    
register_concmd"amx_gagmenu",   "CmdGagMenu",     ADMIN_KICK"- displays gag menu" );
    
register_srvcmd"amx_gag_times""CmdSetBanTimes" );
    
    
register_menu"Gag Menu"1023"ActionGagMenu" );
    
register_menu"Gag Flags"1023"ActionGagFlags" );
    
register_messageget_user_msgid"SayText" ), "MessageSayText" );
    
    
g_pCvarDefaultFlags register_cvar"amx_gag_default_flags""abc"   );
    
g_pCvarDefaultTime  register_cvar"amx_gag_default_time",  "600"   );
    
g_pCvarTimeUnit     register_cvar"amx_gag_time_units",    "0"     );
    
g_pCvarMaxTime      register_cvar"amx_gag_max_time",      "86400" );
    
g_pCvarSQL          register_cvar"amx_gag_sql",           "0"     );
    
g_pCvarSQLHost      register_cvar"amx_gag_sql_host",      ""      );
    
g_pCvarSQLUser      register_cvar"amx_gag_sql_user",      ""      );
    
g_pCvarSQLPass      register_cvar"amx_gag_sql_pass",      ""      );
    
g_pCvarSQLDb        register_cvar"amx_gag_sql_db",        ""      );
    
    
g_tArrayPos       TrieCreate( );
    
g_aGagTimes       ArrayCreate( );
    
g_aGagData        ArrayCreateGagData );
    
g_bColorSupported bool:colored_menus( );
    
g_iMsgSayText     get_user_msgid"SayText" );
    
    
// let words work with the time unit cvar
    
g_tTimeUnitWords TrieCreate( );
    
    for( new 
0TimeUniti++ )
    {
        
TrieSetCellg_tTimeUnitWordsg_szTimeUnitName][ ], );
        
TrieSetCellg_tTimeUnitWordsg_szTimeUnitName][ ], );
    }
    
    
// this is used for ungag in the menu
    
ArrayPushCellg_aGagTimes);
    
    
// Gag times for the gag menu (amx_gagmenu)
    // Default values: 60 300 600 1800 3600 7200 86400
    
new const iDefaultTimes[ ] = { 6030060018003600720086400};
    
    
// Load up standart times
    
for( new 0sizeofiDefaultTimes ); i++ )
    {
        
ArrayPushCellg_aGagTimesiDefaultTimes] );
    }
    
    
g_iTotalGagTimes sizeofiDefaultTimes ) + 1;
    
    
// Set up entity-thinker
    
new const szClassName[ ] = "gag_thinker";
    
    
g_iThinker create_entity"info_target" );
    
entity_set_stringg_iThinkerEV_SZ_classnameszClassName );
    
    
register_thinkszClassName"FwdThink" );
    
    
// load gags from file
    
get_datadirg_szGagFilecharsmaxg_szGagFile ) );
    
addg_szGagFilecharsmaxg_szGagFile ), "/gags.txt" );
    
    
// set server's SteamID to "SERVER"
    
copyg_szAuthid], charsmaxg_szAuthid[ ] ), "SERVER" );
}

public 
plugin_cfg( )
{
    
// check SQL
    
InitSQL( );
    
    if( !
g_bUsingSQL )
    {
        
// if no SQL, load file
        
LoadFromFile( );
    }
}

InitSQL( )
{
    
// init SQL after configs were executed
    
if( get_pcvar_numg_pCvarSQL ) )
    {
        new 
szHost64 ], szUser64 ], szPass64 ], szDb64 ];
        
get_pcvar_stringg_pCvarSQLHostszHostcharsmaxszHost ) );
        
get_pcvar_stringg_pCvarSQLUserszUsercharsmaxszUser ) );
        
get_pcvar_stringg_pCvarSQLPassszPasscharsmaxszPass ) );
        
get_pcvar_stringg_pCvarSQLDb,   szDb,   charsmaxszDb   ) );
        
        
g_hSqlTuple SQL_MakeDbTupleszHostszUserszPassszDb );
        
        if( 
g_hSqlTuple == Empty_Handle ) return;
        
        
// TABLE STRUCTURE
        // admin_name VARCHAR(32) NOT NULL
        // admin_steamid VARCHAR(35) NOT NULL
        // admin_ip VARCHAR(15) NOT NULL
        // player_name VARCHAR(32) NOT NULL
        // player_steamid VARCHAR(35) NOT NULL PRIMARY KEY
        // player_ip VARCHAR(15) NOT NULL
        // date_gagged DATETIME NOT NULL
        // date_ungag DATETIME NOT NULL
        // gag_seconds INT NOT NULL
        // gag_flags VARCHAR(3) NOT NULL
        
        
new iErrorszError128 ];
        new 
Handle:hDb SQL_Connectg_hSqlTupleiErrorszErrorcharsmaxszError ) );
        
        if( 
hDb == Empty_Handle )
        {
            
log_amx"Failed to connect to database: (%d) %s"iErrorszError );
            return;
        }
        
        new 
Handle:hQuery SQL_PrepareQueryhDb"CREATE TABLE IF NOT EXISTS gagged_players (\
            admin_name VARCHAR(32) NOT NULL,\
            admin_steamid VARCHAR(35) NOT NULL,\
            admin_ip VARCHAR(15) NOT NULL,\
            player_name VARCHAR(32) NOT NULL,\
            player_steamid VARCHAR(35) NOT NULL PRIMARY KEY,\
            player_ip VARCHAR(15) NOT NULL,\
            date_gagged DATETIME NOT NULL,\
            date_ungag DATETIME NOT NULL,\
            gag_seconds INT NOT NULL,\
            gag_flags VARCHAR(3) NOT NULL);" 
);
        
        if( !
SQL_ExecutehQuery ) )
        {
            
SQL_QueryErrorhQueryszErrorcharsmaxszError ) );
            
log_amx"Failed create table query: %s"szError );
        }
        else
        {
            
SQL_FreeHandlehQuery );
            
            new 
szDateDATE_SIZE ];
            
get_timeDATETIME_FORMATszDatecharsmaxszDate ) );
            
            
// load all users
            
hQuery SQL_PrepareQueryhDb"SELECT * FROM gagged_players WHERE date_ungag > '%s';"szDate );
            
            if( !
SQL_ExecutehQuery ) )
            {
                
SQL_QueryErrorhQueryszErrorcharsmaxszError ) );
                
log_amx"Failed load gags query: %s"szError );
            }
            else
            {
                
g_bUsingSQL true;
                
                if( 
SQL_NumResultshQuery ) )
                {
                    new 
dataGagData ];
                    new 
szFlags];
                    
                    new 
iFieldSteamID SQL_FieldNameToNumhQuery"player_steamid" );
                    new 
iFieldDateGagged SQL_FieldNameToNumhQuery"date_gagged" );
                    new 
iFieldGagTime SQL_FieldNameToNumhQuery"gag_seconds" );
                    new 
iFieldGagFlags SQL_FieldNameToNumhQuery"gag_flags" );
                    
                    while( 
SQL_MoreResultshQuery ) )
                    {
                        
SQL_ReadResulthQueryiFieldSteamIDdataGAG_AUTHID ], charsmaxdataGAG_AUTHID ] ) );
                        
SQL_ReadResulthQueryiFieldDateGaggedszDatecharsmaxszDate ) );
                        
dataGAG_TIME ] = SQL_ReadResulthQueryiFieldGagTime );
                        
SQL_ReadResulthQueryiFieldGagFlagsszFlagscharsmaxszFlags ) );
                        
                        
dataGAG_START ] = strtotimeszDate );
                        
dataGAG_FLAGS ] = read_flagsszFlags );
                        
                        
ArrayPushArrayg_aGagDatadata );
                        
TrieSetCellg_tArrayPosdataGAG_AUTHID ], g_iGagged );
                        
g_iGagged++;
                        
                        
SQL_NextRowhQuery );
                    }
                }
            }
        }
        
        
SQL_FreeHandlehQuery );
        
SQL_FreeHandlehDb );
    }
}

public 
plugin_end( )
{
    
TrieDestroyg_tArrayPos );
    
ArrayDestroyg_aGagData );
    
ArrayDestroyg_aGagTimes );
    
TrieDestroyg_tTimeUnitWords );
}

public 
CmdSetBanTimes( )
{
    new 
iArgs read_argc( );
    
    if( 
iArgs <= )
    {
        
server_print"Usage: amx_gag_times <time1> [time2] [time3] ..." );
        return 
PLUGIN_HANDLED;
    }
    
    
ArrayClearg_aGagTimes );
    
    
// this is used for ungag in the menu
    
ArrayPushCellg_aGagTimes);
    
g_iTotalGagTimes 1;
    
    
// get max time allowed
    
new iTimeLimit get_pcvar_numg_pCvarMaxTime );
    
    new 
szBuffer32 ], iTime;
    for( new 
1iArgsi++ )
    {
        
read_argviszBuffer31 );
        
        if( !
is_str_numszBuffer ) )
        {
            
server_print"[AMXX GAG] Time must be an integer!" );
            continue;
        }
        
        
iTime str_to_numszBuffer );
        
        if( 
iTime )
        {
            
server_print"[AMXX GAG] Time must be a positive integer!" );
            continue;
        }
        
        if( 
iTimeLimit iTime )
        {
            
server_print"[AMXX GAG] Time more then %d is not allowed!"iTimeLimit );
            continue;
        }
        
        
ArrayPushCellg_aGagTimesiTime );
        
g_iTotalGagTimes++;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
client_putinserverid )
{
    if( 
CheckGagFlagidGAG_VOICE ) )
    {
        
set_speakidSPEAK_MUTED );
    }
    
    
// default flags to "abc"
    
g_iMenuFlagsid ] = GAG_CHAT GAG_TEAMSAY GAG_VOICE;
}

public 
client_authorizedid )
    
get_user_authididg_szAuthidid ], 34 );

public 
client_disconnectid )
{
    if( 
TrieKeyExistsg_tArrayPosg_szAuthidid ] ) )
    {
        new 
szName32 ];
        
get_user_nameidszName31 );
        
        new 
iPlayers32 ], iNumiPlayer;
        
get_playersiPlayersiNum"ch" );
        
        for( new 
iiNumi++ )
        {
            
iPlayer iPlayers];
            
            if( 
get_user_flagsiPlayer ) & ADMIN_KICK )
            {
                if( 
g_bColorSupported )
                {
                    
GreenPrintiPlayerid"^4[AMXX GAG]^1 Gagged player ^"^3%s^1<^4%s^1>^" has disconnected!"szNameg_szAuthidid ] );
                }
                else
                {
                    
client_printiPlayerprint_chat"[AMXX GAG] Gagged player ^"%s<%s>^" has disconnected!"szNameg_szAuthidid ] );
                }
            }
        }
    }
    
    
g_szAuthidid ][ ] = '^0';
}

public 
client_infochangedid )
{
    if( !
CheckGagFlagid, ( GAG_CHAT GAG_TEAMSAY ) ) )
    {
        return;
    }
    
    static const 
name[ ] = "name";
    
    static 
szNewName32 ], szOldName32 ];
    
get_user_infoidnameszNewName31 );
    
get_user_nameidszOldName31 );
    
    if( !
equalszNewNameszOldName ) )
    {
        if( 
g_bColorSupported )
        {
            
GreenPrintidid"^4[AMXX GAG]^1 Gagged players cannot change their names!" );
        }
        else
        {
            
client_printidprint_chat"[AMXX GAG] Gagged players cannot change their names!" );
        }
        
        
set_user_infoidnameszOldName );
    }
}

public 
MessageSayText( )
{
    static const 
Cstrike_Name_Change[ ] = "#Cstrike_Name_Change";
    
    new 
szMessagesizeofCstrike_Name_Change ) + ];
    
get_msg_arg_string2szMessagecharsmaxszMessage ) );
    
    if( 
equalszMessageCstrike_Name_Change ) )
    {
        new 
szName32 ], id;
        for( new 
3<= 4i++ )
        {
            
get_msg_arg_stringiszName31 );
            
            
id get_user_indexszName );
            
            if( 
is_user_connectedid ) )
            {
                if( 
CheckGagFlagid, ( GAG_CHAT GAG_TEAMSAY ) ) )
                {
                    return 
PLUGIN_HANDLED;
                }
                
                break;
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
FwdThink( const iEntity )
{
    if( !
g_iGagged )
        return;
    
    new 
iSystime get_systime( );
    new 
bool:bRemovedGags false;
    
    new 
bool:bUsingSQL g_bUsingSQL;
    new Array:
aRemoveSteamIDsiNumRemoveSteamIDs;
    
    if( 
bUsingSQL )
    {
        
aRemoveSteamIDs ArrayCreate35 );
        
g_bUsingSQL false;
    }
    
    new 
dataGagData ], idszName32 ];
    for( new 
0g_iGaggedi++ )
    {
        
ArrayGetArrayg_aGagDataidata );
        
        if( 
dataGAG_TIME ] > && ( dataGAG_START ] + dataGAG_TIME ] ) <= iSystime )
        {
            
id find_player"c"dataGAG_AUTHID ] );
            
            if( 
is_user_connectedid ) )
            {
                
get_user_nameidszName31 );
                
                if( 
g_bColorSupported )
                {
                    
GreenPrint0id"^4[AMXX GAG]^1 Player ^"^3%s^1^" is no longer gagged"szName );
                }
                else
                {
                    
client_print0print_chat"[AMXX GAG] Player ^"%s^" is no longer gagged"szName );
                }
            }
            else
            {
                if( 
g_bColorSupported )
                {
                    
GreenPrint00"^4[AMXX GAG]^1 SteamID ^"^3%s^1^" is no longer gagged"dataGAG_AUTHID ] );
                }
                else
                {
                    
client_print0print_chat"[AMXX GAG] SteamID ^"%s^" is no longer gagged"dataGAG_AUTHID ] );
                }
            }
            
            
DeleteGagi-- );
            
            
bRemovedGags true;
            
            if( 
bUsingSQL )
            {
                
ArrayPushStringaRemoveSteamIDsdataGAG_AUTHID ] );
                
iNumRemoveSteamIDs++;
            }
        }
    }
    
    if( !
bUsingSQL )
    {
        if( 
bRemovedGags )
        {
            
SaveToFile( );
        }
    }
    else
    {
        if( 
iNumRemoveSteamIDs )
        {
            static 
szQuery1024 ];
            new 
iLen copyszQuerycharsmaxszQuery ), "DELETE FROM gagged_players WHERE " );
            
            for( new 
0iNumRemoveSteamIDsi++ )
            {
                
ArrayGetStringaRemoveSteamIDsidataGAG_AUTHID ], charsmaxdataGAG_AUTHID ] ) );
                
                
iLen += formatexszQueryiLen ], charsmaxszQuery ) - iLen"%splayer_steamid = ^"%s^""" OR " ""dataGAG_AUTHID ] );
            }
            
            
szQueryiLen++ ] = ';';
            
szQueryiLen ] = 0;
            
            
SQL_ThreadQueryg_hSqlTuple"QueryDeleteMultiple"szQuery );
        }
        
        
ArrayDestroyaRemoveSteamIDs );
        
        
g_bUsingSQL true;
    }
    
    if( !
g_iGagged )
        return;
    
    new 
iNextTime 999999;
    for( new 
0g_iGaggedi++ )
    {
        
ArrayGetArrayg_aGagDataidata );
        
        if( 
dataGAG_TIME ] > )
            
iNextTime miniNextTimedataGAG_START ] + dataGAG_TIME ] - iSystime );
    }
    
    if( 
iNextTime 999999 )
        
entity_set_floatiEntityEV_FL_nextthinkget_gametime( ) + iNextTime );
}

public 
QueryDeleteMultipleiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:flQueueTime )
{
    switch( 
iFailState )
    {
        case 
TQUERY_CONNECT_FAILEDlog_amx"Failed to connect to database: (%d) %s"iErrorszError );
        case 
TQUERY_QUERY_FAILED:   log_amx"Failed delete multiple query: (%d) %s"iErrorszError );
    }
}

public 
CmdSay( const id )
    return 
CheckSayid);

public 
CmdTeamSay( const id )
    return 
CheckSayid);

CheckSay( const id, const bTeam )
{
    new 
iArrayPos;
    if( 
TrieGetCellg_tArrayPosg_szAuthidid ], iArrayPos ) )
    {
        new 
dataGagData ];
        
ArrayGetArrayg_aGagDataiArrayPosdata );
        
        new const 
iFlags[ ] = { GAG_CHATGAG_TEAMSAY };
        
        if( 
dataGAG_FLAGS ] & iFlagsbTeam ] )
        {
            if( 
dataGAG_TIME ] > )
            {
                new 
szInfo128 ], iTime dataGAG_START ] + dataGAG_TIME ] - get_systime( );
                
                
GetTimeLengthiTimeszInfocharsmaxszInfo ) );
                
                if( 
g_bColorSupported )
                {
                    
GreenPrintidid"^4[AMXX GAG]^3 %s^1 left before your ungag!"szInfo );
                }
                else
                {
                    
client_printidprint_chat"[AMXX GAG] %s left before your ungag!"szInfo );
                }
            }
            else
            {
                if( 
g_bColorSupported )
                {
                    
GreenPrintidid"^4[AMXX GAG]^3 You are gagged permanently!" );
                }
                else
                {
                    
client_printidprint_chat"[AMXX GAG] You are gagged permanently!" );
                }
            }
            
            
client_printidprint_center"** You are gagged from%s chat! **"bTeam " team" "" );
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
CmdGagPlayer( const id, const iLevel, const iCid )
{
    if( !
cmd_accessidiLeveliCid) )
    {
        
console_printid"Flags: a - Chat | b - Team Chat | c - Voice communications" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    new 
iPlayer cmd_targetidszArgCMDTARGET_OBEY_IMMUNITY CMDTARGET_NO_BOTS );
    
    if( !
iPlayer )
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
szName20 ];
    
get_user_nameiPlayerszName19 );
    
    if( 
TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) )
    {
        
console_printid"User ^"%s^" is already gagged!"szName );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iFlags;
    new 
iGagTime;
    
    
read_argv2szArg31 );
    
    if( 
szArg] ) // No time entered
    
{
        if( 
is_str_numszArg ) ) // Seconds entered
        
{
            
iGagTime absstr_to_numszArg ) );
        }
        else
        {
            
console_printid"The value must be in seconds!" );
            return 
PLUGIN_HANDLED;
        }
        
        
read_argv3szArg31 );
        
        if( 
szArg] )
        {
            
iFlags read_flagsszArg );
        }
    }
    
    
GagPlayeridiPlayeriGagTimeiFlags );
    
    return 
PLUGIN_HANDLED;
}

GagPlayeridiPlayeriGagTimeiFlags )
{
    new 
iTimeUnit GetTimeUnit( );
    new 
iMaxTime get_pcvar_numg_pCvarMaxTime );
    
iGagTime clampiGagTime1iMaxTime ) * g_iTimeUnitMultiTimeUnit ];
    
    if( !
iFlags )
    {
        new 
szFlags27 ];
        
get_pcvar_stringg_pCvarDefaultFlagsszFlagscharsmaxszFlags ) );
        
        
iFlags read_flagsszFlags );
    }
    
    new 
dataGagData ];
    
dataGAG_START ] = get_systime( );
    
dataGAG_TIME ]  = iGagTime;
    
dataGAG_FLAGS ] = iFlags;
    
copydataGAG_AUTHID ], 34g_szAuthidiPlayer ] );
    
    
TrieSetCellg_tArrayPosg_szAuthidiPlayer ], g_iGagged );
    
ArrayPushArrayg_aGagDatadata );
    
    new 
szFrom64 ];
    
    if( 
iFlags GAG_CHAT )
    {
        
copyszFrom63"say" );
    }
    
    if( 
iFlags GAG_TEAMSAY )
    {
        if( !
szFrom] )
            
copyszFrom63"say_team" );
        else
            
addszFrom63" / say_team" );
    }
    
    if( 
iFlags GAG_VOICE )
    {
        
set_speakiPlayerSPEAK_MUTED );
        
        if( !
szFrom] )
            
copyszFrom63"voicecomm" );
        else
            
addszFrom63" / voicecomm" );
    }
    
    
g_iGagged++;
    
    if( 
iGagTime )
    {
        new 
Float:flGametime get_gametime( ), Float:flNextThink;
        
flNextThink entity_get_floatg_iThinkerEV_FL_nextthink );
        
        if( !
flNextThink || flNextThink > ( flGametime iGagTime ) )
            
entity_set_floatg_iThinkerEV_FL_nextthinkflGametime iGagTime );
    }
    
    if( 
g_bUsingSQL )
    {
        
AddGagidiPlayeriGagTimeiFlags );
    }
    else
    {
        
SaveToFile( );
    }
    
    new 
szName20 ];
    
get_user_nameiPlayerszName19 );
    
    new 
szInfo32 ], szAdmin20 ];
    
get_user_nameidszAdmin19 );
    
    if( 
iGagTime )
    {
        new 
iLen copyszInfo31"for " );
        
GetTimeLengthiGagTimeszInfoiLen ], charsmaxszInfo ) - iLen );
    }
    else
    {
        
copyszInfo31"permanently" );
    }
    
    
show_activityidszAdmin"Has gagged %s from speaking %s! (%s)"szNameszInfoszFrom );
    
    
console_printid"You have gagged ^"%s^" (%s) !"szNameszFrom );
    
    
log_amx"Gag: ^"%s<%s>^" has gagged ^"%s<%s>^" %s. (%s)"szAdming_szAuthidid ], szNameg_szAuthidiPlayer ], szInfoszFrom );
}

public 
CmdAddGag( const id, const iLevel, const iCid )
{
    if( !
cmd_accessidiLeveliCid) )
    {
        
console_printid"Flags: a - Chat | b - Team Chat | c - Voice communications" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    if( !
IsValidSteamIDszArg ) )
    {
        
console_printid"Invalid SteamID provided (%s). Must be in ^"STEAM_0:X:XXXXX^" format (remember to use quotes!)"szArg );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer find_player"c"szArg );
    
    if( 
is_user_connectediPlayer ) )
    {
        new 
szTime12 ], szFlags];
        
read_argv2szTime,  charsmaxszTime  ) );
        
read_argv3szFlagscharsmaxszFlags ) );
        
        
client_cmdid"amx_gag #%d ^"%s^" ^"%s^""get_user_useridiPlayer ), szTimeszFlags );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
TrieKeyExistsg_tArrayPosszArg ) )
    {
        
console_printid"This user is already gagged!" );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
GetAccessBySteamIDszArg ) & ADMIN_IMMUNITY )
    {
        
console_printid"This user has immunity!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
dataGagData ];
    
copydataGAG_AUTHID ], 34szArg );
    
    
get_pcvar_stringg_pCvarDefaultFlagsszArgcharsmaxszArg ) );
    new 
iFlags read_flagsszArg );
    
    new 
iTimeUnit GetTimeUnit( );
    new 
iMaxTime get_pcvar_numg_pCvarMaxTime );
    new 
iGagTime clampget_pcvar_numg_pCvarDefaultTime ), 1iMaxTime );
    
    
read_argv2szArg31 );
    
    if( 
szArg] ) // No time entered
    
{
        if( 
is_str_numszArg ) ) // Seconds entered
        
{
            
iGagTime minabsstr_to_numszArg ) ), iMaxTime );
        }
        else
        {
            
console_printid"The value must be in seconds!" );
            return 
PLUGIN_HANDLED;
        }
        
        
read_argv3szArg31 );
        
        if( 
szArg] )
        {
            
iFlags read_flagsszArg );
        }
    }
    
    
// convert to seconds
    
iGagTime *= g_iTimeUnitMultiTimeUnit ];
    
    
dataGAG_START ] = get_systime( );
    
dataGAG_TIME ]  = iGagTime;
    
dataGAG_FLAGS ] = iFlags;
    
    
TrieSetCellg_tArrayPosdataGAG_AUTHID ], g_iGagged );
    
ArrayPushArrayg_aGagDatadata );
    
    new 
szFrom64 ];
    
    if( 
iFlags GAG_CHAT )
    {
        
copyszFrom63"say" );
    }
    
    if( 
iFlags GAG_TEAMSAY )
    {
        if( !
szFrom] )
            
copyszFrom63"say_team" );
        else
            
addszFrom63" / say_team" );
    }
    
    if( 
iFlags GAG_VOICE )
    {
        if( !
szFrom] )
            
copyszFrom63"voicecomm" );
        else
            
addszFrom63" / voicecomm" );
    }
    
    
g_iGagged++;
    
    if( 
iGagTime )
    {
        new 
Float:flGametime get_gametime( ), Float:flNextThink;
        
flNextThink entity_get_floatg_iThinkerEV_FL_nextthink );
        
        if( !
flNextThink || flNextThink > ( flGametime iGagTime ) )
            
entity_set_floatg_iThinkerEV_FL_nextthinkflGametime iGagTime );
    }
    
    if( 
g_bUsingSQL )
    {
        
AddGagidiPlayeriGagTimeiFlags );
    }
    else
    {
        
SaveToFile( );
    }
    
    new 
szInfo32 ], szAdmin20 ];
    
get_user_nameidszAdmin19 );
    
    if( 
iGagTime )
    {
        new 
iLen copyszInfo31"for " );
        
GetTimeLengthiGagTimeszInfoiLen ], charsmaxszInfo ) - iLen );
    }
    else
    {
        
copyszInfo31"permanently" );
    }
    
    
show_activityidszAdmin"Has gagged a non-connected player <%s> from speaking %s! (%s)"dataGAG_AUTHID ], szInfoszFrom );
    
    
console_printid"You have gagged ^"%s^" (%s) !"dataGAG_AUTHID ], szFrom );
    
    
log_amx"Gag: ^"%s<%s>^" has gagged a non-connected player ^"<%s>^" %s. (%s)"szAdming_szAuthidid ], dataGAG_AUTHID ], szInfoszFrom );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdUnGagPlayer( const id, const iLevel, const iCid )
{
    if( !
cmd_accessidiLeveliCid) )
        return 
PLUGIN_HANDLED;
    
    new 
szArg32 ];
    
read_argv1szArg31 );
    
    if( 
szArg] == '@' && equaliszArg], "all" ) )
    {
        if( !
g_iGagged )
        {
            
console_printid"No gagged players!" );
            return 
PLUGIN_HANDLED;
        }
        
        
DeleteAllGags( );
        
        if( 
entity_get_floatg_iThinkerEV_FL_nextthink ) > 0.0 )
            
entity_set_floatg_iThinkerEV_FL_nextthink0.0 );
        
        
console_printid"You have ungagged all players!" );
        
        new 
szAdmin32 ];
        
get_user_nameidszAdmin31 );
        
        
show_activityidszAdmin"Has ungagged all players." );
        
        
log_amx"UnGag: ^"%s<%s>^" has ungagged all players."szAdming_szAuthidid ] );
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer cmd_targetidszArgCMDTARGET_NO_BOTS );
    new 
iArrayPosszName32 ];
    
    if( !
iPlayer )
    {
        
// Maybe it's a steamid
        
        
if( !IsValidSteamIDszArg ) )
        {
            return 
PLUGIN_HANDLED;
        }
        
        if( !
TrieGetCellg_tArrayPosszArgiArrayPos ) )
        {
            
console_printid"This steamid is not gagged!" );
            return 
PLUGIN_HANDLED;
        }
        
        
copyszNamecharsmaxszName ), szArg );
    }
    else
    {
        
get_user_nameiPlayerszNamecharsmaxszName ) );
        
        if( !
TrieGetCellg_tArrayPosg_szAuthidiPlayer ], iArrayPos ) )
        {
            
console_printid"User ^"%s^" is not gagged!"szName );
            return 
PLUGIN_HANDLED;
        }
    }
    
    
DeleteGagiArrayPos );
    
    if( !
g_bUsingSQL )
    {
        
SaveToFile( );
    }
    
    new 
szAdmin32 ];
    
get_user_nameidszAdmin31 );
    
    
show_activityidszAdmin"Has ungagged %s."szName );
    
    
console_printid"You have ungagged ^"%s^" !"szName );
    
    
log_amx"UnGag: ^"%s<%s>^" has ungagged ^"%s<%s>^""szAdming_szAuthidid ], szNameg_szAuthidiPlayer ] );
    
    return 
PLUGIN_HANDLED;
}

public 
CmdGagMenu( const id, const iLevel, const iCid )
{
    if( !
cmd_accessidiLeveliCid) )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
g_iMenuOptionid ] = 0;
    
arraysetg_iMenuPlayersid ], 032 );
    
    
DisplayGagMenuidg_iMenuPositionid ] = );
    
    return 
PLUGIN_HANDLED;
}

#define PERPAGE 6

public ActionGagMenu( const id, const iKey )
{
    switch( 
iKey )
    {
        case 
6DisplayGagFlagsid );
        case 
7:
        {
            ++
g_iMenuOptionid ];
            
g_iMenuOptionid ] %= g_iTotalGagTimes;
            
            
DisplayGagMenuidg_iMenuPositionid ] );
        }
        case 
8DisplayGagMenuid, ++g_iMenuPositionid ] );
        case 
9DisplayGagMenuid, --g_iMenuPositionid ] );
        default:
        {
            new 
iPlayer g_iMenuPlayersid ][ g_iMenuPositionid ] * PERPAGE iKey ];
            
            if( 
is_user_connectediPlayer ) )
            {
                if( !
g_iMenuOptionid ] )
                {
                    
//client_cmd( id, "amx_ungag #%i", get_user_userid( iPlayer ) );
                    
                    
new iArrayPos;
                    
                    if( 
TrieGetCellg_tArrayPosg_szAuthidiPlayer ], iArrayPos ) )
                    {
                        
DeleteGagiArrayPos );
                        
                        if( !
g_bUsingSQL )
                        {
                            
SaveToFile( );
                        }
                        
                        new 
szName32 ];
                        
get_user_nameiPlayerszName31 );
                        
                        new 
szAdmin32 ];
                        
get_user_nameidszAdmin31 );
                        
                        
show_activityidszAdmin"Has ungagged %s."szName );
                        
                        
console_printid"You have ungagged ^"%s^" !"szName );
                        
                        
log_amx"UnGag: ^"%s<%s>^" has ungagged ^"%s<%s>^""szAdming_szAuthidid ], szNameg_szAuthidiPlayer ] );
                    }
                }
                else if( !
TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) )
                {
                    
/*new szFlags[ 4 ];
                    get_flags( g_iMenuFlags[ id ], szFlags, 3 );
                    
                    client_cmd( id, "amx_gag #%i %i %s", get_user_userid( iPlayer ), ArrayGetCell( g_aGagTimes, g_iMenuOption[ id ] ), szFlags );*/
                    
                    
GagPlayeridiPlayerArrayGetCellg_aGagTimesg_iMenuOptionid ] ), g_iMenuFlagsid ] );
                }
            }
            
            
DisplayGagMenuidg_iMenuPositionid ] );
        }
    }
}

// I just copied this from AMXX Ban menu, so don't blame me :D
DisplayGagMenu( const idiPosition )
{
    if( 
iPosition )
    {
        
arraysetg_iMenuPlayersid ], 032 );
        return;
    }
    
    new 
iPlayers32 ], iNumiCountszMenu512 ], iPlayeriFlagsszName32 ];
    
get_playersiPlayersiNum"ch" ); // Ignore bots and hltv
    
    
new iStart iPosition PERPAGE;
    
    if( 
iStart >= iNum )
        
iStart iPosition g_iMenuPositionid ] = 0;
    
    new 
iEnd iStart PERPAGEiKeys MENU_KEY_0 MENU_KEY_8;
    new 
iLen formatexszMenu511g_bColorSupported "\rGag Menu\R%i/%i^n^n" "Gag Menu %i/%i^n^n"iPosition 1, ( ( iNum PERPAGE ) / PERPAGE ) );
    
    new 
bool:bUngag bool:!g_iMenuOptionid ];
    
    if( 
iEnd iNum iEnd iNum;
    
    for( new 
iStartiEnd; ++)
    {
        
iPlayer iPlayers];
        
iFlags  get_user_flagsiPlayer );
        
get_user_nameiPlayerszName31 );
        
        if( 
iPlayer == id || ( iFlags ADMIN_IMMUNITY ) || bUngag != TrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) )
        {
            ++
iCount;
            
            if( 
g_bColorSupported )
                
iLen += formatexszMenuiLen ], 511 iLen"\d%i. %s^n"iCountszName );
            else
                
iLen += formatexszMenuiLen ], 511 iLen"#. %s^n"szName );
        }
        else
        {
            
iKeys |= ( << iCount );
            ++
iCount;
            
            
iLen += formatexszMenuiLen ], 511 iLeng_bColorSupported "\r%i.\w %s\y%s\r%s^n" "%i. %s%s%s^n"iCountszNameTrieKeyExistsg_tArrayPosg_szAuthidiPlayer ] ) ? " GAGGED" "", ( ~iFlags ADMIN_USER " *" "" ) );
        }
    }
    
    
g_iMenuPlayersid ] = iPlayers;
    
    new 
szFlags];
    
get_flagsg_iMenuFlagsid ], szFlags);
    
    
iLen += formatexszMenuiLen ], 511 iLeng_bColorSupported ? ( bUngag "^n\d7. Flags: %s" "^n\r7.\y Flags:\w %s" ) : ( bUngag "^n#. Flags: %s" "^n7. Flags: %s" ), szFlags );
    
    if( !
bUngag )
    {
        
iKeys |= MENU_KEY_7;
        
        new 
iGagTime ArrayGetCellg_aGagTimesg_iMenuOptionid ] );
        
        if( 
iGagTime )
        {
            new 
szTime128 ];
            
GetTimeLengthiGagTime g_iTimeUnitMultGetTimeUnit( ) ], szTimecharsmaxszTime ) );
            
            
iLen += formatexszMenuiLen ], 511 iLeng_bColorSupported "^n\r8.\y Time:\w %s^n" "^n8. Time: %s^n"szTime );
        }
        else
            
iLen += copyszMenuiLen ], 511 iLeng_bColorSupported "^n\r8.\y Time: Permanent^n" "^n8. Time: Permanent^n" );
    }
    else
        
iLen += copyszMenuiLen ], 511 iLeng_bColorSupported "^n\r8.\w Ungag^n" "^n8. Ungag^n" );
    
    if( 
iEnd != iNum )
    {
        
formatexszMenuiLen ], 511 iLeng_bColorSupported "^n\r9.\w More...^n\r0.\w %s" "^n9. More...^n0. %s"iPosition "Back" "Exit" );
        
iKeys |= MENU_KEY_9;
    }
    else
        
formatexszMenuiLen ], 511 iLeng_bColorSupported "^n\r0.\w %s" "^n0. %s"iPosition "Back" "Exit" );
    
    
show_menuidiKeysszMenu, -1"Gag Menu" );
}

public 
ActionGagFlags( const id, const iKey )
{
    switch( 
iKey )
    {
        case 
9DisplayGagMenuidg_iMenuPositionid ] );
        default:
        {
            
g_iMenuFlagsid ] ^= ( << iKey );
            
            
DisplayGagFlagsid );
        }
    }
}

DisplayGagFlags( const id )
{
    new 
szMenu512 ];
    new 
iLen copyszMenu511g_bColorSupported "\rGag Flags^n^n" "Gag Flags^n^n" );
    
    if( 
g_bColorSupported )
    {
        
iLen += formatexszMenuiLen ], 511 iLen"\r1.\w Chat: %s^n", ( g_iMenuFlagsid ] & GAG_CHAT ) ? "\yYES" "\rNO" );
        
iLen += formatexszMenuiLen ], 511 iLen"\r2.\w TeamSay: %s^n", ( g_iMenuFlagsid ] & GAG_TEAMSAY ) ? "\yYES" "\rNO" );
        
iLen += formatexszMenuiLen ], 511 iLen"\r3.\w Voice: %s^n", ( g_iMenuFlagsid ] & GAG_VOICE ) ? "\yYES" "\rNO" );
    }
    else
    {
        
iLen += formatexszMenuiLen ], 511 iLen"1. Chat: %s^n", ( g_iMenuFlagsid ] & GAG_CHAT ) ? "YES" "NO" );
        
iLen += formatexszMenuiLen ], 511 iLen"2. TeamSay: %s^n", ( g_iMenuFlagsid ] & GAG_TEAMSAY ) ? "YES" "NO" );
        
iLen += formatexszMenuiLen ], 511 iLen"3. Voice: %s^n", ( g_iMenuFlagsid ] & GAG_VOICE ) ? "YES" "NO" );
    }
    
    
copyszMenuiLen ], 511 iLeng_bColorSupported "^n\r0. \wBack to Gag Menu" "^n0. Back to Gag Menu" );
    
    
show_menuid, ( MENU_KEY_1 MENU_KEY_2 MENU_KEY_3 MENU_KEY_0 ), szMenu, -1"Gag Flags" );
}

CheckGagFlag( const id, const iFlag )
{
    new 
iArrayPos;
    
    if( 
TrieGetCellg_tArrayPosg_szAuthidid ], iArrayPos ) )
    {
        new 
dataGagData ];
        
ArrayGetArrayg_aGagDataiArrayPosdata );
        
        return ( 
dataGAG_FLAGS ] & iFlag );
    }
    
    return 
0;
}

DeleteAllGags( )
{
    new 
dataGagData ];
    new 
iPlayer;
    
    for( new 
0g_iGaggedi++ )
    {
        
ArrayGetArrayg_aGagDataidata );
        
        
iPlayer find_player"c"dataGAG_AUTHID ] );
        if( 
is_user_connectediPlayer ) )
            
set_speakiPlayerSPEAK_NORMAL );
    }
    
    
ArrayClearg_aGagData );
    
TrieClearg_tArrayPos );
    
g_iGagged 0;
    
    if( 
g_bUsingSQL )
    {
        
SQL_ThreadQueryg_hSqlTuple"QueryDeleteAll""DELETE FROM gagged_players;" );
    }
}

public 
QueryDeleteAlliFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:flQueueTime )
{
    switch( 
iFailState )
    {
        case 
TQUERY_CONNECT_FAILEDlog_amx"Failed to connect to database: (%d) %s"iErrorszError );
        case 
TQUERY_QUERY_FAILED:   log_amx"Failed delete all query: (%d) %s"iErrorszError );
    }
}

DeleteGag( const iArrayPos )
{
    new 
dataGagData ];
    
ArrayGetArrayg_aGagDataiArrayPosdata );
    
    if( 
dataGAG_FLAGS ] & GAG_VOICE )
    {
        new 
iPlayer find_player"c"dataGAG_AUTHID ] );
        if( 
is_user_connectediPlayer ) )
            
set_speakiPlayerSPEAK_NORMAL );
    }
    
    
TrieDeleteKeyg_tArrayPosdataGAG_AUTHID ] );
    
ArrayDeleteItemg_aGagDataiArrayPos );
    
g_iGagged--;
    
    for( new 
iArrayPosg_iGaggedi++ )
    {
        
ArrayGetArrayg_aGagDataidata );
        
TrieSetCellg_tArrayPosdataGAG_AUTHID ], );
    }
    
    if( 
g_bUsingSQL )
    {
        new 
szQuery128 ];
        
formatexszQuerycharsmaxszQuery ), "DELETE FROM gagged_players WHERE player_steamid = '%s';"dataGAG_AUTHID ] );
        
        
SQL_ThreadQueryg_hSqlTuple"QueryDelete"szQuery );
    }
}

public 
QueryDeleteiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:flQueueTime )
{
    switch( 
iFailState )
    {
        case 
TQUERY_CONNECT_FAILEDlog_amx"Failed to connect to database: (%d) %s"iErrorszError );
        case 
TQUERY_QUERY_FAILED:   log_amx"Failed delete query: (%d) %s"iErrorszError );
    }
}

LoadFromFile( )
{
    new 
hFile fopeng_szGagFile"rt" );
    
    if( 
hFile )
    {
        new 
szData128 ], szTime16 ], szStart16 ], szFlags];
        new 
dataGagData ], iSystime get_systime( ), iTimeLeftiShortestTime 999999;
        new 
bool:bRemovedGags false;
        
        while( !
feofhFile ) )
        {
            
fgetshFileszDatacharsmaxszData ) );
            
trimszData );
            
            if( !
szData] ) continue;
            
            
parseszData,
                
dataGAG_AUTHID ], charsmaxdataGAG_AUTHID ] ),
                
szTimecharsmaxszTime ),
                
szStartcharsmaxszStart ),
                
szFlagscharsmaxszFlags )
            );
            
            
// remove old gags
            
if( containszStart"." ) > ) continue;
            
            
dataGAG_TIME ] = str_to_numszTime );
            
dataGAG_START ] = str_to_numszStart );
            
dataGAG_FLAGS ] = read_flagsszFlags );
            
            if( 
dataGAG_TIME ] > )
            {
                
iTimeLeft dataGAG_START ] + dataGAG_TIME ] - iSystime;
                
                if( 
iTimeLeft <= )
                {
                    
bRemovedGags true;
                    continue;
                }
                
                if( 
iShortestTime iTimeLeft )
                {
                    
iShortestTime iTimeLeft;
                }
            }
            
            
TrieSetCellg_tArrayPosdataGAG_AUTHID ], g_iGagged );
            
ArrayPushArrayg_aGagDatadata );
            
g_iGagged++;
        }
        
        
fclosehFile );
        
        if( 
bRemovedGags )
        {
            
SaveToFile( );
        }
        
        if( 
iShortestTime 999999 )
        {
            
entity_set_floatg_iThinkerEV_FL_nextthinkget_gametime( ) + iShortestTime );
        }
    }
}

SaveToFile( )
{
    new 
hFile fopeng_szGagFile"wt" );
    
    if( 
hFile )
    {
        new 
dataGagData ], szFlags];
        
        for( new 
0g_iGaggedi++ )
        {
            
ArrayGetArrayg_aGagDataidata );
            
            
get_flagsdataGAG_FLAGS ], szFlagscharsmaxszFlags ) );
            
            
fprintfhFile"^"%s^" ^"%i^" ^"%i^" ^"%s^"^n"dataGAG_AUTHID ], dataGAG_TIME ], dataGAG_START ], szFlags );
        }
        
        
fclosehFile );
    }
}

GetTimeUnit( )
{
    new 
szTimeUnit64 ], iTimeUnit;
    
get_pcvar_stringg_pCvarTimeUnitszTimeUnitcharsmaxszTimeUnit ) );
    
    if( 
is_str_numszTimeUnit ) )
    {
        
iTimeUnit get_pcvar_numg_pCvarTimeUnit );
        
        if( !( 
<= iTimeUnit TimeUnit ) )
        {
            
iTimeUnit = -1;
        }
    }
    else
    {
        
strtolowerszTimeUnit );
        
        if( !
TrieGetCellg_tTimeUnitWordsszTimeUnitiTimeUnit ) )
        {
            
iTimeUnit = -1;
        }
    }
    
    if( 
iTimeUnit == -)
    {
        
iTimeUnit TIMEUNIT_SECONDS;
        
        
set_pcvar_numg_pCvarTimeUnitTIMEUNIT_SECONDS );
    }
    
    return 
iTimeUnit;
}

GetTimeLengthiTimeszOutput[ ], iOutputLen )
{
    new 
szTimesTimeUnit ][ 32 ];
    new 
iUnitiValueiTotalDisplay;
    
    for( new 
TimeUnit 1>= 0i-- )
    {
        
iUnit g_iTimeUnitMult];
        
iValue iTime iUnit;
        
        if( 
iValue )
        {
            
formatexszTimes], charsmaxszTimes[ ] ), "%d %s"iValueg_szTimeUnitName][ iValue != ] );
            
            
iTime %= iUnit;
            
            
iTotalDisplay++;
        }
    }
    
    new 
iLeniTotalLeft iTotalDisplay;
    
szOutput] = 0;
    
    for( new 
TimeUnit 1>= 0i-- )
    {
        if( 
szTimes][ ] )
        {
            
iLen += formatexszOutputiLen ], iOutputLen iLen"%s%s%s",
                ( 
iTotalDisplay && iLen ) ? ", " "",
                ( 
iTotalDisplay && iTotalLeft == ) ? ( ( iTotalDisplay ) ? "and " " and " ) : "",
                
szTimes]
            );
            
            
iTotalLeft--;
        }
    }
    
    return 
iLen
}

GreenPrintidiSender, const szRawMessage[ ], any:... )
{
    if( !
iSender )
    {
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum"ch" );
        
        if( !
iNum ) return;
        
        
iSender iPlayers];
    }
    
    new 
szMessage192 ];
    
vformatszMessagecharsmaxszMessage ), szRawMessage);
    
    
message_beginid MSG_ONE_UNRELIABLE MSG_BROADCASTg_iMsgSayText_id );
    
write_byteiSender );
    
write_stringszMessage );
    
message_end( );
}

bool:IsValidSteamID( const szSteamID[ ] )
{
    
// STEAM_0:(0|1):\d+
    // 012345678    90
    
    // 0-7 = STEAM_0:
    // 8 = 0 or 1
    // 9 = :
    // 10+ = integer
    
    
return ( ( '0' <= szSteamID] <= '1' ) && szSteamID] == ':' && equalszSteamID"STEAM_0:") && is_str_numszSteamID10 ] ) );
}

GetAccessBySteamID( const szSteamID[ ] )
{
    new 
szAuthData44 ], iCount admins_num( );
    
    for( new 
iiCounti++ )
    {
        if( 
admins_lookupiAdminProp_Flags ) & FLAG_AUTHID )
        {
            
admins_lookupiAdminProp_AuthszAuthDatacharsmaxszAuthData ) );
            
            if( 
equalszAuthDataszSteamID ) )
            {
                return 
admins_lookupiAdminProp_Access );
            }
        }
    }
    
    return 
0;
}

strtotime(const string[])
{
    new 
szTemp32 ];
    new 
szYear], szMonth], szDay], szHour], szMinute], szSecond];
    
strtokstringszYear,   charsmaxszYear   ), szTemp,   charsmaxszTemp   ), '-' );
    
strtokszTempszMonth,  charsmaxszMonth  ), szTemp,   charsmaxszTemp   ), '-' );
    
strtokszTempszDay,    charsmaxszDay    ), szTemp,   charsmaxszTemp   ), ' ' );
    
strtokszTempszHour,   charsmaxszHour   ), szTemp,   charsmaxszTemp   ), ':' );
    
strtokszTempszMinutecharsmaxszMinute ), szSecondcharsmaxszSecond ), ':' );
    
    return 
TimeToUnixstr_to_numszYear ), str_to_numszMonth ), str_to_numszDay ), str_to_numszHour ), str_to_numszMinute ), str_to_numszSecond ) );
}

AddGagadminplayeriGagTimeiFlags )
{
    new 
szAdminName32 ], szAdminIP16 ];
    
    if( 
admin )
    {
        
get_user_nameadminszAdminNamecharsmaxszAdminName ) );
    }
    else
    {
        
copyszAdminNamecharsmaxszAdminName ), "SERVER" );
    }
    
    
get_user_ipadminszAdminIPcharsmaxszAdminIP ), );
    
    new 
szPlayerName32 ], szPlayerIP16 ];
    
get_user_nameplayerszPlayerNamecharsmaxszPlayerName ) );
    
get_user_ipplayerszPlayerIPcharsmaxszPlayerIP ), );
    
    new 
szDateNowDATE_SIZE ], szDateUngagDATE_SIZE ];
    
get_timeDATETIME_FORMATszDateNowcharsmaxszDateNow ) );
    
format_timeszDateUngagcharsmaxszDateUngag ), DATETIME_FORMATget_systime( ) + iGagTime );
    
    new 
szFlags];
    
get_flagsiFlagsszFlagscharsmaxszFlags ) );
    
    new 
szQuery256 ];
    
formatexszQuerycharsmaxszQuery ), "REPLACE INTO gagged_players \
        (admin_name, admin_steamid, admin_ip, player_name, player_steamid, player_ip, date_gagged, date_ungag, gag_seconds, gag_flags) \
        VALUES \
        (^"
%s^", ^"%s^", ^"%s^", ^"%s^", ^"%s^", ^"%s^", ^"%s^", ^"%s^", %d, ^"%s^");",\
        
szAdminName,  g_szAuthidadmin  ], szAdminIP,\
        
szPlayerNameg_szAuthidplayer ], szPlayerIP,\
        
szDateNowszDateUngagiGagTimeszFlags );
    
    
SQL_ThreadQueryg_hSqlTuple"QueryAdd"szQuery );
}

public 
QueryAddiFailStateHandle:hQueryszError[ ], iErroriData[ ], iDataSizeFloat:flQueueTime )
{
    switch( 
iFailState )
    {
        case 
TQUERY_CONNECT_FAILEDlog_amx"Failed to connect to database: (%d) %s"iErrorszError );
        case 
TQUERY_QUERY_FAILED:   log_amx"Failed add gag query: (%d) %s"iErrorszError );
    }
}

// CODE BELOW FROM BUGSY'S UNIX TIME INCLUDE
// 

stock const YearSeconds[2] = 

    
31536000,    //Normal year
    
31622400     //Leap year
};

stock const MonthSeconds[12] = 

    
2678400//January    31 
    
2419200//February    28
    
2678400//March    31
    
2592000//April    30
    
2678400//May        31
    
2592000//June        30
    
2678400//July        31
    
2678400//August    31
    
2592000//September    30
    
2678400//October    31
    
2592000//November    30
    
2678400  //December    31
};

stock const DaySeconds 86400;
stock const HourSeconds 3600;
stock const MinuteSeconds 60;

stock TimeToUnix( const iYear , const iMonth , const iDay , const iHour , const iMinute , const iSecond )
{
    new 
i;
    new 
iTimeStamp;

    for ( 
1970 iYear i++ )
        
iTimeStamp += YearSecondsIsLeapYear(i) ];

    for ( 
iMonth i++ )
        
iTimeStamp += SecondsInMonthiYear );

    
iTimeStamp += ( ( iDay ) * DaySeconds );
    
iTimeStamp += ( iHour HourSeconds );
    
iTimeStamp += ( iMinute MinuteSeconds );
    
iTimeStamp += iSecond;

    return 
iTimeStamp;
}

stock SecondsInMonth( const iYear , const iMonth 
{
    return ( ( 
IsLeapYeariYear ) && ( iMonth == ) ) ? ( MonthSeconds[iMonth 1] + DaySeconds ) : MonthSeconds[iMonth 1] );
}

stock IsLeapYear( const iYear 
{
    return ( ( (
iYear 4) == 0) && ( ( (iYear 100) != 0) || ( (iYear 400) == ) ) );

But gag menu is bug . its open for all players . what do i do i say /g not open for players ??
Mikaeel123 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-23-2019 , 12:24   Re: problem with gag
Reply With Quote #2

What?
__________________








CrazY. is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-23-2019 , 13:50   Re: problem with gag
Reply With Quote #3

i say /g for open gag menu . but this menu open for me and all players i want only open for me
Mikaeel123 is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 03-23-2019 , 13:57   Re: problem with gag
Reply With Quote #4

Your problem is here:
PHP Code:
public gag(idlevelcid)  
{  
    if(
cmd_access(id,levelcid1))  
    {  
        new 
name[32]  
        
get_user_info(id"name"name31)  
        
server_cmd("amx_gagmenu");              // HERE
        
ColorChat(0BLUE,"%s: /g",name)  
    }  
    return 
PLUGIN_HANDLED  

When the server executes a command it has index 0.
So, at some point in the code you have:
PHP Code:
show_menuidiKeysszMenu, -1"Gag Menu" ); 
but id is 0, and this means that the menu will be shown to all players.

You can try to change:
PHP Code:
server_cmd("amx_gagmenu"); 
with
PHP Code:
client_cmdid"amx_gagmenu"); 
or
PHP Code:
amxclient_cmdid"amx_gagmenu"); // if you use 1.8.3+ 
__________________
My English is A0
E1_531G is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 03-23-2019 , 14:19   Re: problem with gag
Reply With Quote #5

Ty so much !!!! its fixed .
i dont know this
Mikaeel123 is offline
Reply



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 11:44.


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