Raised This Month: $ Target: $400
 0% 

Simple WarmUp


Post New Thread Reply   
 
Thread Tools Display Modes
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-17-2024 , 10:00   Re: Simple WarmUp
Reply With Quote #11

Quote:
Originally Posted by tarsisd2 View Post
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
that's because player movement speed is reset by the engine on weapon change. you need to hook weapon change event and set it back every time.
__________________
georgik57 is online now
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 04-17-2024 , 10:12   Re: Simple WarmUp
Reply With Quote #12

Quote:
Originally Posted by tarsisd2 View Post
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
PHP 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 250.0 // Adjusted max speed

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_event("CurWeapon","reset_speed","be","1=1","2!29"); // Register event for resetting speed
    
    
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(idPLAYER_HEALTH);
        
set_user_maxspeed(idMAX_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_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 
    {
        
hudtimer--;
        
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);
    }    
}

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

public 
reset_speed(id)
{
    if(
task_exists(TASKID)) 
    {
        
set_user_maxspeed(idMAX_SPEED);
    }

I updated it, test it and let me know. If you want to change the speed go to the line "#define MAX_SPEED 250.0".
__________________
CS:CZ > CS 1.6

Last edited by Ace67; 04-17-2024 at 10:13.
Ace67 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-17-2024 , 19:09   Re: Simple WarmUp
Reply With Quote #13

wait a moment and analyze your surroundings
__________________
mlibre is offline
Tote
Senior Member
Join Date: Jul 2023
Old 04-18-2024 , 05:30   Re: Simple WarmUp
Reply With Quote #14

Quote:
Originally Posted by tarsisd2 View Post
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
The reason is because you limited the Your own speed in cs.

cl_forwardspeed 999
cl_backspeed 999
etc. No need anything Else, just do this in your console..
Tote is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 04-18-2024 , 11:18   Re: Simple WarmUp
Reply With Quote #15

Quote:
Originally Posted by Ace67 View Post
PHP 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 250.0 // Adjusted max speed

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_event("CurWeapon","reset_speed","be","1=1","2!29"); // Register event for resetting speed
    
    
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(idPLAYER_HEALTH);
        
set_user_maxspeed(idMAX_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_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 
    {
        
hudtimer--;
        
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);
    }    
}

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

public 
reset_speed(id)
{
    if(
task_exists(TASKID)) 
    {
        
set_user_maxspeed(idMAX_SPEED);
    }

I updated it, test it and let me know. If you want to change the speed go to the line "#define MAX_SPEED 250.0".
Everything working now, thanks everyone for all of your help
tarsisd2 is offline
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 04-19-2024 , 15:29   Re: Simple WarmUp
Reply With Quote #16

Quote:
Originally Posted by tarsisd2 View Post
Everything working now, thanks everyone for all of your help
Enjoy
__________________
CS:CZ > CS 1.6
Ace67 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-20-2024 , 23:27   Re: Simple WarmUp
Reply With Quote #17

although "it works" is not good way, no need to duplicate the event
__________________
mlibre is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 04-22-2024 , 08:10   Re: Simple WarmUp
Reply With Quote #18

Quote:
Originally Posted by mlibre View Post
although "it works" is not good way, no need to duplicate the event
Lajtowy sent me a updated code, thanks everyone
tarsisd2 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-22-2024 , 10:33   Re: Simple WarmUp
Reply With Quote #19

Quote:
Originally Posted by tarsisd2 View Post
Lajtowy sent me a updated code, thanks everyone
share such wonder
__________________
mlibre is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 04-22-2024 , 14:13   Re: Simple WarmUp
Reply With Quote #20

Quote:
Originally Posted by mlibre View Post
share such wonder

of course man

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

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

#define PLUGIN "Simple Knife Warmup"
#define VERSION "1.2"  // Version update
#define AUTHOR "Sn!ff3r EL3"

#define TASKID 1234
#define PLAYER_HEALTH 35
#define MAX_SPEED 250.0 // Adjusted max speed

new hudtimercvarhudhandlermp_freezetimevalue

// Error handling for critical functions
public plugin_init() 
{
    if (!
register_plugin(PLUGINVERSIONAUTHOR)) {
        
printf("Error: Could not register plugin %s"PLUGIN);
        return 
PLUGIN_FAILED;
    }

    if ((
cvar register_cvar("warmup_timer""30")) == INVALID_CVAR) {
        
printf("Error: Could not register cvar warmup_timer");
        return 
PLUGIN_FAILED;
    }
    
    
register_message(get_user_msgid("TextMsg"), "message_TextMsg");
    
register_dictionary("simple_warmup.txt");

    
hudhandler CreateHudSyncObj();

    
RegisterHam(Ham_Spawn"player""fw_spawn"1);
}

// Error handling for retrieving cvar pointer
public plugin_cfg() 
{
    if ((
mp_freezetime get_cvar_pointer("mp_freezetime")) == INVALID_CVAR) {
        
printf("Error: Could not retrieve cvar pointer for mp_freezetime");
        return 
PLUGIN_FAILED;
    }
    
    
set_task(10.0"read_vars");
}

public 
fw_spawn(id
{
    if(
task_exists(TASKID)) 
    {
        
set_user_health(idPLAYER_HEALTH);
        
set_user_maxspeed(idMAX_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_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 
    {
        
hudtimer--;
        
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);
    }    
}

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

public 
reset_speed(id)
{
    if(
task_exists(TASKID)) 
    {
        
set_user_maxspeed(idMAX_SPEED);
    }

tarsisd2 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:28.


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