If you're creating a plugin that will affects a player speed, then never use this method to set's a player speed:
- PreThink
- CurWeapon
- set_task
Instead, you should use
PHP Code:
#include <cs_maxspeed_api>
that is used by Zombie Plague.
Examples of usage:
PHP Code:
#include <amxmodx>
#include <cs_maxspeed_api>
new bool:IsActivated[33]
public plugin_init()
{
register_plugin("Test", "1.0.0", "Nobody")
register_clcmd("say /speedhack", "toggle_speedhack")
}
public toggle_speedhack(id)
{
if(is_user_alive(id))
{
if(IsActivated[id])
{
cs_reset_player_maxspeed(id)// RESETS PLAYER MAXSPEED
IsActivated[id] = false
}
else
{
cs_set_player_maxspeed(id, 5000.0) // ADD 5000.0 TO CURRENT SPEED
// OR
cs_set_player_maxspeed(id, 5000.0, true) // MULTIPLIY 5000.0 TO CURRENT SPEED
IsActivated[id] = true
}
}
}
How hard can that be? Three simple steps.
- Include cs_maxspeed_api
- Set player's maxspeed
- Reset player's maxspeed
Notes- This method is using hamsandwich method.
If you need examples,
[ZP 5.0] Sprinting