AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   execute a command every x rounds! (https://forums.alliedmods.net/showthread.php?t=240687)

joelverghese 05-20-2014 08:25

execute a command every x rounds!
 
Hello AM,
I need to know a way by which i can execute a command every x round i wish.
For example i want to execute amx_slap every x round to the CT team how could i do that !

OnePL 05-20-2014 09:01

Re: execute a command every x rounds!
 
PHP Code:

#include <amxmodx>

new szRoundpCvarmaxpl;

public 
plugin_init() {
    
register_plugin("Slap every X round""1.0""OnePL");

    
pCvar register_cvar("amx_slap_round""2");

    
register_logevent("RoundEnd"2"1=Round_End");
    
register_logevent("RoundStart"2"1=Round_Start");
    
register_logevent("RestartContin"2"1=Game_Commencing");

    
register_event("TextMsg""RestartGame""a""2&#Game_w");

    
maxpl get_maxplayers();
}

public 
RoundEnd() szRound += 1;
public 
RestartGame() szRound 0;
public 
RestartContin() szRound = -1;

public 
RoundStart() {
    if(
szRound%== get_pcvar_num(pCvar)) {
        for(new 
1<= maxpli++) {
            if(!
is_user_alive(i)) continue;

            
server_cmd("amx_slap #%i 5"get_user_userid(i));
            
//5 - power
        
}
    }


cvar amx_slap_round

plugin splits for 7 rounds (such as days of the week)
if amx_slap_round is equates 2 to execute a command on the second day of the week (Tuesday)


All times are GMT -4. The time now is 09:39.

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