Thread: limit help
View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-15-2022 , 22:24   Re: limit help
Reply With Quote #2

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_MenuUsedMAX_PLAYERS ];

//your menu command
if ( g_MenuUsedid ] < MAX_MENU )
{
    
//menu code
    
g_MenuUsedid ]++;
    
client_printid print_chat "* Cool gun, buddy. %d/%d" g_MenuUsedid ] , MAX_MENU );
}
else
{
    
client_printid print_chat "* You already used the menu %d times" MAX_MENU );

__________________

Last edited by Bugsy; 08-15-2022 at 22:25.
Bugsy is offline