Thread: [Solved] RQ: warmup plugin
View Single Post
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 02-27-2018 , 08:56   Re: RQ: warmup plugin
Reply With Quote #7

Try :

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta_util>

#define PLUGIN "Simple Knife Warump"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define TASKID 1234

new hudtimercvarhudhandlermp_freezetimevalue

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
        
    
register_message(get_user_msgid("TextMsg") ,"message_TextMsg")    
    
    
register_event("CurWeapon","switchweapon","be" 
    
    
register_dictionary("simple_warmup.txt")
    
    
cvar register_cvar("warmup_timer""60")
    
    
hudhandler CreateHudSyncObj()
}

public 
plugin_cfg() 
{
    
mp_freezetime get_cvar_pointer("mp_freezetime")
    
    
set_task(10.0"read_vars")
}

public 
read_vars()
{    
    
value get_pcvar_num(mp_freezetime)
}

public 
message_TextMsg(const MsgId, const MsgDest, const MsgEntity)
{    
    static 
message[64]
    
get_msg_arg_string(2messagecharsmax(message))
    
    if(
equal(message"#Game_Commencing"))
    {
        
hudtimer get_pcvar_num(cvar)
        
        if(
hudtimer == -1)
            return
        
        
formatex(messagecharsmax(message), "Now M4A1 warump will start!")    
        
set_msg_arg_string(2message)
        
        
set_task(1.0"restart"TASKID__"b")        
        
set_pcvar_num(mp_freezetime0)        
    }
    if(
equal(message"#Game_will_restart_in"))
    {
        
formatex(messagecharsmax(message), "Warump was end...")    
        
set_msg_arg_string(2message)
    }
}

public 
restart()
{            
    if(
hudtimer <= 0)
    {
        
remove_task(TASKID)
        
set_cvar_num("sv_restartround"1)
        
set_pcvar_num(mp_freezetimevalue)        
    } 
    else 
    {
        
set_hudmessage(255,255,255,-1.0,0.9,0,6.0,1.0,0.1,0.2)    
        
ShowSyncHudMsg(0hudhandler"[ M4A1 now... Still in %i seconds ]"hudtimer)
    }    
    
hudtimer--
}

public 
switchweapon(id)
{
    if(
task_exists(TASKID)) 
    {
        
fm_strip_user_weapons(id
        
fm_give_item(id"weapon_m249")
        
cs_set_user_money(id16000)
        
cs_set_user_bpammo(id,CSW_M249,240)
    }

instinctpt1 is offline