| Napoleon_be |
09-19-2011 15:38 |
pcvar help.
Like almost everyone knows, i'm making the JailBreakShop. I want to add a pcvar wich enables & disables the shop, but i don't know how i should call it in a function. Can someone help me?
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <cstrike> #include <fun> #include <colorchat> #include <dhudmessage>
new const PLUGIN[] = "JailBreakShop" new const VERSION[] = "v1.0" new const AUTHOR[] = "NapoleoN#"
new const g_szPrefix[] = "^x04[JB-Shop]^x01" new const JBINFO[] = "jbinfo.html" new const CMD[] = "commands.html"
new g_pEnableShop new g_pEnableInfo new g_pEnableCommands new g_pEnableGamble
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /jbshop", "JailBreakShop") register_clcmd("say /shop", "JailBreakShop") register_clcmd("say /jailbreakshop", "JailBreakShop") register_clcmd("say_team /jbshop", "JailBreakShop") register_clcmd("say_team /shop", "JailBreakShop") register_clcmd("say_team /jailbreakshop", "JailBreakShop") register_clcmd("say /jbinfo", "JailBreakInfo") register_clcmd("say_team /jbinfo", "JailBreakInfo") register_clcmd("say /info", "JailBreakInfo") register_clcmd("say_team /info", "JailBreakInfo") register_clcmd("say /commands", "Commands") register_clcmd("say /cmds", "Commands") register_clcmd("say_team /commands", "Commands") register_clcmd("say_team /cmds", "Commands") register_clcmd("say /gamble", "gamble") register_clcmd("say /rtd", "gamble") register_clcmd("say_team /gamble", "gamble") register_clcmd("say_team /rtd", "gamble") g_pEnableShop = register_cvar("jb_shop", "1", FCVAR_SERVER) g_pEnableInfo = register_cvar("jb_info", "1", FCVAR_SERVER) g_pEnableCommands = register_cvar("jb_commands", "1", FCVAR_SERVER) g_pEnableGamble = register_cvar("jb_gamble", "1", FCVAR_SERVER) }
public JailBreakShop(id) { if(cs_get_user_team(id)==CS_TEAM_T && is_user_alive(id)) { new ShopMenu = menu_create("\rJailBreak \yShop \wMenu:", "shop_handler") menu_additem(ShopMenu, "Deagle (7 Bullets) - \y3000$", "1", id) menu_additem(ShopMenu, "Gravity (600) - \y2000$", "2", id) menu_additem(ShopMenu, "Speed - \y1500$", "3", id) menu_additem(ShopMenu, "Regenerate to 100 HP - \y4000$", "4", id) menu_additem(ShopMenu, "Disable Footsteps - \y2000$", "5", id) menu_additem(ShopMenu, "Invisebility 60 Seconds - \y6000$", "6", id) menu_additem(ShopMenu, "Roll the dice!", "7", id) menu_display(id, ShopMenu, 0) menu_setprop(ShopMenu, MPROP_EXIT, MEXIT_ALL) } else if(cs_get_user_team(id)==CS_TEAM_CT && is_user_alive(id)) { new menu = menu_create("\rJailBreak \yShop \wMenu:", "menu_handler") menu_additem(menu, "Roll the dice!", "1", id) menu_display(id, menu, 0) menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) } }
public shop_handler(id, ShopMenu, item) { new money = cs_get_user_money(id) if(is_user_alive(id) && cs_get_user_team(id)==CS_TEAM_T) { switch(item) { case 0: { if(money >= 3000) { new setmoney = money - 3000 cs_set_user_money(id, clamp(setmoney, 0, 16000)) give_item(id, "weapon_deagle") ColorChat(id, TEAM_COLOR, "%s You received a^x03 deagle^x01 with 7 bullets!", g_szPrefix) } else { ColorChat(id, TEAM_COLOR, "%s You do not have enough money to buy this item!", g_szPrefix) } return PLUGIN_CONTINUE } case 1: { if(money >= 2000) { new setmoney = money - 2000 cs_set_user_money(id, clamp(setmoney, 0, 16000)) set_user_gravity(id, 0.7) ColorChat(id, TEAM_COLOR, "%s You have now 600 Gravity!", g_szPrefix) } else { ColorChat(id, TEAM_COLOR, "%s You do not have enough money to buy this item!", g_szPrefix) } return PLUGIN_CONTINUE } case 2: { if(money >= 1500) { new setmoney = money - 1500 cs_set_user_money(id, clamp(setmoney, 0, 16000)) set_user_maxspeed(id, 320.0) ColorChat(id, TEAM_COLOR, "%s You have now more speed and you're ready to rebel!", g_szPrefix) } else { ColorChat(id, TEAM_COLOR, "%s You do not have enough money to buy this item!", g_szPrefix) } return PLUGIN_CONTINUE } case 3: { if(money >= 4000) { new setmoney = money - 4000 cs_set_user_money(id, clamp(setmoney, 0, 16000)) set_user_health(id, 100) ColorChat(id, TEAM_COLOR, "%s You regenerated your health to 100!", g_szPrefix) } else { ColorChat(id, TEAM_COLOR, "%s You do not have enough money to buy this item!", g_szPrefix) } return PLUGIN_CONTINUE } case 4: { if(money >= 2000) { new setmoney = money - 2000 cs_set_user_money(id, clamp(setmoney, 0, 16000)) set_user_footsteps(id, 1) ColorChat(id, TEAM_COLOR, "%s You don't have any footsteps anymore!", g_szPrefix) } else { ColorChat(id, TEAM_COLOR, "%s You do not have enough money to buy this item!", g_szPrefix) } return PLUGIN_CONTINUE } case 5: { if(money >= 6000) { new setmoney = money - 6000 cs_set_user_money(id, clamp(setmoney, 0, 16000)) set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 15); ColorChat(id, TEAM_COLOR, "%s You are now invisable for 60 seconds!", g_szPrefix) set_task(60.0, "RemoveInvis", id) } else { ColorChat(id, TEAM_COLOR, "%s You do not have enough money to buy this item!", g_szPrefix) } return PLUGIN_CONTINUE } case 6: { gamble(id) } } } return PLUGIN_HANDLED }
public client_putinserver(id) { set_task(10.0, "ShowMessage", id) set_task(20.0, "ShowInfo", id) }
public ShowMessage(id) { if(is_user_connected(id)) { new szName[32]; get_user_name(id, szName, charsmax(szName)) ColorChat(id, TEAM_COLOR, "%s Welcome to the server, ^x04[%s]^x01!", g_szPrefix, szName) } }
public RemoveInvis(id) { if(is_user_alive(id)) { set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255) ColorChat(id, TEAM_COLOR, "%s You are not invisable anymore!", g_szPrefix) } }
public JailBreakInfo(id) { if(is_user_connected(id)) { show_motd(id, JBINFO, "JailBreak Shop Information!") } }
public ShowInfo(id) { if(is_user_connected(id)) { ColorChat(id, TEAM_COLOR, "%s Type /info to check out the information about the JB Shop!", g_szPrefix) } }
public Commands(id) { if(is_user_connected(id)) { show_motd(id, CMD, "JailBreak Shop Commands!") } }
public gamble(id) { new money = cs_get_user_money(id) if(money >= 500) { new Playernum = random_num(1, 100) new Servernum = random_num(25, 100) if(Playernum > Servernum) { new szName[32]; get_user_name(id, szName, charsmax(szName)) new setmoney = money + 500 cs_set_user_money(id, clamp(setmoney, 0, 50000)) ColorChat(id, TEAM_COLOR, "%s %s has won the^x03 dice!^x04 %i^x01 versus^x04 %i", g_szPrefix, szName, Playernum, Servernum) } else if(Servernum > Playernum) { if(money >= 500 ) { new setmoney = money - 500 cs_set_user_money(id, clamp(setmoney, 0, 50000)) ColorChat(id, TEAM_COLOR, "%s Server! has won the ^x03 dice!^x04 %i^x01 versus^x03 %i", g_szPrefix, Servernum, Playernum) } } } else { ColorChat(id, TEAM_COLOR, "%s You need atleast 500$ to gamble!", g_szPrefix) } return PLUGIN_CONTINUE }
public menu_handler(id, menu, item) { if(is_user_alive(id) && cs_get_user_team(id)==CS_TEAM_CT) { switch(item) { case 0: { gamble(id) } } } else { new szName[32]; get_user_name(id, szName, charsmax(szName)) ColorChat(id, TEAM_COLOR, "%s You have to be alive to enter the Shop, %s!", g_szPrefix, szName) } }
public enableshop(id) { if(get_pcvar_num(g_pEnableShop)) { } if(!get_pcvar_num(p_enableShop)) { } }
|