Raised This Month: $ Target: $400
 0% 

Max Usage Of A Item In Shop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 03-24-2021 , 15:34   Re: Max Usage Of A Item In Shop
Reply With Quote #1

Can u define me with some examples? it would be great.
__________________
Facebook
My YouTube
Ro{Y}aL WarLanD CommuniTy
Selling Zombie CSO 4.3 Money System Mod
DON KHAN 1 is offline
Crackhead69
Member
Join Date: Feb 2021
Old 03-25-2021 , 06:35   Re: Max Usage Of A Item In Shop
Reply With Quote #2

That's just one way of doing it
PHP Code:
#include <amxmodx>

new ItemUsed // its purpose is Global
new ItemId[33// its purpose is to hold the items

public plugin_init()    
    
register_clcmd"say /menu","AwesomeMenu" );

public 
AwesomeMenuid )
{
    new 
menu menu_create"Look at this awesome Menu!:""menu_handler" );

    
menu_additemmenu"I'm Selection #1""");
    
menu_additemmenu"I'm Selection #2""");

    
menu_setpropmenuMPROP_EXITMEXIT_ALL );

    
menu_displayidmenu);

}

public 
menu_handleridmenuitem )
{
    if(
ItemId[item] == ItemUsed//if the selected item equals 5 (gItemUsed) we return
    
{
        
client_print(id,print_chat,"Limit reached")
        return
    }
    
    
ItemId[item]++ //we increase the picked item's number by 1

    
switch(item)
    {
        case 
0:client_printidprint_chat"Item 1 can be used: %i/%i times"ItemId[item],ItemUsed)
        case 
1:client_printidprint_chat"Item 2 can be used: %i/%i times"ItemId[item],ItemUsed)
    }

Crackhead69 is offline
Reply


Thread Tools
Display Modes

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 23:47.


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