Changing player speed

Please post any questions about developing your plugin here. Please use the search function before posting!
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Changing player speed

Postby arawra » Tue May 26, 2015 6:56 pm

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?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue May 26, 2015 7:18 pm

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?
Image
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue May 26, 2015 7:23 pm

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
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Postby arawra » Wed May 27, 2015 2:59 am

E: Was being silly with custom attribute naming...

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 135 guests