|
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
|
08-16-2022
, 07:05
Re: limit help
|
#3
|
Quote:
Originally Posted by Bugsy
Create an array sized using MAX_PLAYERS + 1
Each time the menu is used by the player, increment it by one.
When you go to show the map, first check that they are below the count.
All variables are automatically reset to 0 on map change.
PHP Code:
const MAX_MENU = 2;
new g_MenuUsed[ MAX_PLAYERS + 1 ];
//your menu command
if ( g_MenuUsed[ id ] < MAX_MENU )
{
//menu code
g_MenuUsed[ id ]++;
client_print( id , print_chat , "* Cool gun, buddy. %d/%d" , g_MenuUsed[ id ] , MAX_MENU );
}
else
{
client_print( id , print_chat , "* You already used the menu %d times" , MAX_MENU );
}
|
Thank you.
|
|
|
|