Page 1 of 1

Changing player speed

Posted: Tue May 26, 2015 6:56 pm
by arawra
Using PlayerEntity.speed didn't give me any change of player speed, so I decided to use set_property_float('m_flLaggedMovementValue'). Whenever I modify this value and I jump, I seem to freeze and the server console spits out this:

DataTable warning: player: Out-of-range value (929.852112) in SendPropFloat 'm_flStamina', clamping.
DataTable warning: player: Out-of-range value (931.689636) in SendPropFloat 'm_flStamina', clamping.
DataTable warning: player: Out-of-range value (932.608398) in SendPropFloat 'm_flStamina', clamping.
DataTable warning: player: Out-of-range value (933.527161) in SendPropFloat 'm_flStamina', clamping.
DataTable warning: player: Out-of-range value (934.445923) in SendPropFloat 'm_flStamina', clamping.
DataTable warning: player: Out-of-range value (935.364685) in SendPropFloat 'm_flStamina', clamping.
DataTable warning: player: Out-of-range value (937.202209) in SendPropFloat 'm_flStamina', clamping.

Any work around or optimal solution?

Posted: Tue May 26, 2015 7:18 pm
by satoon101
Entity.speed for players (also PlayerEntity) should be getting/setting CBasePlayer.localdata.m_flLaggedMovementValue. Make sure you are passing it a float when setting the value. For other entities, the speed entity KeyValue is retrieved/set with Entity.speed.

Also, PlayerEntity.speed has worked fine for me, but I will have to verify that when I get home tonight.

What game is this for, btw?

Posted: Tue May 26, 2015 7:23 pm
by Ayuto
Actually it's working fine for me. On which game did you test that and did you update your SP files?

Syntax: Select all

from players.entity import PlayerEntity
from players.helpers import index_from_userid

from events import Event


@Event
def player_jump(event):
userid = event.get_int('userid')
index = index_from_userid(userid)
player = PlayerEntity(index)

# Double the speed
player.speed = 2

Posted: Wed May 27, 2015 2:59 am
by arawra
E: Was being silly with custom attribute naming...