Thread: Simple WarmUp
View Single Post
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 04-17-2024 , 07:19   Re: Simple WarmUp
Reply With Quote #10

Quote:
Originally Posted by Ace67 View Post
Code:
/* Plugin generated by AMXX-Studio */

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

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

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

new hudtimer, cvar, hudhandler, mp_freezetime, value

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    
    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(id, PLAYER_HEALTH);
        set_user_maxspeed(id, MAX_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(2, message, charsmax(message));
    
    if(equal(message, "#Game_Commencing"))
    {
        hudtimer = get_pcvar_num(cvar);
        
        if(hudtimer == -1)
            return;
        
        formatex(message, charsmax(message), "%L", LANG_PLAYER, "WARUMP_START");    
        set_msg_arg_string(2, message);
        
        set_task(1.0, "restart", TASKID, _, _, "b");        
        set_pcvar_num(mp_freezetime, 0);        
    }
    if(equal(message, "#Game_will_restart_in"))
    {
        formatex(message, charsmax(message), "%L", LANG_PLAYER, "WARUMP_END");    
        set_msg_arg_string(2, message);
    }
}

public restart()
{            
    if(hudtimer <= 0)
    {
        remove_task(TASKID);
        set_cvar_num("sv_restartround", 1);
        set_pcvar_num(mp_freezetime, value);        
    } 
    else 
    {
        hudtimer--;
        set_hudmessage(255,255,255,-1.0,0.9,0,6.0,1.0,0.1,0.2);    
        ShowSyncHudMsg(0, hudhandler, "%L", LANG_PLAYER, "COUNTING", hudtimer);
    }    
}

public switchweapon(id)
{
    if(task_exists(TASKID)) 
    {
        engclient_cmd(id, "weapon_knife");
    }
}
its working now, players has 35hp on warmup, the only problem is that the speed is still the same, i tried to change the MAX_SPEED value too but it has no difference in the game
tarsisd2 is offline