Thread: Simple WarmUp
View Single Post
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 04-15-2024 , 08:04   Re: Simple WarmUp
Reply With Quote #8

for some reason the plugin is not working, the plugin is running, i can see the HUD msg but its just a normal round, everyone can use any weapons and its not restarting, i set up 30 seconds round until restart but it doesnt work

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>

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

#define TASKID 1234
#define PLAYER_HEALTH 35
#define MAX_SPEED 300.0

new hudtimercvarhudhandlermp_freezetimevalue

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_message(get_user_msgid("TextMsg") ,"message_TextMsg")    
    
    
register_event("CurWeapon","switchweapon","be","1=1","2!29"
    
    
register_dictionary("simple_warmup.txt")
    
    
cvar register_cvar("warmup_timer""30")
    
    
hudhandler CreateHudSyncObj()
    
    
RegisterHam(Ham_Spawn"player""fw_spawn"1)
}

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

public 
fw_spawn(id) {
    if(
task_exists(TASKID)) {
        
set_user_health(0PLAYER_HEALTH)
        
set_user_maxspeed(0MAX_SPEED)
    }
}

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), "%L"LANG_PLAYER"WARUMP_START")    
        
set_msg_arg_string(2message)
        
        
set_user_health(0PLAYER_HEALTH)
        
set_user_maxspeed(0MAX_SPEED)
        
        
set_task(1.0"restart"TASKID__"b")        
        
set_pcvar_num(mp_freezetime0)        
    }
    if(
equal(message"#Game_will_restart_in"))
    {
        
formatex(messagecharsmax(message), "%L"LANG_PLAYER"WARUMP_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"%L"LANG_PLAYER"COUNTING"hudtimer)
    }    
    
hudtimer--
}

public 
switchweapon(id)
{
    if(
task_exists(TASKID)) 
    {
        
engclient_cmd(id"weapon_knife")
    }

tarsisd2 is offline