| bakir123 |
05-19-2015 14:54 |
buy modes edit
i use this plagin buy modes is orginal but i want to add simple code
the code is just you can buy 1 mode in map
example if i bought nemesis and i want to buy sniper i cant will show this massage
"you can just buy 1 mode in map you should wait to nextmap"
PHP Code:
/*================================================================================ - Cvars -
1. zp_buy_classes_delay 2 // Delay (in rounds) before the items will be buyable again after being selected ================================================================================*/
#include <amxmodx> #include <zombie_plague_advance>
#define LOG_FILE "ZP64_extra_buy_mode.log"
#define IP_SERVER_LICENTIAT "89.40.233.232?27015"
new g_item_survivor, g_item_sniper, g_item_nemesis, g_item_assassin, g_maxplayers, g_msgSayText
const g_item_surv_cost = 350 const g_item_sniper_cost = 300 const g_item_nem_cost = 150 const g_item_assassin_cost = 180
new g_buyable, g_endround, RoundCount, cvar_delay new g_MsgSync
public plugin_init() { register_plugin("[CS16] Extra: Buy Mode", "1.0", "CS16 Team") g_item_survivor = zp_register_extra_item("Cumpara Survivor", g_item_surv_cost, ZP_TEAM_HUMAN) g_item_sniper = zp_register_extra_item("Cumpara Sniper", g_item_sniper_cost, ZP_TEAM_HUMAN) g_item_nemesis = zp_register_extra_item("Cumpara Nemesis", g_item_nem_cost, ZP_TEAM_HUMAN) g_item_assassin = zp_register_extra_item("Cumpara Assassin", g_item_assassin_cost, ZP_TEAM_HUMAN) register_event("HLTV", "event_round_start", "a", "1=0", "2=0") register_logevent("logevent_round_end", 2, "1=Round_End") g_maxplayers = get_maxplayers() g_msgSayText = get_user_msgid("SayText") g_MsgSync = CreateHudSyncObj() g_buyable = true RoundCount = 0 new IP_LICENTIAT[20]; get_user_ip(0, IP_LICENTIAT, 21, 1);
if(!equal(IP_LICENTIAT, IP_SERVER_LICENTIAT)) { server_print("Pluginul zp64_extra_buy_mode nu ruleaza.") pause("ade"); } else { server_print("Pluginul zp64_extra_buy_mode functioneaza!") } }
public plugin_precache() { cvar_delay = register_cvar("zp_buy_classes_delay", "2") }
public zp_extra_item_selected(id, itemid) { if (itemid != g_item_survivor && itemid != g_item_sniper && itemid != g_item_nemesis && itemid != g_item_assassin) return PLUGIN_CONTINUE; if (!g_buyable) { if (RoundCount == get_pcvar_num(cvar_delay)) zp_colored_print(id, "^x04[ZP]^x01 You have to wait one more round before you can buy this item") else zp_colored_print(id, "^x04[ZP]^x01 You have to wait %d rounds until you can buy this item", get_pcvar_num(cvar_delay) - RoundCount + 1) return ZP_PLUGIN_HANDLED; } if (zp_has_round_started() == 1 || g_endround) { zp_colored_print(id, "^x04[ZP]^x01 This item can only be bought before the round mode starts") return ZP_PLUGIN_HANDLED; } new name[32] get_user_name(id, name, 31) if (itemid == g_item_survivor) { zp_make_user_survivor(id) zp_colored_print(0, "^x04[ZP]^x03 %s^x01 bought^x04 Survivor", name) set_hudmessage(255, 0, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%s bought Survivor !!", name) log_to_file( LOG_FILE, "%s bought .::SURVIVOR::.", name) } else if (itemid == g_item_sniper) { zp_make_user_sniper(id) zp_colored_print(0, "^x04[ZP]^x03 %s^x01 bought^x04 Sniper", name) set_hudmessage(255, 0, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%s bought Sniper !!", name) log_to_file( LOG_FILE, "%s bought .::SNIPER::.", name) } else if (itemid == g_item_nemesis) { zp_make_user_nemesis(id) zp_colored_print(0, "^x04[ZP]^x03 %s^x01 bought^x04 Nemesis", name) set_hudmessage(255, 0, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%s bought Nemesis !!", name) log_to_file( LOG_FILE, "%s bought .::NEMESIS::.", name) } else if (itemid == g_item_assassin) { zp_make_user_assassin(id) zp_colored_print(0, "^x04[ZP]^x03 %s^x01 bought^x04 Assassin", name) set_hudmessage(255, 0, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1) ShowSyncHudMsg(0, g_MsgSync, "%s bought Assassin !!", name) log_to_file( LOG_FILE, "%s bought .::ASSASSIN::.", name) } g_buyable = false return PLUGIN_CONTINUE; }
public event_round_start() g_endround = false
public logevent_round_end() { g_endround = true if (g_buyable) return; if (RoundCount < get_pcvar_num(cvar_delay)) RoundCount++ else if (RoundCount >= get_pcvar_num(cvar_delay)) { g_buyable = true RoundCount = 0 } }
// Colored chat print by MeRcyLeZZ zp_colored_print(target, const message[], any:...) { static buffer[512], i, argscount argscount = numargs() // Send to everyone if (!target) { static player for (player = 1; player <= g_maxplayers; player++) { // Not connected if (!is_user_connected(player)) continue; // Remember changed arguments static changed[5], changedcount // [5] = max LANG_PLAYER occurencies changedcount = 0 // Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } } // Format message for player vformat(buffer, charsmax(buffer), message, 3) // Send it message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player) write_byte(player) write_string(buffer) message_end() // Replace back player id's with LANG_PLAYER for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER) } } // Send to specific target else { // Format message for player vformat(buffer, charsmax(buffer), message, 3) // Send it message_begin(MSG_ONE, g_msgSayText, _, target) write_byte(target) write_string(buffer) message_end() } }
|