Raised This Month: $ Target: $400
 0% 

IN_USE -> Execute command


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-24-2016 , 08:57   Re: IN_USE -> Execute command
Reply With Quote #7

Use 'Ham_ObjectCaps' instead of 'client_PreThink' because 'client_PreThink' is called per frame (like 20 times per second) all the time (every second) and 'Ham_ObjectCaps' is just called when you press the button.
Code:
#include <amxmodx> #include <hamsandwich> #include <fun> /*  * Called just after server activation.  */ public plugin_init() {     register_plugin( "Cool Plugin", "1.0", "Addons zz" )         RegisterHam( Ham_ObjectCaps, "player", "pressed_button_command", 0 ) } /*  * Called when a button is pressed.  */ public pressed_button_command( id ) {     static user_health; user_health = get_user_health( id )         set_user_health( id, user_health + 1 )         if( user_health > 254 )     {         set_user_health( id, 100 )     } }
See also: [SOLVED] Any way to hook +use?
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-24-2016 at 09:10. Reason: spelling fix
addons_zz is offline
 



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 09:31.


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