Raised This Month: $ Target: $400
 0% 

Setting a player's speed..is a nightmare.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PreDominance
Member
Join Date: Jul 2014
Old 08-12-2014 , 05:55   Setting a player's speed..is a nightmare.
Reply With Quote #1

Greetings,

I'm having an insanely difficult time with setting my speed. Yes I've read the forums and I've gone through about 20 threads, trying different crap and I can't find what I'm doing wrong.

Relevant code:

nwc.sma
PHP Code:
    RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""event_resetMaxSpeed"true
events.inl
PHP Code:
public event_resetMaxSpeed(id
{
    if(
is_user_alive(id) && P_ATTRIB[id][P_ATTRIB_SPEED] != 0)
    {
        new 
float:maxSpeed get_user_maxspeed(id);
        if (
maxSpeed != 1.0
        {
            
client_print_color(00"Max speed of %f."maxSpeed);
            
set_pev(idpev_maxspeedmaxSpeed*4.0);
            
//have tried set_user_maxspeed, using constants, using...everything
        
}
    } 

^ yes, the debug chat prints.

race_undead_scourge.inl
PHP Code:
public race_0_spawn(id)
{
    new 
speedLevel P_DATA[id][P_SKILL_LEVEL_B] - 1;
    new 
gravLevel P_DATA[id][P_SKILL_LEVEL_C] - 1;
    if (
speedLevel 0) {
        new 
float:fSpeed RACE_SKILL_VALUE[RACE_UNDEAD_SCOURGE][1][speedLevel];
        
P_ATTRIB[id][P_ATTRIB_SPEED] = fSpeed;
        
set_user_maxspeed(idfSpeed);
        
client_print_color(idid"^x03[^x04%s^x03]^x01 Your speed has been set."RACE_SKILL_NAMES[RACE_UNDEAD_SCOURGE][1]);
    }
    if (
gravLevel 0) {
        new 
float:fGrav RACE_SKILL_VALUE[RACE_UNDEAD_SCOURGE][2][gravLevel];
        
P_ATTRIB[id][P_ATTRIB_GRAVITY] = fGrav;
        
set_user_gravity(idfGrav);
        
client_print_color(idid"^x03[^x04%s^x03]^x01 Your gravity has been set."RACE_SKILL_NAMES[RACE_UNDEAD_SCOURGE][2]);
    }

^
gravity works just fine.

events.inl
PHP Code:
    if (PB_DATA[id][PB_HAS_SPAWN]) {
        new 
spawnFunc[25];
        
format(spawnFunccharsmax(spawnFunc), "race_%i_spawn"P_DATA[id][P_RACE]);
        if (
callfunc_begin(spawnFunc"") == 1)
        {
            
callfunc_push_int(id);
            
callfunc_end();
        } else {
            
nwc_log(LOGTYPE_ERROR"ERROR: COULD NOT EXECUTE SPAWN FUNCTION");
        }
    } 
Have tried both pre and post-hook variants. Have tried hooking curweapon. Please, someone save me..

Last edited by PreDominance; 08-12-2014 at 05:59.
PreDominance is offline
 



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 12:56.


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