AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   limit help (https://forums.alliedmods.net/showthread.php?t=339095)

QuickDroLLL 08-15-2022 20:19

limit help
 
hello every one, so can some one help me in how to add limit on a menu per map

like 1. Oh cool gun [1/2]

Bugsy 08-15-2022 22:24

Re: limit help
 
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 );



QuickDroLLL 08-16-2022 07:05

Re: limit help
 
Quote:

Originally Posted by Bugsy (Post 2786554)
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 );



Thank you.


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

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