IN_USE -> Execute command
Hello guys, I'm real newbie at Amxx scripting, so I need detail help with this plugin.
I have some plugin that have function "box_use" to grab boxes from map and "box_use" to drop them. I can easily bind it to myself with "bind e box_use", but many players can't bind it with console cause they kids. I need a plugin that will execute box_use in console when player press his use button. Do I need to edit a box plugin for it? Cause I heard that binding with clientcmd is a bad way to execute commands and cannot work properly on Steam clients. I can attach sma file for boxes plugin if you can help me, I just need to attach one function, pls guys :3 |
Re: IN_USE -> Execute command
Better way is to edit your plugin as this parachute plugin to use the 'use' button command as/instead of 'use_box'.
See:
|
Re: IN_USE -> Execute command
I tiried this code:
public client_PreThink(id){ if(entity_get_int(id,EV_INT_button) & IN_USE) { client_print(id,print_chat,"You are you using box") box_use(id) } } But when I press button once it counts many times like: You are you using box You are you using box You are you using box You are you using box Any idea how to solve it? I can use box now with this use but it is laggy due to multiple usage with one press. UPDATE: I found a fix for this! Now all working perfect, thanks to addons_zz and google. public client_PreThink(id){ if(get_user_button(id) & IN_USE && !(get_user_oldbutton(id) & IN_USE)) { client_print(id,print_chat,"You are you using box") // Your commands there box_use(id) // Your commands there } } |
Re: IN_USE -> Execute command
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:
|
Re: IN_USE -> Execute command
Quote:
|
Re: IN_USE -> Execute command
Quote:
|
Re: IN_USE -> Execute command
Quote:
|
| All times are GMT -4. The time now is 09:31. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.