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

Solved don't change before x rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-29-2017 , 14:00   don't change before x rounds
Reply With Quote #1

hi guys
i made a small plugin which block change map when rounds didn't reach 14.
but it's not works
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Ayman Khaled"

new CurrentRound
new g_szAllowedRoundsp_AllowedRounds

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("amx_map""cmdMap")
    
register_clcmd("amx_votemap""cmdMap")
    
    
g_szAllowedRounds register_cvar("change_map_rounds""14")
    
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" );
}

public 
Hook_NewR()
{
    
CurrentRound++
}

public 
Hook_Restart()
{
    
CurrentRound=0;
}

public 
cmdMap(id)
{
    if(
CurrentRound p_AllowedRounds)
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE

__________________

Last edited by Ayman Khaled; 07-29-2017 at 23:46. Reason: solved
Ayman Khaled is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-29-2017 , 15:04   Re: don't change before x rounds
Reply With Quote #2

You must put your plugin at the top in plugins.ini so that cmdMap(id) will be called first and return Handled on next plugins.
siriusmd99 is offline
Old 07-29-2017, 15:34
Ayman Khaled
This message has been deleted by Ayman Khaled. Reason: nvm
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 #3

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
Old 07-29-2017, 17:16
Ayman Khaled
This message has been deleted by Ayman Khaled. Reason: double post
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 07-29-2017 , 19:29   Re: don't change before x rounds
Reply With Quote #4

because you need edit yours map chooser plugin... add a task delay by rounds
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-29-2017 , 23:45   Re: don't change before x rounds
Reply With Quote #5

i don't use default map chooser, i'm using map manager.
__________________
Ayman Khaled 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 10:52.


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