Raised This Month: $ Target: $400
 0% 

Solved don't change before x rounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-29-2017 , 16:15   Re: don't change before x rounds
Reply With Quote #4

same thing, it's not works.
should i add this code to admincmd.amxx in cmdMap(id) or not ?
EDIT:
now it's works in admincmd.sma
if someone is interesting
PHP Code:
const AdminFlags = ( ADMIN_IMMUNITY );
#define IsAdmin(%1)    ((get_user_flags(%1)&AdminFlags)==AdminFlags)

new CurrentRound
new g_szAllowedRoundsp_AllowedRounds 
in plugin_init

PHP Code:
g_szAllowedRounds register_cvar("change_map_rounds""20")
        
p_AllowedRounds get_pcvar_num(g_szAllowedRounds)
    
        
register_logevent("Hook_NewR"2"1=Round_Start" );
        
register_event("TextMsg""Hook_Restart""a""2&#Game_C""2&#Game_w""2&#Game_will_restart_in" ); 
PHP Code:
public Hook_NewR()
{
    
CurrentRound++
}

public 
Hook_Restart()
{
    
CurrentRound=0;

if ( !IsAdmin ( id ) )
here to check if user don't has ADMIN_IMMUNITY then block change map until reach 20 rounds.
PHP Code:
public cmdMap(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
        
if ( !IsAdmin id ) )
    {
        if(
CurrentRound p_AllowedRounds)
        {
            
client_print(idprint_chat "[NaBlu$-GamING] You are not allowed to change map right now.")
            return 
PLUGIN_HANDLED
        
}
    }

    new 
arg[32]
    new 
arglen read_argv(1argcharsmax(arg))
    
    if (!
is_map_valid(arg))
    {
        
console_print(id"[AMXX] %L"id"MAP_NOT_FOUND")
        return 
PLUGIN_HANDLED
    
}

    new 
authid[32], name[MAX_NAME_LENGTH]
    
    
get_user_authid(idauthidcharsmax(authid))
    
get_user_name(idnamecharsmax(name))
    
    
show_activity_key("ADMIN_MAP_1""ADMIN_MAP_2"namearg);
    
    
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^""nameget_user_userid(id), authidarg)
    
    new 
_modName[10]
    
get_modname(_modNamecharsmax(_modName))
    
    if (!
equal(_modName"zp"))
    {
        
message_begin(MSG_ALLSVC_INTERMISSION)
        
message_end()
    }
    
    
set_task(2.0"chMap"0argarglen 1)
    
    return 
PLUGIN_HANDLED

__________________

Last edited by Ayman Khaled; 07-29-2017 at 17:20.
Ayman Khaled is offline
 



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 22:58.


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