Raised This Month: $12 Target: $400
 3% 

Doubt about MaxSpeed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 10-02-2015 , 12:20   Doubt about MaxSpeed
Reply With Quote #1

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)

__________________

Last edited by KuvZz; 10-02-2015 at 12:29.
KuvZz is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-02-2015 , 12:51   Re: Doubt about MaxSpeed
Reply With Quote #2

cvar_speed shouldn't be an integer there...
redivcram is offline
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 10-02-2015 , 12:55   Re: Doubt about MaxSpeed
Reply With Quote #3

Quote:
Originally Posted by redivcram View Post
cvar_speed shouldn't be an integer there...
Yeh, I copied an example, that works but is not a good method.
__________________
KuvZz is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-02-2015 , 12:57   Re: Doubt about MaxSpeed
Reply With Quote #4

Well? Did you change 251 to 251.0?
redivcram is offline
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 10-02-2015 , 13:12   Re: Doubt about MaxSpeed
Reply With Quote #5

Quote:
Originally Posted by redivcram View Post
Well? Did you change 251 to 251.0?
Same.
__________________
KuvZz is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-02-2015 , 13:14   Re: Doubt about MaxSpeed
Reply With Quote #6

Then use a bigger number... like 700.0
redivcram is offline
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 10-02-2015 , 13:18   Re: Doubt about MaxSpeed
Reply With Quote #7

Quote:
Originally Posted by redivcram View Post
Then use a bigger number... like 700.0
Is the same in all cases 251=500=700=850 and so... that's the problem.
__________________
KuvZz is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-02-2015 , 13:51   Re: Doubt about MaxSpeed
Reply With Quote #8

https://forums.alliedmods.net/showpo...2&postcount=11
HamletEagle is offline
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 10-02-2015 , 14:12   Re: Doubt about MaxSpeed
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
Nice, it works now, but the normal speed is 50, right? And maximum speed?
__________________
KuvZz is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 10-02-2015 , 14:42   Re: Doubt about MaxSpeed
Reply With Quote #10

dont forget about sv_maxspeed cvar which caps maxspeed value.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Reply



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 22:08.


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