Raised This Month: $ Target: $400
 0% 

API Scripting Help [TUT][ZP 5.0] Creating a plugin that will affects player speed


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 12-09-2011 , 22:26   [TUT][ZP 5.0] Creating a plugin that will affects player speed
Reply With Quote #1

If you're creating a plugin that will affects a player speed, then never use this method to set's a player speed:
  1. PreThink
  2. CurWeapon
  3. 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(id5000.0// ADD 5000.0 TO CURRENT SPEED
            // OR
            
cs_set_player_maxspeed(id5000.0true// MULTIPLIY 5000.0 TO CURRENT SPEED
            
            
IsActivated[id] = true
        
}
    }

How hard can that be? Three simple steps.
  1. Include cs_maxspeed_api
  2. Set player's maxspeed
  3. Reset player's maxspeed

Notes
  • This method is using hamsandwich method.

If you need examples, [ZP 5.0] Sprinting

Last edited by Excalibur.007; 12-09-2011 at 22:29.
Excalibur.007 is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode