AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   uc_buttons help (https://forums.alliedmods.net/showthread.php?t=232155)

ezio_auditore 12-26-2013 11:59

uc_buttons help
 
how to check whether the user pressed drop weapon button <default g> via uc_buttons...

akcaliberg 12-26-2013 12:29

Re: uc_buttons help
 
There is not "uc_button" for that. You should just register the "drop" command as a client command.

register_clcmd("drop","HookDrop");

ezio_auditore 12-26-2013 12:41

Re: uc_buttons help
 
so...
PHP Code:

register_logevent("drop","hookDrop")
// in plugin init
 
public hookDrop(id)
client_print(id,print_chat,"you dropped a weapon"); 

is correct

ConnorMcLeod 12-26-2013 12:46

Re: uc_buttons help
 
It is correct as long as you don't care if dropped weapon is the active weapon or another one including shield.

ezio_auditore 12-26-2013 12:50

Re: uc_buttons help
 
thank you sir ConnorMcLeod and akcaliberg

akcaliberg 12-26-2013 15:33

Re: uc_buttons help
 
drop is not a logevent

Use: register_clcmd

ezio_auditore 12-26-2013 23:57

Re: uc_buttons help
 
and what to use if i want to detect user's weapon switch <default q>

ConnorMcLeod 12-27-2013 05:35

Re: uc_buttons help
 
default q, or whatever the key, is bound to command "drop", you can hook that command as you do, but you may have to check if command has arguments that could make drop another weapon than the active one, or without arguments it could make drop player shield if player has one.

fysiks 12-27-2013 06:00

Re: uc_buttons help
 
Quote:

Originally Posted by ezio_auditore (Post 2076868)
and what to use if i want to detect user's weapon switch <default q>

That command is not sent to the server, the game simply sends the command to change to a different weapon.

ezio_auditore 12-27-2013 06:56

Re: uc_buttons help
 
Quote:

Originally Posted by akcaliberg (Post 2076650)
There is not "uc_button" for that. You should just register the "drop" command as a client command.

register_clcmd("drop","HookDrop");


but suppose if user is holding CSW_M4A1, how can i avoid user to drop it


All times are GMT -4. The time now is 10:12.

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