AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can we use IN_* keys in menus? (https://forums.alliedmods.net/showthread.php?t=339555)

kww 09-17-2022 11:28

Can we use IN_* keys in menus?
 
Can we use IN_* keys in menus?
Example: I have some item on slot 1 and it will do something if I press slot1. Can I do check if player holds IN_RUN (on another key) pressed and slot1 to do another action?
https://i.ibb.co/QdVFx8F/image.png

jimaway 09-17-2022 11:47

Re: Can we use IN_* keys in menus?
 
store it in a global variable?

kww 09-17-2022 13:36

Re: Can we use IN_* keys in menus?
 
Quote:

Originally Posted by jimaway (Post 2789020)
store it in a global variable?

what do you mean?

zXCaptainXz 09-17-2022 14:26

Re: Can we use IN_* keys in menus?
 
(get_user_button(id)&IN_RUN) (or IN_SPEED was it?) will be true if the player is holding shift, so add that check in your handler function

something like this

public menu_handler(id, key)
{
if(get_user_button(id)&IN_RUN))//shift held
{
switch(key){
case 1://if 1 + SHIFT pressed
case 2://if 2 + SHIFT pressed
//...
}
}
else
{
switch(key){
case 1: // if 1 only pressed
case 2: // if 2 only pressed
}
}


All times are GMT -4. The time now is 15:35.

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