Raised This Month: $51 Target: $400
 12% 

limit help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 08-15-2022 , 20:19   limit help
Reply With Quote #1

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]
QuickDroLLL is offline
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
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 08-16-2022 , 07:05   Re: limit help
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
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.
QuickDroLLL is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:02.


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