AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to reset a user's max speed? (https://forums.alliedmods.net/showthread.php?t=47043)

Geesu 11-08-2006 11:05

How to reset a user's max speed?
 
How do you reset a user's maxspeed so the engine will automatically determine what the speed should be?

I know it is reset at round start, but if mid-round I want to reset it how can I do this?

And it's not set_user_maxspeed( id ); Passing -1 as the argument makes the user stuck in place and cannot move.

I'm worried there isn't a number you can set it too and it relates to the (*g_engfuncs.pfnSetClientMaxspeed) call within fun.cpp. There is no comparable pfnGetClientMaxspeed (yes I know you can get it from v.maxspeed but this might be stored in a separate place).

Any ideas?

Thanks,
Josh

VEN 11-08-2006 12:09

Re: How to reset a user's max speed?
 
For all connected clients SetClientMaxspeed to 1.0 and set maxspeed pev according to the current weapon (for example 260.0 for the scout).

Geesu 11-08-2006 12:12

Re: How to reset a user's max speed?
 
Is there any way to reset without knowing the users current weapon?

I just wish there was literally a reset function so the engine would start handling... Something Ive just found is that you can force a weapon change on the client and the speed will be reset.

Greenberet 11-08-2006 12:28

Re: How to reset a user's max speed?
 
dont think so, but you can save the current maxspeed b4 you set it. to reset just use the stored value

VEN 11-08-2006 12:57

Re: How to reset a user's max speed?
 
[edit]
Yes, the only thing that could happen is that other plugin can change the maxpseed value before you get it.
[/edit]

If you don't want to use weapons speeds array to set the speed for the corresponding weapon (why?), you can, for example, emulate double "lastinv" cmd but i wouldn't do that because player can have only one weapon and this will not work. Also it's a bit hackish. You could also just "wait" until weapon change. But again - using weapons speeds array is the most appropriate way. If you don't want to create it yourself, use search, i saw it somewhere on the forums.

Greenberet 11-08-2006 13:33

Re: How to reset a user's max speed?
 
Quote:

Originally Posted by VEN (Post 401205)
[edit]
Yes, the only thing that could happen is that other plugin can change the maxpseed value before you get it.
[/edit]

I dont get it...
hl is singlethreaded

VEN 11-08-2006 13:48

Re: How to reset a user's max speed?
 
That's exactly why...

Code:
// plugin #1 #include <amxmodx> #include <fakemeta> public plugin_init() {     register_event("CurWeapon", "func", "be", "1=1") } public func(id) {     new Float:maxspeed     pev(id, pev_maxspeed, maxspeed)     server_print("MAXSPEED_1[%f]", maxspeed)     set_pev(id, pev_maxspeed, 123.0) }
Code:
// plugin #2 #include <amxmodx> #include <fakemeta> public plugin_init() {     register_event("CurWeapon", "func", "be", "1=1") } public func(id) {     new Float:maxspeed     pev(id, pev_maxspeed, maxspeed)     server_print("MAXSPEED_2[%f]", maxspeed) }

Code:
/* OUTPUT MAXSPEED_1[250.000000] MAXSPEED_2[123.000000] */

Greenberet 11-08-2006 17:15

Re: How to reset a user's max speed?
 
now i get what you mean^^
i thought you mean that plugin A interrupts plugin B like threads.

but yeah in this case you would get the wrong value.


All times are GMT -4. The time now is 20:17.

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