HELP with shop plugin
Guys, can anyone please help i have this plugin. But i have no idea how i can change that some items are not only for one round, but till death. Anyone?
PHP Code:
#define PLUGIN_NAME "Custom Shop" #define PLUGIN_VERSION "1.1" #define PLUGIN_AUTHOR "NEC"
#define SHOP_ACCESS ADMIN_RESERVATION #define m_pActiveItem 373
#define sNo "buttons/button11.wav" #define sOver "buttons/blip2.wav"
new const szPrefix[] = "^4[Custom Shop]"
enum Color { NORMAL = 1, // clients scr_concolor cvar color GREEN, // Green Color TEAM_COLOR, // Red, grey, blue GREY, // grey RED, // Red BLUE, // Blue }
new TeamName[][] = { "", "TERRORIST", "CT", "SPECTATOR" }
new const g_playerModels[][] = { "arctic", "guerilla", "leet", "terror", "gign", "gsg9", "sas", "urban" }
new const g_itemSounds[][] = { "items/smallmedkit1.wav", // Item "a": +50 Health [1000$] "items/ammopickup2.wav", // Item "b": +50 Armor [1000$] "items/gunpickup2.wav", // Item "c": Unlimited Clip [3000$] "items/gunpickup2.wav", // Item "d": Unlimited Ammo [200$] "items/gunpickup2.wav", // Item "e": All Grenades [800$] "x/x_pain2.wav", // Item "f": Bomber [1600$] "items/gunpickup2.wav", // Item "g": Silent Footsteps [3000$] "misc/bipbip.wav", // Item "h": Faster Speed [4300$] "items/gunpickup2.wav", // Item "i": Low Gravity [2800$] "items/gunpickup2.wav", // Item "j": Chameleon [9000$] "items/gunpickup2.wav", // Item "k": Drugs (Speed + Health) [8000$] "items/gunpickup2.wav", // Item "l": Transparency [2500$] "hornet/ag_buzz1.wav", // Item "m": Invisibility (15 Seconds) [16000$] "items/gunpickup2.wav", // Item "n": Double Damage [10000$] "misc/stinger12.wav", // Item "o": GodMode (5 Seconds) [16000$] "items/suitchargeok1.wav", // Item "p": Health Regeneration [1800$] "items/suitchargeok1.wav" // Item "q": Armor Regeneration [2000$] }
new DisabledItems, VIPOnly, gmsg_SetFOV new HealthAmmount, HealthPrize, ArmorAmmount, ArmorPrize, UnlimitedClipPrize, UnlimitedAmmoPrize, AllGrenadesPrize, BomberPrize, BomberAmmount, SilentFootstepsPrize new FasterSpeedAmmount, FasterSpeedPrize, LowGravityAmmount, LowGravityPrize, ChameleonPrize, DrugsSpeedAmmount, DrugsHealthAmmount, DrugsPrize new TransparencyAmmount, TransparencyPrize, InvisibilityTime, InvisibilityPrize, DoubleDamagePrize, GodModeTime, GodModePrize, HealthRegenAmmount, HealthRegenTime new HealthRegenMax, HealthRegenPrize, ArmorRegenAmmount, ArmorRegenTime, ArmorRegenMax, ArmorRegenPrize new InfoMessageEnabled, InfoMessageTime, ShopEquip
new cantactivate[33] new cshop_speed[33], cshop_ddamage[33], cshop_healthregen[33], cshop_armorregen[33]
public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) register_dictionary("custom_shop.txt") register_event("CurWeapon", "change_weapon", "be", "1=1") RegisterHam(Ham_Spawn, "player", "ham_spawn", 1) RegisterHam(Ham_TakeDamage, "player", "ham_damage") register_clcmd("say /shop", "cshop_main") register_clcmd("say_team /shop", "cshop_main") DisabledItems = register_cvar("customshop_disableditems", "") VIPOnly = register_cvar("customshop_viponly", "0") HealthAmmount = register_cvar("customshop_health_ammount", "50") HealthPrize = register_cvar("customshop_health_prize", "1500") ArmorAmmount = register_cvar("customshop_armor_ammount", "100") ArmorPrize = register_cvar("customshop_armor_prize", "1000") UnlimitedClipPrize = register_cvar("customshop_unlclip_prize", "3000") UnlimitedAmmoPrize = register_cvar("customshop_unlammo_prize", "200") AllGrenadesPrize = register_cvar("customshop_allgrenades_prize", "800") BomberPrize = register_cvar("customshop_bomber_prize", "1600") BomberAmmount = register_cvar("customshop_bomber_ammount", "20") SilentFootstepsPrize = register_cvar("customshop_silentsteps_prize", "3000") FasterSpeedAmmount = register_cvar("customshop_fasterspeed_ammount", "300.0") FasterSpeedPrize = register_cvar("customshop_fasterspeed_prize", "4300") LowGravityAmmount = register_cvar("customshop_lowgravity_ammount", "0.5") LowGravityPrize = register_cvar("customshop_lowgravity_prize", "2800") ChameleonPrize = register_cvar("customshop_chameleon_prize", "9000") DrugsSpeedAmmount = register_cvar("customshop_drugs_speedammount", "300.0") DrugsHealthAmmount = register_cvar("customshop_drugs_healthammount", "200") DrugsPrize = register_cvar("customshop_drugs_prize", "8000") TransparencyAmmount = register_cvar("customshop_transparency_ammount", "75") TransparencyPrize = register_cvar("customshop_transparency_prize", "2500") InvisibilityTime = register_cvar("customshop_invisibility_time", "15.0") InvisibilityPrize = register_cvar("customshop_invisibility_prize", "16000") DoubleDamagePrize = register_cvar("customshop_doubledamage_prize", "10000") GodModeTime = register_cvar("customshop_godmode_time", "5.0") GodModePrize = register_cvar("customshop_godmode_prize", "16000") HealthRegenAmmount = register_cvar("customshop_healthregen_ammount", "1") HealthRegenTime = register_cvar("customshop_healthregen_time", "0.5") HealthRegenMax = register_cvar("customshop_healthregen_max", "150") HealthRegenPrize = register_cvar("customshop_healthregen_prize", "1800") ArmorRegenAmmount = register_cvar("customshop_armorregen_ammount", "10") ArmorRegenTime = register_cvar("customshop_armorregen_time", "0.5") ArmorRegenMax = register_cvar("customshop_armorregen_max", "150") ArmorRegenPrize = register_cvar("customshop_armorregen_prize", "2000") InfoMessageEnabled = register_cvar("customshop_infomessage_enabled", "1") InfoMessageTime = register_cvar("customshop_infomessage_time", "90.0") ShopEquip = register_cvar("customshop_buyequip", "1") if(get_pcvar_num(ShopEquip) == 1) register_clcmd("buyequip", "cshop_main") gmsg_SetFOV = get_user_msgid("SetFOV") if(get_pcvar_num(InfoMessageEnabled) == 1) set_task(get_pcvar_float(InfoMessageTime), "infoMessage", 1111, "", 0, "b", 0) }
public client_putinserver(id) { cshop_speed[id] = false cshop_ddamage[id] = false cshop_healthregen[id] = false cshop_armorregen[id] = false }
public ham_spawn(id) { cshop_speed[id] = false cshop_ddamage[id] = false cshop_healthregen[id] = false cshop_armorregen[id] = false if(is_user_alive(id)) { set_user_footsteps(id, 0) set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255) } if(is_user_connected(id)) cs_reset_user_model(id) }
public change_weapon(id) { if(cshop_speed[id]) set_user_maxspeed(id, get_pcvar_float(FasterSpeedAmmount)) }
public infoMessage() ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_INFO", PLUGIN_NAME, PLUGIN_AUTHOR)
public cshop_main(id) { if(get_pcvar_num(VIPOnly) == 1) { if(!(get_user_flags(id) & SHOP_ACCESS)) { ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOACCESS") client_cmd(id, "spk %s", sNo) return PLUGIN_HANDLED } } if(!is_user_alive(id)) { ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOTALIVE") client_cmd(id, "spk %s", sNo) return PLUGIN_HANDLED } new menu_title[200], items[30] new money = cs_get_user_money(id) get_pcvar_string(DisabledItems, items, 29) formatex(menu_title, charsmax(menu_title), "\yOciXCrom's \rCustom Shop^n\w%L: \r%i \d| \w%L:\d", LANG_SERVER, "CSHOP_MONEY", money, LANG_SERVER, "CSHOP_PAGE") new customshop = menu_create(menu_title, "cshop_handler") new item[80], close[15], back[15], next[15] if(contain(items, "a") == -1) // Item "a": +50 Health [1000$] { if(money >= get_pcvar_num(HealthPrize)) formatex(item, charsmax(item), "+\y%i \w%L \r[%i$]", get_pcvar_num(HealthAmmount), LANG_SERVER, "CSHOP_HEALTH", get_pcvar_num(HealthPrize)) else formatex(item, charsmax(item), "\d+%i %L \r[%i$]", get_pcvar_num(HealthAmmount), LANG_SERVER, "CSHOP_HEALTH", get_pcvar_num(HealthPrize)) menu_additem(customshop, item, "0", 0) } if(contain(items, "b") == -1) // Item "b": +50 Armor [1000$] { if(money >= get_pcvar_num(ArmorPrize)) formatex(item, charsmax(item), "+\y%i \w%L \r[%i$]", get_pcvar_num(ArmorAmmount), LANG_SERVER, "CSHOP_ARMOR", get_pcvar_num(ArmorPrize)) else formatex(item, charsmax(item), "\d+%i %L \r[%i$]", get_pcvar_num(ArmorAmmount), LANG_SERVER, "CSHOP_ARMOR", get_pcvar_num(ArmorPrize)) menu_additem(customshop, item, "1", 0) } if(contain(items, "c") == -1) // Item "c": Unlimited Clip [3000$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(UnlimitedClipPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_UNLCLIP", get_pcvar_num(UnlimitedClipPrize)) menu_additem(customshop, item, "2", 0) } if(contain(items, "d") == -1) // Item "d": Unlimited Ammo [200$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(UnlimitedAmmoPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_UNLAMMO", get_pcvar_num(UnlimitedAmmoPrize)) menu_additem(customshop, item, "3", 0) } if(contain(items, "e") == -1) // Item "e": All Grenades [800$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(AllGrenadesPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_ALLGRENADES", get_pcvar_num(AllGrenadesPrize)) menu_additem(customshop, item, "4", 0) } if(contain(items, "f") == -1) // Item "f": Bomber [1600$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(BomberPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_BOMBER", get_pcvar_num(BomberPrize)) menu_additem(customshop, item, "5", 0) } if(contain(items, "g") == -1) // Item "g": Silent Footsteps [3000$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(SilentFootstepsPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_SILENTSTEPS", get_pcvar_num(SilentFootstepsPrize)) menu_additem(customshop, item, "6", 0) } if(contain(items, "h") == -1) // Item "h": Faster Speed [4300$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(FasterSpeedPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_FASTERSPEED", get_pcvar_num(FasterSpeedPrize)) menu_additem(customshop, item, "7", 0) } if(contain(items, "i") == -1) // Item "i": Low Gravity [2800$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(LowGravityPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_LOWGRAVITY", get_pcvar_num(LowGravityPrize)) menu_additem(customshop, item, "8", 0) } if(contain(items, "j") == -1) // Item "j": Chameleon [9000$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(ChameleonPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_CHAMELEON", get_pcvar_num(ChameleonPrize)) menu_additem(customshop, item, "9", 0) } if(contain(items, "k") == -1) // Item "k": Drugs (Speed + Health) [8000$] { if(money >= get_pcvar_num(DrugsPrize)) formatex(item, charsmax(item), "%L \y(%L) \r[%i$]", LANG_SERVER, "CSHOP_DRUGS", LANG_SERVER, "CSHOP_DRUGS2", get_pcvar_num(DrugsPrize)) else formatex(item, charsmax(item), "\d%L (%L) \r[%i$]", LANG_SERVER, "CSHOP_DRUGS", LANG_SERVER, "CSHOP_DRUGS2", get_pcvar_num(DrugsPrize)) menu_additem(customshop, item, "10", 0) } if(contain(items, "l") == -1) // Item "l": Transparency [2500$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(TransparencyPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_TRANSPARENCY", get_pcvar_num(TransparencyPrize)) menu_additem(customshop, item, "11", 0) } if(contain(items, "m") == -1) // Item "m": Invisibility (15 Seconds) [16000$] { if(money >= get_pcvar_num(InvisibilityPrize)) formatex(item, charsmax(item), "%L \y(%i %L) \r[%i$]", LANG_SERVER, "CSHOP_INVISIBILITY", get_pcvar_num(InvisibilityTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(InvisibilityPrize)) else formatex(item, charsmax(item), "\d%L (%i %L) \r[%i$]", LANG_SERVER, "CSHOP_INVISIBILITY", get_pcvar_num(InvisibilityTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(InvisibilityPrize)) menu_additem(customshop, item, "12", 0) } if(contain(items, "n") == -1) // Item "n": Double Damage [10000$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(DoubleDamagePrize)) ? "" : "\d", LANG_SERVER, "CSHOP_DDAMAGE", get_pcvar_num(DoubleDamagePrize)) menu_additem(customshop, item, "13", 0) } if(contain(items, "o") == -1) // Item "o": GodMode (5 Seconds) [16000$] { if(money >= get_pcvar_num(GodModePrize)) formatex(item, charsmax(item), "%L \y(%i %L) \r[%i$]", LANG_SERVER, "CSHOP_GODMODE", get_pcvar_num(GodModeTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(GodModePrize)) else formatex(item, charsmax(item), "\d%L (%i %L) \r[%i$]", LANG_SERVER, "CSHOP_GODMODE", get_pcvar_num(GodModeTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(GodModePrize)) menu_additem(customshop, item, "14", 0) } if(contain(items, "p") == -1) // Item "p": Health Regeneration [1800$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(HealthRegenPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_HEALTHREGEN", get_pcvar_num(HealthRegenPrize)) menu_additem(customshop, item, "15", 0) } if(contain(items, "q") == -1) // Item "q": Armor Regeneration [2000$] { formatex(item, charsmax(item), "%s%L \r[%i$]", (money >= get_pcvar_num(ArmorRegenPrize)) ? "" : "\d", LANG_SERVER, "CSHOP_ARMORREGEN", get_pcvar_num(ArmorRegenPrize)) menu_additem(customshop, item, "16", 0) } formatex(close, charsmax(close), "%L", LANG_SERVER, "CSHOP_EXIT") formatex(back, charsmax(back), "%L", LANG_SERVER, "CSHOP_BACK") formatex(next, charsmax(next), "%L", LANG_SERVER, "CSHOP_NEXT") menu_setprop(customshop, MPROP_EXITNAME, close) menu_setprop(customshop, MPROP_BACKNAME, back) menu_setprop(customshop, MPROP_NEXTNAME, next) menu_display(id, customshop, 0) return PLUGIN_HANDLED }
public cshop_handler(id, customshop, item) { if(!is_user_alive(id) || item == MENU_EXIT) { menu_destroy(customshop) return PLUGIN_HANDLED } new data[6], iName[64], access, callback menu_item_getinfo(customshop, item, access, data, charsmax(data), iName, charsmax(iName), callback)
new key = str_to_num(data) new money = cs_get_user_money(id) new weapon = get_user_weapon(id) new message[192] switch(key) { case 0: // Item "a": +50 Health [1000$] { if(money >= get_pcvar_num(HealthPrize)) { set_user_health(id, get_user_health(id) + get_pcvar_num(HealthAmmount)) cs_set_user_money(id, money - get_pcvar_num(HealthPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_HEALTH", get_pcvar_num(HealthPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 1: // Item "b": +50 Armor [1000$] { if(money >= get_pcvar_num(ArmorPrize)) { set_user_armor(id, get_user_armor(id) + get_pcvar_num(ArmorAmmount)) cs_set_user_money(id, money - get_pcvar_num(ArmorPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_ARMOR", get_pcvar_num(ArmorPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 2: // Item "c": Unlimited Clip [3000$] { if(money >= get_pcvar_num(UnlimitedClipPrize)) { if(weapon != CSW_KNIFE && weapon != CSW_HEGRENADE && weapon != CSW_FLASHBANG && weapon != CSW_SMOKEGRENADE && weapon != CSW_C4) { cs_set_weapon_ammo(get_pdata_cbase(id, m_pActiveItem), 97280) cs_set_user_bpammo(id, weapon, 0) cs_set_user_money(id, money - get_pcvar_num(UnlimitedClipPrize), 1) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_UNLCLIP", get_pcvar_num(UnlimitedClipPrize)) } else { cantactivate[id] = 1 cantactivateitem(id) return PLUGIN_HANDLED } } else { notenough(id) return PLUGIN_HANDLED } } case 3: // Item "d": Unlimited Ammo [200$] { if(money >= get_pcvar_num(UnlimitedAmmoPrize)) { if(weapon != CSW_KNIFE && weapon != CSW_HEGRENADE && weapon != CSW_FLASHBANG && weapon != CSW_SMOKEGRENADE && weapon != CSW_C4) { cs_set_user_bpammo(id, weapon, 99999) cs_set_user_money(id, money - get_pcvar_num(UnlimitedAmmoPrize), 1) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_UNLAMMO", get_pcvar_num(UnlimitedAmmoPrize)) } else { cantactivate[id] = 2 cantactivateitem(id) return PLUGIN_HANDLED } } else { notenough(id) return PLUGIN_HANDLED } } case 4: // Item "e": All Grenades [800$] { if(money >= get_pcvar_num(AllGrenadesPrize)) { give_item(id, "weapon_hegrenade") give_item(id, "weapon_flashbang") give_item(id, "weapon_flashbang") give_item(id, "weapon_smokegrenade") cs_set_user_money(id, money - get_pcvar_num(AllGrenadesPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_ALLGRENADES", get_pcvar_num(AllGrenadesPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 5: // Item "f": Bomber [1600$] { if(money >= get_pcvar_num(BomberPrize)) { give_item(id, "weapon_hegrenade") cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(BomberAmmount)) cs_set_user_money(id, money - get_pcvar_num(BomberPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_BOMBER", get_pcvar_num(BomberPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 6: // Item "g": Silent Footsteps [3000$] { if(money >= get_pcvar_num(SilentFootstepsPrize)) { set_user_footsteps(id, 1) cs_set_user_money(id, money - get_pcvar_num(SilentFootstepsPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_SILENTSTEPS", get_pcvar_num(SilentFootstepsPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 7: // Item "h": Faster Speed [4300$] { if(money >= get_pcvar_num(FasterSpeedPrize)) { cshop_speed[id] = true set_user_maxspeed(id, get_pcvar_float(FasterSpeedAmmount)) cs_set_user_money(id, money - get_pcvar_num(FasterSpeedPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_FASTERSPEED", get_pcvar_num(FasterSpeedPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 8: // Item "i": Low Gravity [2800$] { if(money >= get_pcvar_num(LowGravityPrize)) { set_user_gravity(id, get_pcvar_float(LowGravityAmmount)) cs_set_user_money(id, money - get_pcvar_num(LowGravityPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_LOWGRAVITY", get_pcvar_num(LowGravityPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 9: // Item "j": Chameleon [9000$] { if(money >= get_pcvar_num(ChameleonPrize)) { switch(get_user_team(id)) { case 1: cs_set_user_model(id, g_playerModels[random_num(4, 7)]) case 2: cs_set_user_model(id, g_playerModels[random_num(0, 3)]) } cs_set_user_money(id, money - get_pcvar_num(ChameleonPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_CHAMELEON", get_pcvar_num(ChameleonPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 10: // Item "k": Drugs (Speed + Health) [8000$] { if(money >= get_pcvar_num(DrugsPrize)) { set_user_health(id, get_pcvar_num(DrugsHealthAmmount)) set_user_maxspeed(id, get_pcvar_float(DrugsSpeedAmmount)) message_begin(MSG_ONE, gmsg_SetFOV, {0, 0, 0}, id) write_byte(180) message_end() cs_set_user_money(id, money - get_pcvar_num(DrugsPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_DRUGS", get_pcvar_num(DrugsPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 11: // Item "l": Transparency [2500$] { if(money >= get_pcvar_num(TransparencyPrize)) { set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(TransparencyAmmount)) cs_set_user_money(id, money - get_pcvar_num(TransparencyPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_TRANSPARENCY", get_pcvar_num(TransparencyPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 12: // Item "m": Invisibility (15 Seconds) [16000$] { if(money >= get_pcvar_num(InvisibilityPrize)) { set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0) set_task(get_pcvar_float(InvisibilityTime), "NoMoreInvis", id) cs_set_user_money(id, money - get_pcvar_num(InvisibilityPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_INVISIBILITY", get_pcvar_num(InvisibilityPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 13: // Item "n": Double Damage [10000$] { if(money >= get_pcvar_num(DoubleDamagePrize)) { cshop_ddamage[id] = true cs_set_user_money(id, money - get_pcvar_num(DoubleDamagePrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_DDAMAGE", get_pcvar_num(DoubleDamagePrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 14: // Item "o": GodMode (5 Seconds) [16000$] { if(money >= get_pcvar_num(GodModePrize)) { set_user_godmode(id, 1) set_task(get_pcvar_float(GodModeTime), "NoMoreGod", id) cs_set_user_money(id, money - get_pcvar_num(GodModePrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_GODMODE", get_pcvar_num(GodModePrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 15: // Item "p": Health Regeneration [1800$] { if(money >= get_pcvar_num(HealthRegenPrize)) { cshop_healthregen[id] = true set_task(get_pcvar_float(HealthRegenTime), "healthRegenTicker", id, "", 0, "b", 0) cs_set_user_money(id, money - get_pcvar_num(HealthRegenPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_HEALTHREGEN", get_pcvar_num(HealthRegenPrize)) } else { notenough(id) return PLUGIN_HANDLED } } case 16: // Item "q": Armor Regeneration [2000$] { if(money >= get_pcvar_num(ArmorRegenPrize)) { cshop_armorregen[id] = true set_task(get_pcvar_float(ArmorRegenTime), "armorRegenTicker", id, "", 0, "b", 0) cs_set_user_money(id, money - get_pcvar_num(ArmorRegenPrize)) formatex(message, charsmax(message), "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, "CSHOP_ARMORREGEN", get_pcvar_num(ArmorRegenPrize)) } else { notenough(id) return PLUGIN_HANDLED } } } emit_sound(id, CHAN_ITEM, g_itemSounds[item], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ColorChat(id, TEAM_COLOR, message) menu_destroy(customshop) return PLUGIN_HANDLED }
public notenough(id) { ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOTENOUGH") client_cmd(id, "spk %s", sNo) }
public cantactivateitem(id) { switch(cantactivate[id]) { case 1: ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_CANNOT_ACTIVATE", LANG_SERVER, "CSHOP_UNLCLIP") case 2: ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_CANNOT_ACTIVATE", LANG_SERVER, "CSHOP_UNLAMMO") } client_cmd(id, "spk %s", sNo) }
public NoMoreInvis(id) { set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255) ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOMOREINVIS") client_cmd(id, "spk %s", sOver) }
public NoMoreGod(id) { if(is_user_alive(id)) set_user_godmode(id, 0) ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOMOREGOD") client_cmd(id, "spk %s", sOver) }
public ham_damage(victim, inflictor, attacker, Float:damage, damage_bits) { if(is_user_alive(attacker) && cshop_ddamage[attacker] && attacker != victim) SetHamParamFloat(4, damage * 2) }
public healthRegenTicker(id) { if(!is_user_alive(id) || !cshop_healthregen[id]) remove_task(id) new health = get_user_health(id) new healthammount = get_pcvar_num(HealthRegenAmmount) new healthmax = get_pcvar_num(HealthRegenMax) if(cshop_healthregen[id] && is_user_alive(id)) { if(health < healthmax) { if(health + healthammount > healthmax) set_user_health(id, healthmax) else set_user_health(id, health + healthammount) } } }
public armorRegenTicker(id) { if(!is_user_alive(id) || !cshop_armorregen[id]) remove_task(id) new armor = get_user_armor(id) new armorammount = get_pcvar_num(ArmorRegenAmmount) new armormax = get_pcvar_num(ArmorRegenMax) if(cshop_armorregen[id] && is_user_alive(id)) { if(armor < armormax) { if(armor + armorammount > armormax) set_user_armor(id, armormax) else set_user_armor(id, armor + armorammount) } } }
public plugin_precache() { for(new i = 0; i < sizeof g_itemSounds; i++) precache_sound(g_itemSounds[i]) }
/* ======================================================================================================= */ /* ColorChat */ /* ======================================================================================================= */ ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) { if( !get_playersnum() ) return; new message[256];
switch(type) { case NORMAL: // clients scr_concolor cvar color { message[0] = 0x01; } case GREEN: // Green { message[0] = 0x04; } default: // White, Red, Blue { message[0] = 0x03; } }
vformat(message[1], 251, msg, 4);
replace_all(message, 191, "!n", "^x01") replace_all(message, 191, "!t", "^x03") replace_all(message, 191, "!g", "^x04") // Make sure message is not longer than 192 character. Will crash the server. message[192] = '^0';
new team, ColorChange, index, MSG_Type; if(id) { MSG_Type = MSG_ONE; index = id; } else { index = FindPlayer(); MSG_Type = MSG_ALL; } team = get_user_team(index); ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message); if(ColorChange) { Team_Info(index, MSG_Type, TeamName[team]); } }
ShowColorMessage(id, type, message[]) { static bool:saytext_used; static get_user_msgid_saytext; if(!saytext_used) { get_user_msgid_saytext = get_user_msgid("SayText"); saytext_used = true; } message_begin(type, get_user_msgid_saytext, _, id); write_byte(id) write_string(message); message_end(); }
Team_Info(id, type, team[]) { static bool:teaminfo_used; static get_user_msgid_teaminfo; if(!teaminfo_used) { get_user_msgid_teaminfo = get_user_msgid("TeamInfo"); teaminfo_used = true; } message_begin(type, get_user_msgid_teaminfo, _, id); write_byte(id); write_string(team); message_end();
return 1; }
ColorSelection(index, type, Color:Type) { switch(Type) { case RED: { return Team_Info(index, type, TeamName[1]); } case BLUE: { return Team_Info(index, type, TeamName[2]); } case GREY: { return Team_Info(index, type, TeamName[0]); } }
return 0; }
FindPlayer() { new i = -1;
while(i <= get_maxplayers()) { if(is_user_connected(++i)) return i; }
return -1; }
|