|
Author
|
Message
|
|
Member
|

08-12-2014
, 05:55
Setting a player's speed..is a nightmare.
|
#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(0, 0, "Max speed of %f.", maxSpeed); set_pev(id, pev_maxspeed, maxSpeed*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(id, fSpeed); client_print_color(id, id, "^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(id, fGrav); client_print_color(id, id, "^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(spawnFunc, charsmax(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.
|
|
|
|