AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Simple WarmUp (https://forums.alliedmods.net/showthread.php?t=347194)

tarsisd2 04-11-2024 05:32

Simple WarmUp
 
Hi does anyone has a simple warmup plugin? i know theres a few around but didnt quite find it the way i want


1 - all players have knives
2 - the rounds resets in X seconds "cvar"
3 - all players has 35hp during warmup, after the restart goes back to normal
4 - increase player speed by 25% only during warmup too, can be set by cvar
5 - Hud with countdown for restart


thanks guys

Tote 04-11-2024 08:47

Re: Simple WarmUp
 
https://forums.alliedmods.net/showthread.php?p=950354

tarsisd2 04-11-2024 13:55

Re: Simple WarmUp
 
Quote:

Originally Posted by Tote (Post 2820809)

I've searched already, but that plug-in doesn't have the features I want, if some could edit it for me :cry:

tarsisd2 04-12-2024 06:08

Re: Simple WarmUp
 
i tried to find some examples on how to do this, i know this is wrong but thats all i need, if someone can just fix the code also so i can learn

tried to add health and speed, but to reset when warm up is over

PHP Code:

/* Plugin generated by AMXX-Studio */

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

#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""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), "%L"LANG_PLAYER"WARUMP_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), "%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")
    }
    {
    if(
is_user_alive(id))
        
set_user_health(idPLAYER_HEALTH)
        
set_user_maxspeed(id,MAX_SPEED)



Tote 04-12-2024 08:09

Re: Simple WarmUp
 
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 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", "60")
       
        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(0, PLAYER_HEALTH)
                set_user_maxspeed(0, 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_user_health(0, PLAYER_HEALTH)
                set_user_maxspeed(0, MAX_SPEED)
               
                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
        {
                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)
        }   
        hudtimer--
}

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


Tote 04-12-2024 08:12

Re: Simple WarmUp
 
use logic & reasoning.

you were doing the set hp and set speed in the curweapon event (which is called everytime switch weapons) so it would be setting hp and speed each time you switch to other weapon.

So 1. You set the stuff when its started.
2. You set it in spawn too so when player spawns & the warmup is still enabled then it will set

tarsisd2 04-12-2024 11:57

Re: Simple WarmUp
 
Quote:

Originally Posted by Tote (Post 2820851)
use logic & reasoning.

you were doing the set hp and set speed in the curweapon event (which is called everytime switch weapons) so it would be setting hp and speed each time you switch to other weapon.

So 1. You set the stuff when its started.
2. You set it in spawn too so when player spawns & the warmup is still enabled then it will set

you are a life saver man, thanks for explaining too, thanks so much :)

tarsisd2 04-15-2024 08:04

Re: Simple WarmUp
 
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")
    }



Ace67 04-16-2024 16:40

Re: Simple WarmUp
 
Quote:

Originally Posted by tarsisd2 (Post 2820983)
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")
    }



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");
    }
}


tarsisd2 04-17-2024 07:19

Re: Simple WarmUp
 
Quote:

Originally Posted by Ace67 (Post 2821038)
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


All times are GMT -4. The time now is 11:52.

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