Raised This Month: $ Target: $400
 0% 

IN_USE -> Execute command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
organnerX
New Member
Join Date: Jan 2016
Old 01-24-2016 , 07:25   IN_USE -> Execute command
Reply With Quote #1

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
organnerX is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-24-2016 , 07:58   Re: IN_USE -> Execute command
Reply With Quote #2

Better way is to edit your plugin as this parachute plugin to use the 'use' button command as/instead of 'use_box'.

See:
  1. You can use this to teach:

__________________
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 22:55. Reason: Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
addons_zz is offline
organnerX
New Member
Join Date: Jan 2016
Old 01-24-2016 , 08:12   Re: IN_USE -> Execute command
Reply With Quote #3

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
}
}

Last edited by organnerX; 01-24-2016 at 08:18.
organnerX is offline
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 #4

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
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-24-2016 , 11:26   Re: IN_USE -> Execute command
Reply With Quote #5

Quote:
Originally Posted by addons_zz View Post
Better way is to edit your plugin as this parachute plugin to use the 'use' button command as/instead of 'use_box'.

See:
  1. Admin Slowhacking
  2. Why slowhacking, etc, is bad.
  3. Slow Hacking
  4. Valve's Policy of Truth: Valve to crack down on servers that fake info to players
You can use this to teach:
how exactly do you consider his request slowhacking?

Last edited by jimaway; 01-24-2016 at 11:26.
jimaway is offline
Old 01-24-2016, 11:28
addons_zz
This message has been deleted by addons_zz. Reason: Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-24-2016 , 14:38   Re: IN_USE -> Execute command
Reply With Quote #6

You are becoming the new Antichristus and it's very annoying.
__________________

Last edited by fysiks; 01-24-2016 at 14:38.
fysiks is offline
Old 01-24-2016, 14:41
addons_zz
This message has been deleted by addons_zz. Reason: Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
JusTGo
Veteran Member
Join Date: Mar 2013
Old 01-25-2016 , 03:51   Re: IN_USE -> Execute command
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
You are becoming the new Antichristus and it's very annoying.
lol
__________________
JusTGo is offline
Reply



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