AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [NATIVE] Player AirAccelerate (https://forums.alliedmods.net/showthread.php?t=138792)

Exolent[jNr] 09-22-2010 17:27

[NATIVE] Player AirAccelerate
 
3 Attachment(s)
It has been said that changing sv_airaccelerate for only one player was impossible.
Well, that statement is no longer true.

The following natives allow you to modify a player's airaccelerate value:
Code:
/*  * Sets a player's personal value for airaccelerate  *  * @param    id - The player index  * @param    airaccelerate - The value for airaccelerate  *  * @return    The value for airaccelerate before setting to new value  *  * @note    Use 0 as id to set all players' airaccelerate  *  */ native set_user_airaccelerate(id, const airaccelerate); /*  * Gets a player's personal value for airaccelerate  *  * @param    id - The player index  *  * @return    The value for airaccelerate  *  */ native get_user_airaccelerate(id); /*  * Resets a player's personal value for airaccelerate  *  * @param    id - The player index  *  * @return    1  *  * @note    Use 0 as id to reset all players' airaccelerate  *  */ native reset_user_airaccelerate(id);

To use this, install airaccelerate.amxx above any plugin in the plugins.ini.
In the plugins that use this, you will need this line at the top:
Code:
#include <airaccelerate>
Also, the plugins using this include will obviously need to compile locally.
Here are some tutorials on compiling locally:
http://wiki.amxmodx.org/Compiling_Pl...28AMX_Mod_X%29
http://forums.alliedmods.net/showthread.php?t=130511




Requirements:



You can use my own test plugin to try it out for yourself.

Commands:
  • say /aa get
    - Shows your current airaccelerate value
  • say /aa reset
    - Resets your airaccelerate value to sv_airaccelerate
  • say /aa <integer>
    - Sets your airaccelerate value to <integer>



Feedback and suggestions are welcome.

platzpatrone 09-22-2010 17:32

Re: [NATIVE] Player AirAccelerate
 
:shock: nice Exolent, u uber haxorizor :)

GXLZPGX 09-22-2010 17:59

Re: [NATIVE] Player AirAccelerate
 
I think some of the natives posted in the code snippets are valuable enough to be put in a newer version of amxmodx. Very nice!

Exolent[jNr] 09-22-2010 19:14

Re: [NATIVE] Player AirAccelerate
 
Forgot to add requirements for this.
They are now in the first post.

GXLZPGX 09-22-2010 19:57

Re: [NATIVE] Player AirAccelerate
 
Quote:

Originally Posted by Exolent[jNr] (Post 1306151)
Forgot to add requirements for this.
They are now in the first post.

Bah. Orpheu.

Arkshine 09-22-2010 20:00

Re: [NATIVE] Player AirAccelerate
 
You better avoid to use the memory file PM, it uses offset and can be easily broken on update. It would be more safe to save it from PM_Move.

Quote:

Bah. Orpheu.
You have not idea how it's damn useful. ^^

GXLZPGX 09-22-2010 21:07

Re: [NATIVE] Player AirAccelerate
 
Quote:

Originally Posted by Arkshine (Post 1306204)
You better avoid to use the memory file PM, it uses offset and can be easily broken on update. It would be more safe to save it from PM_Move.



You have not idea how it's damn useful. ^^

Well of course, Orpheu is the best solution for everything :)

Exolent[jNr] 09-22-2010 22:08

Re: [NATIVE] Player AirAccelerate
 
Quote:

Originally Posted by Arkshine (Post 1306204)
You better avoid to use the memory file PM, it uses offset and can be easily broken on update. It would be more safe to save it from PM_Move.

Agreed and updated.

Quote:

Originally Posted by GXLZPGX (Post 1306237)
Well of course, Orpheu is the best solution for everything :)

No, it's not. But it is powerful when needed.

wrecked_ 09-22-2010 22:13

Re: [NATIVE] Player AirAccelerate
 
Good work. This probably won't receive as much appreciation as the hard work you put into this deserves, but it will be very useful to many people. :up:

Exolent[jNr] 09-22-2010 22:15

Re: [NATIVE] Player AirAccelerate
 
Quote:

Originally Posted by wrecked_ (Post 1306277)
Good work. This probably won't receive as much appreciation as the hard work you put into this deserves, but it will be very useful to many people. :up:

It actually wasn't that much work.
All I had to do was look in the PM_AirAccelerate function to see what was happening and realized what needed to be done.
But thanks for appreciating my work :)


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

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