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

Solved Limit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ho83
Senior Member
Join Date: Aug 2020
Location: iran
Old 12-09-2020 , 18:24   Limit
Reply With Quote #1

Hi i like this menu can use:
Quote:
1.item1 can use 2 time in round
2.item2 can use 3time in round
Code:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>

#define PLUGIN " Shop"
#define VERSION "1.0"
#define AUTHOR "mmd" 

#define ADMIN_JBVIP ADMIN_LEVEL_F

new const PREFIX[] = { "!g[!tShop!g]!n" };

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd("say /shop""Vipshop");
}

public 
Vipshop(id)
{
    if(!(
get_user_flags(id) & ADMIN_JBVIP))
    {
        
client_printc(id"!tYou dont Have access")
        
        return 
PLUGIN_HANDLED;
    }
    if( !
is_user_aliveid ) )
    {
        
client_printcid"!gYou must be alive to Use Shop.");
        return 
PLUGIN_HANDLED;
    }
    new 
text100 ]
    new 
iMoney cs_get_user_money(id)
         
formatextextcharsmaxtext ), "\rSuper Vip Shop \w| \d[\wYoure Money: \y%i \y$\d]^n\d[Coded By Heisenberg] \rPage:"iMoney )

         new 
menu menu_createtext"shop_handler" )

    
menu_additem(menu"\w100 Hp \d[\r1000 \y$\d]""1"cs_get_user_money(id) >= 1000 1<<31);
    
menu_additem(menu"\w100 Armor \d[\r1000 \y$\d]""2"cs_get_user_money(id) >= 1000 1<<31);
    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
shop_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
name[33]
         
get_user_name(idname32)
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            
cs_set_user_money(idcs_get_user_money(id) - 1000);
            
set_user_health(idget_user_health(id) + 100);
        }
        case 
2:
        {
            
cs_set_user_money(idcs_get_user_money(id) - 1000);            
            
set_user_armor(idget_user_armor(id) + 100);
            
        }    
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

// Colour Chat
stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1065\\ f0\\ fs16 \n\\ par }
*/ 
Thanks.

Last edited by ho83; 12-10-2020 at 09:17.
ho83 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 12-09-2020 , 22:05   Re: Limit
Reply With Quote #2

It is not the best method, creating a 2d variable, but it works well, if you prefer you can create new UsedMoney[33] and UsedArmor[33] and follow through with the rest of the code, it's the same.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>

#define PLUGIN " Shop"
#define VERSION "1.0"
#define AUTHOR "mmd" 

#define ADMIN_JBVIP ADMIN_LEVEL_F

new const PREFIX[] = { "!g[!tShop!g]!n" };
new 
CvarMoneyCvarArmor

new UsedItem[33][2]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /shop""Vipshop");
    
CvarMoney register_cvar("amx_limit_money""1")
    
CvarArmor register_cvar("amx_limit_armor""1")
    
register_event("HLTV","EventNewRnd""a""1=0""2=0")
}

public 
client_putinserver(id)
{
    
UsedItem[id][0] = 0
    UsedItem
[id][1] = 0
}

public 
EventNewRnd()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum)
    for(new 
iiNumi++)
    {
        
UsedItem[iPlayers[i]][0] = 0
        UsedItem
[iPlayers[i]][1] = 0
    
}
}

public 
Vipshop(id)
{
    if(!(
get_user_flags(id) & ADMIN_JBVIP))
    {
        
client_printc(id"!tYou dont Have access")
        
        return 
PLUGIN_HANDLED;
    }
    if( !
is_user_aliveid ) )
    {
        
client_printcid"!gYou must be alive to Use Shop.");
        return 
PLUGIN_HANDLED;
    }
    new 
text100 ]
    new 
iMoney cs_get_user_money(id)
    
formatextextcharsmaxtext ), "\rSuper Vip Shop \w| \d[\wYoure Money: \y%i \y$\d]^n\d[Coded By Heisenberg] \rPage:"iMoney )
    
    new 
menu menu_createtext"shop_handler" )
    
    
menu_additem(menu"\w100 Hp \d[\r1000 \y$\d]""1"cs_get_user_money(id) >= 1000 1<<31);
    
menu_additem(menu"\w100 Armor \d[\r1000 \y$\d]""2"cs_get_user_money(id) >= 1000 1<<31);
    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
shop_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[32]
    
get_user_name(idname31)
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if(
UsedItem[id][0] >= get_pcvar_num(CvarMoney))
            {
                
//Message blocking
                
goto @FINAL_FUNCTION
            
}
            
cs_set_user_money(idcs_get_user_money(id) - 1000);
            
set_user_health(idget_user_health(id) + 100);
            
UsedItem[id][0]++
        }
        case 
2:
        {
            if(
UsedItem[id][1] >= get_pcvar_num(CvarArmor))
            {
                
//Message blocking
                
goto @FINAL_FUNCTION
            
}
            
cs_set_user_money(idcs_get_user_money(id) - 1000);            
            
set_user_armor(idget_user_armor(id) + 100);
            
UsedItem[id][1]++
            
        }
        
    }
    @
FINAL_FUNCTION:
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

// Colour Chat
stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 12-10-2020 at 00:15.
iceeedr is offline
Send a message via Skype™ to iceeedr
ho83
Senior Member
Join Date: Aug 2020
Location: iran
Old 12-10-2020 , 06:39   Re: Limit
Reply With Quote #3

Thank you sir.
ho83 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 13:02.


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