Veteran Member
Join Date: Apr 2017
Location: Brazil
|
12-09-2020
, 22:05
Re: Limit
|
#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 CvarMoney, CvarArmor
new UsedItem[33][2]
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) 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(iPlayers, iNum) for(new i; i < iNum; i++) { 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_alive( id ) ) { client_printc( id, "!gYou must be alive to Use Shop."); return PLUGIN_HANDLED; } new text[ 100 ] new iMoney = cs_get_user_money(id) formatex( text, charsmax( text ), "\rSuper Vip Shop \w| \d[\wYoure Money: \y%i \y$\d]^n\d[Coded By Heisenberg] \rPage:", iMoney ) new menu = menu_create( text, "shop_handler" ) menu_additem(menu, "\w100 Hp \d[\r1000 \y$\d]", "1", cs_get_user_money(id) >= 1000 ? 0 : 1<<31); menu_additem(menu, "\w100 Armor \d[\r1000 \y$\d]", "2", cs_get_user_money(id) >= 1000 ? 0 : 1<<31); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu, 0); return PLUGIN_HANDLED; }
public shop_handler(id, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); return PLUGIN_HANDLED; } new name[32] get_user_name(id, name, 31) new data[6], iName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); 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(id, cs_get_user_money(id) - 1000); set_user_health(id, get_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(id, cs_get_user_money(id) - 1000); set_user_armor(id, get_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 = 1, players[32]; static msg[191]; vformat(msg, 190, input, 3); replace_all(msg, 190, "!g", "^x04"); // Green Color replace_all(msg, 190, "!n", "^x01"); // Default Color replace_all(msg, 190, "!t", "^x03"); // Team Color if (id) players[0] = id; else get_players(players, count, "ch"); { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } } }
__________________
Quote:
Originally Posted by fysiks
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.
|
|