AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hooking the event, when clients maxspeed is changed (https://forums.alliedmods.net/showthread.php?t=146641)

abdul-rehman 12-30-2010 07:47

Hooking the event, when clients maxspeed is changed
 
So as the title says, it there any event which i can hook when a players maxspeed is changed

I tried the following method but it doesnt worked:
Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> public plugin_init() register_clcmd( "say test" , "hook" )     RegisterHam(Ham_Item_PreFrame, "player", "item" ) public item(id) client_print(0,print_chat,"Item Frame Called on player: %d", id) public hook(id) {     client_print(id,print_center,"speed set to 800.0")     set_pev(id, pev_maxspeed, 800.0) }
The forward is only called when i try to change my weapon, and it is not called when i manually set the max speed to 800.0 using the "say test" command so is there any other forward/event through which i can be sure that the clients maxspeed was changed

meTaLiCroSS 12-30-2010 11:00

Re: Hooking the event, when clients maxspeed is changed
 
That's not the correctly way for changing player's max speed, I believe that you saw that in ZP lol. Use set_user_maxspeed for chaging player's max speed in a single frame, and 4ever.

abdul-rehman 12-30-2010 12:24

Re: Hooking the event, when clients maxspeed is changed
 
Quote:

Originally Posted by meTaLiCroSS (Post 1382394)
That's not the correctly way for changing player's max speed, I believe that you saw that in ZP lol. Use set_user_maxspeed for chaging player's max speed in a single frame, and 4ever.

If i set the speed in Ham_Item_PreFrame then probably, Ham_Item_PreFrame will be called again ??
So this means it will form an infinite loop in which Ham_Item_PreFrame will be called and then i will change the speed and then it will again be called and so it will go on,
So isnt it better to set the speed in a 0.1 second task with a "b" flag ?

Exolent[jNr] 12-30-2010 23:20

Re: Hooking the event, when clients maxspeed is changed
 
Quote:

Originally Posted by abdul-rehman (Post 1382432)
If i set the speed in Ham_Item_PreFrame then probably, Ham_Item_PreFrame will be called again ??
So this means it will form an infinite loop in which Ham_Item_PreFrame will be called and then i will change the speed and then it will again be called and so it will go on,
So isnt it better to set the speed in a 0.1 second task with a "b" flag ?

1. No
2. See #1.
3. Never.


All times are GMT -4. The time now is 02:11.

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