Players movementspeed
Posted: Mon Jan 15, 2018 8:23 am
So I am trying to change a players movementspeed for a certain amount of time and don't even know where to begin with
. Any help is appreciated

Syntax: Select all
from events import Event
from players.entity import Player
@Event('player_spawn')
def _player_spawn(game_event):
"""Fired when a player spawns."""
# Get a Player instance of the player spawning...
player = Player.from_userid(game_event.get_int('userid'))
# Exit the function if the player is not in a valid team...
if player.team_index <= 1:
return
# Double the player's speed...
player.speed *= 2
Syntax: Select all
from events import Event
from players.entity import Player
@Event('player_spawn')
def _player_spawn(game_event):
"""Fired when a player spawns."""
# Get a Player instance of the player spawning...
player = Player.from_userid(game_event.get_int('userid'))
# Exit the function if the player is not in a valid team...
if player.team_index <= 1:
return
# Double the player's speed...
player.speed *= 2
# Call reset_speed(player) after 10 seconds
player.delay(10, reset_speed, [player])
def reset_speed(player):
# Set the player's speed back to the normal value
player.speed = 1
battleweaver wrote:Would like to add some info.
First of all: I talk about CS:GO.
There are 2 variables that control speed.
If I am correct, the way offered above works with 'sv_accelerate', which is multiplier to your base speed
Console variable 'sv_maxspeed' - base speed, which is determined, for example, by weapon you carry. More detailed info over here https://steamcommunity.com/sharedfiles/filedetails/?id=501419345
From what I read about it, 'sv_maxspeed' can't be more than 500 if set manually.
Hymns For Disco wrote:I believe you are incorrect about both of these cvars. First, sv_accelerate will affect how fast you will accelerate while walking. This wont affect max speed, only make you achieve that max speed faster or slower after you start moving. Second, sv_maxspeed is not your base speed, and is not determined by your weapon. sv_maxspeed will remain the same unless changed by the server. (default value is 320). It also does not affect how fast you can walk directly. Setting the sv_maxspeed super high won't make you walk super fast. Setting it below 250 however will limit you to that speed and therefore make you walk slower.