AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Limiting items (https://forums.alliedmods.net/showthread.php?t=299988)

RAW_192 08-01-2017 09:50

Limiting items
 
PHP Code:

public mh_MyMenu(idmenuitem)
{         
if(
item == MENU_EXIT)
{
menu_cancel(id);
return 
PLUGIN_HANDLED;
}
new 
money =  get_user_point(id
new 
command[6], name[64], accesscallback;
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

switch(
item)
{
case 
0:
{
if(
g_hasitem[id] == true)
{
client_print(id,"You already have one item")
return;
}
else ( 
get_user_point(id) >= 150)
{
g_hasitem[id] == true
}
case 
1:
{
if(
g_hasitem[id] == true)
{
return;
client_print(id,"You already have one item")
}
else( 
get_user_point(id) >= 100)
{
....    
g_hasitem[id] == true;
}
}
menu_destroy(menu);

return 
PLUGIN_HANDLED;




I am trying to limit items to players .. i.e if player buys one item he cant buy other

But when im using this method im unable to buy anything .. Everytime i buy it shows you already have one item


Also is there any way i can show Points of players below menu

EX:

Quote:

Menu
Your Coins : ... Coins

1.
2.

One last error is im using \r to make it color as in the guide of article [New Amxx Menu System]

But its not working

Natsheh 08-01-2017 11:14

Re: Limiting items
 
Basics mistakes

Firstly
Spoiler


Secondary
Spoiler


Each item should has its own data(variable/boolean)..

Ayman Khaled 08-01-2017 13:37

Re: Limiting items
 
if(item == MENU_EXIT)
{
menu_cancel(id);
return PLUGIN_HANDLED;
}
why not to destroy instead of cancel

RAW_192 08-04-2017 07:18

Re: Limiting items
 
Thanks Natsheh ... Silly mistakes :|

Btw can you also tell about the other two issues ?


1) Also is there any way i can show Points of players below menu

EX:
Quote:

Menu
Your Coins : ...

1)
2)
2) Using color on menu .. \r \w didn't work


All times are GMT -4. The time now is 23:03.

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