C4 TAKER v1.09
(For lack of a better name)
Description:
Enables you to take the C4 from a teammate by aiming at him/her and pressing the USE key. (default 'E')
This is especially useful when playing with bots either for gameplay or debug purposes...
Requires:
amxmodx | fakemeta_util | hamsandwich
CVARs:- c4t_admin_only [default 1] - limits the plugin for admin use only. Set to '0' so that everyone can take the C4. Set to '2' and admin gets the C4 automatically every start of a round.
- c4t_take_from_humans [default 0 ]- set to '1' to enable to take C4 from human players
- c4t_max_distance [default 120] - max distance for the take
- c4t_hud [default 5] - number of instances the HUD Message appears. Set to '0' to disable. Can be set to '9999...'.
Notes:
- Only Admins can take C4 by default
- Max distance of the HUD message are the same which means it may serve as an indicator of sorts.
- HUD message appears for certain amount of instances (set by a cvar) for each human player. After that it is disabled.
I did this because I found the HUD message annoying after a couple of rounds.
- Based off joaquimandrade's and ConnorMcLeod's "EasyWeaponsTrade" plugin.
- First submitted plugin. Please don't hang me. Just take my bacon if you want.
Changelog:
v1.09
- Removed a potential infinite loop
v1.08
- More optimization
- A few more inconsistencies fixed
v1.07
- Code consistency. Courtesy for those wanting to learn the script.
v1.06
v1.05
- c4t_admin_only cvar now has 3 modes
0 - Disables admin_only. Everyone can take the C4.
1 - Enabled. Only admin gets to take the C4 from a teammate.
2 - Every start of a round, the admin always gets the C4.
- Carrier gets a HUD message when C4 is taken from them and who took it.
v1.04- Added CVAR 'admin_only' which limits use for admins only. It is set to '1' by default
- HUD Message disappears immediately when you've stopped looking at the bomb carrier
- Changed max distance default from 200 to 120
v1.03- New plugin name
- Removed unused 'MaxSlots' variable
- Removed some redundancies on EventStatusValue_PlayerID
- EventStatusValue_PlayerID now checks first if aiming player is alive
- Switched from CVARS to PCVARS because my code is horrible
- HUD Message now enabled when 'c4t_take_from_human' cvar is enabled
v1.02- Replaced getLookingAt function with native get_user_aiming
v1.01- Added 3 cvars
- Fixed code to prevent dead players from getting the C4
- Added code that resets the HUD Message limiter when player disconnects
v1.0 - First release.
SPECIAL THANKS:
To
joaquimandrade &
ConnorMcLeod for their
EasyWeaponsTrade that inspired the idea.
To
wickked &
JusTGo for helping me with the HUD message.
To
VEN for his bomb scripting tutorial.
To
HamletEagle for helping me optimize the script.