AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_user_maxspeed (https://forums.alliedmods.net/showthread.php?t=135845)

Pontu$ 08-20-2010 08:09

set_user_maxspeed
 
how to set_user_maxspeed ?

set_user_maxspeed(index, Float:speed) i CurWeapon, get_pcvar_num(pcvarSpeed))


Thanks! :oops:

Ryokin 08-20-2010 08:25

Re: set_user_maxspeed
 
this was asked many time, you should learn to search more

drekes 08-20-2010 09:15

Re: set_user_maxspeed
 
PHP Code:

#include <amxmodx>
#include <fun>

#define MAX_SPEED 300.0

public plugin_init()
    
register_event("CurWeapon""Event_CurWeapon""be");
    
public 
Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idMAX_SPEED);



ot_207 08-20-2010 09:32

Re: set_user_maxspeed
 
Quote:

Originally Posted by drekes (Post 1276707)
PHP Code:

#include <amxmodx>
#include <fun>

#define MAX_SPEED 300.0

public plugin_init()
    
register_event("CurWeapon""Event_CurWeapon""be");
    
public 
Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idMAX_SPEED);



It is good but not the best!
Here it is:
PHP Code:

#include <amxmodx>
#include <fun>
#include <hamsandwich>

#define Ham_Player_ResetMaxSpeed    Ham_Item_PreFrame

#define MAX_SPEED 300.0

public plugin_init()
    
RegisterHam(Ham_Player_ResetMaxSpeed,"player","pfw_resetmaxspeed",1)

public 
pfw_resetmaxspeed(id)
{
    
//set_user_maxspeed(id, MAX_SPEED)
    
set_user_maxspeed(idget_user_maxspeed(id) * 2// Make user run 2 times faster!



drekes 08-20-2010 10:33

Re: set_user_maxspeed
 
Can you give a little more info about Ham_Item_PreFrame and why you use the Ham_Player_ResetMaxSpeed define?

Arkshine 08-20-2010 10:36

Re: set_user_maxspeed
 
http://forums.alliedmods.net/showpos...2&postcount=11

ot_207 08-20-2010 10:37

Re: set_user_maxspeed
 
Quote:

Originally Posted by drekes (Post 1276777)
Can you give a little more info about Ham_Item_PreFrame and why you use the Ham_Player_ResetMaxSpeed define?

It is a method found by Quim. Item_PreFrame is a forward made specially for items, I haven't tested on them so I don't know what purpose they have.
But when ran on players it takes place exactly when speed is updated on player.
So basically registering this as a forward on a player entity and as post. You have exactly the moment when the player speed changes and also you obtain the speed of the player. That is why I made the second name RESETMAXSPEED.

Mini_Midget 08-20-2010 10:46

Re: set_user_maxspeed
 
Would we still need to check if players are alive or not?

drekes 08-20-2010 10:46

Re: set_user_maxspeed
 
Awesome, thanks guys

ot_207 08-20-2010 10:48

Re: set_user_maxspeed
 
From what I know. And seeing the Quim's code it isn't needed.


All times are GMT -4. The time now is 21:56.

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