AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove Menu Keys(cvar) (https://forums.alliedmods.net/showthread.php?t=134731)

Ex3cuTioN 08-08-2010 03:00

Remove Menu Keys(cvar)
 
Hi,

I have a problem, and i don't know how to solve it.
I have a menu with 3 options.

1.He grenade
2.Flash grenade
3.Smoke grenade

I have 3 cvars

amx_he_on 1
amx_flash_on 0
amx_smoke_on 0

And i want to remove the specified key if the cvar is 0 for the specified grenade.

Now you see the keys, from my cvars 1(on-enabled), and 2(off-disabled)
PHP Code:

new keys = (1<<1<<1<<2  1<<9);
show_menu(idkeysmenuBody, -1"Shop"); 

I want when i press 2 or 3 to do nothing.

A stupid methode will be

PHP Code:

new keys = (if(get_pcvar_num(he_on)) {1<<0} | 1<<1<<2  1<<9); 

Of course that dosen't work.

How can i remove keys with a cvar ?

Ex3cuTioN 08-09-2010 03:40

Re: Remove Menu Keys(cvar)
 
Nobody ? :)

Leon M. 08-09-2010 05:28

Re: Remove Menu Keys(cvar)
 
Hi

1. You should show us your code that is easier for us to help you.
2. Why you want to remove the keys? Add only keys that are used.

Example:
PHP Code:

new keys = (1<<9)
if (
get_pcvar_num(he_on)) keys |= (1<<0)
if (
get_pcvar_num(flash_on)) keys |= (1<<1)
if (
get_pcvar_num(smoke_on)) keys |= (1<<2



All times are GMT -4. The time now is 00:14.

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