AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Doubt about MaxSpeed (https://forums.alliedmods.net/showthread.php?t=272535)

KuvZz 10-02-2015 12:20

Doubt about MaxSpeed
 
I'm using set_user_maxspeed on a plugin but when I set a speed is always the same. Normal speed is 250, but between 250-850 always is the same speed (I mean 251=850, for example)
I used CurWeapon event and someone told me this is a bad method cause is called so many times, yep, and recommend me Ham_Item_PerFrame. I couldn't find anything about this in the forums. What method should I use?
(Now. CurWeapon works, btw if I use a common cvar, maxpeed resets when I change the weapon)
PHP Code:

new cvar_speed

public plugin_init() {
        
//Some stuff
        
cvar_speed register_cvar("speed""251")
        
register_event("CurWeapon""event_speed""be""1=1")
}

public 
event_speed(id) {
    if (!
is_user_alive(id))
        return
    
    static 
FloatMaxSpeed
    MaxSpeed 
get_pcvar_float(cvar_speed)
    
    
set_user_maxspeed(idMaxSpeed)



redivcram 10-02-2015 12:51

Re: Doubt about MaxSpeed
 
cvar_speed shouldn't be an integer there...

KuvZz 10-02-2015 12:55

Re: Doubt about MaxSpeed
 
Quote:

Originally Posted by redivcram (Post 2348948)
cvar_speed shouldn't be an integer there...

Yeh, I copied an example, that works but is not a good method.

redivcram 10-02-2015 12:57

Re: Doubt about MaxSpeed
 
Well? Did you change 251 to 251.0?

KuvZz 10-02-2015 13:12

Re: Doubt about MaxSpeed
 
Quote:

Originally Posted by redivcram (Post 2348954)
Well? Did you change 251 to 251.0?

Same.

redivcram 10-02-2015 13:14

Re: Doubt about MaxSpeed
 
Then use a bigger number... like 700.0

KuvZz 10-02-2015 13:18

Re: Doubt about MaxSpeed
 
Quote:

Originally Posted by redivcram (Post 2348965)
Then use a bigger number... like 700.0

Is the same in all cases 251=500=700=850 and so... that's the problem.

HamletEagle 10-02-2015 13:51

Re: Doubt about MaxSpeed
 
https://forums.alliedmods.net/showpo...2&postcount=11

KuvZz 10-02-2015 14:12

Re: Doubt about MaxSpeed
 
Quote:

Originally Posted by HamletEagle (Post 2348989)

Nice, it works now, but the normal speed is 50, right? And maximum speed?

NiHiLaNTh 10-02-2015 14:42

Re: Doubt about MaxSpeed
 
dont forget about sv_maxspeed cvar which caps maxspeed value.


All times are GMT -4. The time now is 22:10.

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