| OneMoreLevel |
05-15-2010 14:56 |
Re: Dictionary isnt working.
Oops, sorry guys, I was sending you the wrong plugin, here's the real one:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <engine> #include <fun>
#define PLUGIN "Deathrun Shop" #define VERSION "1.1" #define AUTHOR "OneMoreLevel"
new pluginENABLE
new shopLimit = 0;
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd( "say /shop","deathrun_shop") pluginENABLE = register_cvar("shop_enable", "1"); register_event("DeathMsg","Hook_DeathMsg","a") register_dictionary( "deathrun_shop.txt") }
public deathrun_shop(id){ new menu = menu_create("\rDeathrun Shop", "menu_handler"); menu_additem(menu, "\wMore Speed - 1500$", "1", 0); menu_additem(menu, "\wLess Gravity - 2500$", "2", 0); menu_additem(menu, "\w75% Invisibility - 2000$", "3", 0); menu_additem(menu, "\wDual Elites - 4000$", "4", 0); menu_additem(menu, "\wSmoke Grenade - 2500$", "5", 0); menu_additem(menu, "\wFlashbang - 2500$", "6", 0); if (get_pcvar_num(pluginENABLE)) { menu_display(id, menu, 0); } else { client_print(id, print_chat, "%L", id, "PLUGIN_DISABLED") } } public menu_handler(id,menu,item){ if (item == MENU_EXIT ) { menu_destroy(menu); } // Here are the data functions and variables 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: { // Print the message and destroy the menu if (cs_get_user_money(id) >= 750) { shopLimit ++; if (shopLimit < 4){ client_print(id, print_chat, "%L", id, "INCREASE_SPEED") cs_set_user_money(id, cs_get_user_money(id) - 750) set_user_maxspeed(id, get_user_maxspeed(id) + 100) } else if (shopLimit > 3){ } client_print(id, print_chat, "%L", id, "LIMIT_REACHED") } else { client_print(id, print_chat, "%L", id, "INSUFFICIENT_CASH") } } case 2: { if(cs_get_user_money(id) >= 1250) { shopLimit ++; if (shopLimit < 4){ client_print(id, print_chat, "%L", id, "DECREASE_GRAVITY") cs_set_user_money(id, cs_get_user_money(id) - 1250) set_user_gravity(id, get_user_gravity(id) - 0.1) } else if (shopLimit > 3) { } client_print(id, print_chat, "%L", id, "LIMIT_REACHED") } else { client_print(id, print_chat, "%L", id, "INSUFFICIENT_CASH") } } case 3: { if(cs_get_user_money(id) >= 1000) { shopLimit ++; if (shopLimit < 4){ client_print(id, print_chat, "%L", id, "INVISIBILITY_ON") set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 65) cs_set_user_money(id, cs_get_user_money(id) - 1000) } else if (shopLimit > 3) { } client_print(id, print_chat, "%L", id, "LIMIT_REACHED") } else { client_print(id, print_chat, "%L", id, "INSUFFICIENT_CASH") } } case 4: { if(cs_get_user_money(id) >= 2000) { shopLimit ++; if (shopLimit < 4){ client_print(id, print_chat, "%L", id, "GIVE_DUALIES") give_item(id, "weapon_elite") cs_set_user_bpammo (id, CSW_ELITE, 120) cs_set_user_money(id, cs_get_user_money(id) - 2000) } else if (shopLimit > 3) { } client_print(id, print_chat, "%L", id, "LIMIT_REACHED") } else { client_print(id, print_chat, "%L", id, "INSUFFICIENT_CASH") } } case 5: { if(cs_get_user_money(id) >= 2500) { shopLimit ++; if (shopLimit < 4){ client_print(id, print_chat, "%L", id, "GIVE_ONE_SMOKEG") cs_set_user_money(id, cs_get_user_money(id) - 2500) give_item(id, "weapon_smokegrenade") } else if (shopLimit > 3){ } client_print(id, print_chat, "%L", id, "LIMIT_REACHED") } else { client_print(id, print_chat, "%L", id, "INSUFFICIENT_CASH") } } case 6: { if(cs_get_user_money(id) >= 2500) { shopLimit ++; if (shopLimit < 4){ client_print(id, print_chat, "%L", id, "GIVE_ONE_FLASHBANG") client_print(id, print_chat, "[Deathrun] You have been granted one flashbang."); cs_set_user_money(id, cs_get_user_money(id) - 2500) give_item(id, "weapon_flashbang") } else if (shopLimit > 3) { } client_print(id, print_chat, "%L", id, "LIMIT_REACHED") } else { client_print(id, print_chat, "%L", id, "INSUFFICIENT_CASH") } } } // Kill the menu, and make a return. menu_destroy(menu); return PLUGIN_HANDLED; }
public HookDeathMsg(){ shopLimit = 0; }
|