Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <engine>
- #include <zombieplague>
- #include <fun>
- #define PLUGIN "Purchase Mod"
- #define VERSION "1.4.1"
- #define AUTHOR "Dizzy"
- #define FL_WATERJUMP (1<<11)
- #define FL_ONGROUND (1<<9)
- #define CVAR_PLUGIN "amx_pmod"
- #define CVAR_MULTI "amx_pmod_multi"
- #define CVAR_STAYOPEN "amx_pmod_menu"
- #define CVAR_ROUNDS "amx_pmod_rounds"
- #define CVAR_DROPALLOW "amx_pmod_dropallow"
- #define CVAR_DROPRATE "amx_pmod_droprate"
- #define CVAR_GRAVITY "amx_pmod_gravity"
- #define CVAR_SPEED "amx_pmod_speed"
- #define CVAR_STEALTH "amx_pmod_stealth"
- #define CVAR_GLASSES "amx_pmod_glasses"
- #define CVAR_MULTIJUMP "amx_pmod_multijump"
- #define CVAR_BUNNYHOP "amx_pmod_bunnyhop"
- #define CVAR_HEALTH "amx_pmod_health"
- #define GRAVITYCOST "amx_pmod_gravityCost"
- #define SPEEDCOST "amx_pmod_speedCost"
- #define STEALTHCOST "amx_pmod_stealthCost"
- #define GLASSESCOST "amx_pmod_glassesCost"
- #define MULTIJUMPCOST "amx_pmod_multijumpCost"
- #define BUNNYHOPCOST "amx_pmod_bunnyhopCost"
- #define HEALTHCOST "amx_pmod_healthCost"
- #define PLAYERSPEED "amx_pmod_playerspeed"
- #define PLAYERGRAVITY "amx_pmod_playergravity"
- #define PLAYERHEALTH "amx_pmod_playerhealth"
- #define PLAYERARMOR "amx_pmod_playerarmor"
- #define MULTIJUMPNUMBER "amx_pmod_multijumpnumber"
- new const g_szAbilities[][] =
- {
- "Gravity",
- "Speed",
- "Stealth",
- "Anti-flash glasses",
- "Multi jump",
- "Bunny hop",
- "Health and Armor"
- }
- new g_haveability[33] = 0;
- new g_havegravity[33] = 0;
- new g_havespeed[33] = 0;
- new g_havestealth[33] = 0;
- new g_haveglasses[33] = 0;
- new g_havemultijump[33] = 0;
- new g_havebunnyhop[33] = 0;
- new g_havehealth[33] = 0;
- new g_roundsgravity[33];
- new g_roundsspeed[33];
- new g_roundsstealth[33];
- new g_roundsglasses[33];
- new g_roundsmultijump[33];
- new g_roundsbunnyhop[33];
- new g_roundshealth[33];
- new g_jumpnum[33]
- new bool:g_dojump[33];
- new g_msgscreenfade;
- public client_connect(id)
- {
- g_haveability[id] = 0;
- g_havegravity[id] = 0;
- g_havespeed[id] = 0;
- g_havestealth[id] = 0;
- g_haveglasses[id] = 0;
- g_havemultijump[id] = 0;
- g_havebunnyhop[id] = 0;
- g_havehealth[id] = 0;
- }
- public client_disconnect(id)
- {
- g_haveability[id] = 0;
- g_havegravity[id] = 0;
- g_havespeed[id] = 0;
- g_havestealth[id] = 0;
- g_haveglasses[id] = 0;
- g_havemultijump[id] = 0;
- g_havebunnyhop[id] = 0;
- g_havehealth[id] = 0;
- }
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- register_cvar(CVAR_PLUGIN, "1");
- register_cvar(CVAR_MULTI, "0");
- register_cvar(CVAR_STAYOPEN, "0");
- register_cvar(CVAR_ROUNDS, "1");
- register_cvar(CVAR_DROPALLOW, "1");
- register_cvar(GRAVITYCOST, "7");
- register_cvar(SPEEDCOST, "7");
- register_cvar(STEALTHCOST, "7");
- register_cvar(GLASSESCOST, "7");
- register_cvar(MULTIJUMPCOST, "10");
- register_cvar(BUNNYHOPCOST, "12");
- register_cvar(HEALTHCOST, "15");
- register_cvar(CVAR_GRAVITY, "1");
- register_cvar(CVAR_SPEED, "1");
- register_cvar(CVAR_STEALTH, "1");
- register_cvar(CVAR_GLASSES, "1");
- register_cvar(CVAR_MULTIJUMP, "1");
- register_cvar(CVAR_BUNNYHOP, "1");
- register_cvar(CVAR_HEALTH, "1");
- register_cvar(PLAYERSPEED, "320");
- register_cvar(PLAYERGRAVITY, "200");
- register_cvar(PLAYERHEALTH, "200");
- register_cvar(PLAYERARMOR, "200");
- register_cvar(CVAR_DROPRATE, "25");
- register_cvar(MULTIJUMPNUMBER, "3");
- register_clcmd("say pmodmenu","startpage");
- register_clcmd("say_team pmodmenu","startpage");
- register_clcmd("pmodmenu","startpage");
- register_concmd("pmodmenu","startpage");
- register_event("ResetHUD","roundchange","b");
- register_event("CurWeapon","speedb","be","1=1");
- register_event("ScreenFade","event_blinded","be","4=255","5=255","6=255","7>199");
- register_event("DeathMsg","death_event","a");
- g_msgscreenfade = get_user_msgid("ScreenFade");
- }
- public plugin_precache()
- {
- precache_sound("purchasemod/buy.wav");
- precache_sound("purchasemod/drain.wav");
- precache_sound("purchasemod/sorry.wav");
- }
- public client_putinserver(id)
- {
- if (is_user_bot(id))
- return;
- set_task(25.0, "inform", id);
- }
- public inform(id)
- {
- new gMsgSayText;
- gMsgSayText = get_user_msgid("SayText");
- new printMsg[191];
- client_print(id, print_chat, "[Purchase Mod]: This server is running Purchase Mod v%s -- By: %s", VERSION, AUTHOR);
- format(printMsg,191, "^x01[Purchase Mod]: Type ^x03pmodmenu ^x01to start!");
- message_begin(MSG_ONE,gMsgSayText,{0,0,0},id);
- write_byte(id);
- write_string(printMsg);
- message_end();
- return PLUGIN_HANDLED;
- }
- public startpage(id)
- {
- new menu = menu_create("\wPurchase Mod: \rMain Menu", "start_handler")
- if (!get_cvar_num(CVAR_PLUGIN) || !is_user_alive(id))
- menu_additem(menu, "\dPurchase Ability", "1", 0);
- else
- menu_additem(menu, "\wPurchase Ability", "1", 0);
- if (!get_cvar_num(CVAR_PLUGIN) || !is_user_alive(id) || !get_cvar_num(CVAR_DROPALLOW))
- menu_additem(menu, "\dDrop Ability", "2", 0);
- else
- menu_additem(menu, "\wDrop Ability", "2", 0);
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
- menu_display(id, menu, 0);
- }
- public start_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menu);
- return PLUGIN_HANDLED;
- }
- 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 (!get_cvar_num(CVAR_PLUGIN))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, the plugin is off!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- startpage(id);
- }
- if (!is_user_alive(id))
- {
- client_print(id, print_chat, "[Purchase Mod]: You must be alive to purchase items!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- startpage(id);
- }
- else if (get_cvar_num(CVAR_PLUGIN) && is_user_alive(id))
- {
- buypage(id);
- }
- }
- case 2:
- {
- if (!get_cvar_num(CVAR_PLUGIN))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, the plugin is off!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- startpage(id);
- }
- if (!is_user_alive(id))
- {
- client_print(id, print_chat, "[Purchase Mod]: You must be alive to purchase items!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- startpage(id);
- }
- if (!get_cvar_num(CVAR_DROPALLOW))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, dropping abilities is not allowed!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- startpage(id);
- }
- else if (get_cvar_num(CVAR_PLUGIN) && is_user_alive(id) && get_cvar_num(CVAR_DROPALLOW))
- {
- droppage(id);
- }
- }
- }
- menu_destroy(menu);
- return PLUGIN_HANDLED;
- }
- public buypage(id)
- {
- new menu = menu_create("\wPurchase Mod: \rBuy Menu", "buy_handler")
- new userMoney = zp_get_user_ammo_packs(id)
- if (!get_cvar_num(CVAR_GRAVITY) || (get_cvar_num(GRAVITYCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dGravity", "1", 0);
- else
- menu_additem(menu, "\wGravity", "1", 0);
- if (!get_cvar_num(CVAR_SPEED) || (get_cvar_num(SPEEDCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dSpeed", "2", 0);
- else
- menu_additem(menu, "\wSpeed", "2", 0);
- if (!get_cvar_num(CVAR_STEALTH) || (get_cvar_num(STEALTHCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dStealth", "3", 0);
- else
- menu_additem(menu, "\wStealth", "3", 0);
- if (!get_cvar_num(CVAR_GLASSES) || (get_cvar_num(GLASSESCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dAnti-flash glasses", "4", 0);
- else
- menu_additem(menu, "\wAnti-flash glasses", "4", 0);
- if (!get_cvar_num(CVAR_MULTIJUMP) || (get_cvar_num(MULTIJUMPCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dMulti jump", "5", 0);
- else
- menu_additem(menu, "\wMulti jump", "5", 0);
- if (!get_cvar_num(CVAR_BUNNYHOP) || (get_cvar_num(BUNNYHOPCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dBunny hop", "6", 0);
- else
- menu_additem(menu, "\wBunny hop", "6", 0);
- if (!get_cvar_num(CVAR_HEALTH) || (get_cvar_num(HEALTHCOST) > userMoney) || (!get_cvar_num(CVAR_MULTI) && g_haveability[id]))
- menu_additem(menu, "\dHealth and Armor", "7", 0);
- else
- menu_additem(menu, "\wHealth and Armor", "7", 0);
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
- menu_display(id, menu, 0);
- }
- public buy_handler(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menu);
- startpage(id);
- return PLUGIN_HANDLED;
- }
- 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 (!get_cvar_num(CVAR_GRAVITY))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[0]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_havegravity[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[0]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(GRAVITYCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(GRAVITYCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[0], get_cvar_num(GRAVITYCOST));
- g_havegravity[id] = 1;
- g_haveability[id] = 1;
- g_roundsgravity[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- set_user_gravity(id, get_cvar_float(PLAYERGRAVITY)/800);
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- case 2:
- {
- if (!get_cvar_num(CVAR_SPEED))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[1]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_havespeed[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[1]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(SPEEDCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- {
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(SPEEDCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[1], get_cvar_num(SPEEDCOST));
- g_havespeed[id] = 1;
- g_haveability[id] = 1;
- g_roundsspeed[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- set_user_maxspeed(id, get_cvar_float(PLAYERSPEED));
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- }
- case 3:
- {
- if (!get_cvar_num(CVAR_STEALTH))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[2]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_havestealth[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[2]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(STEALTHCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- {
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(STEALTHCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[2], get_cvar_num(STEALTHCOST));
- g_havestealth[id] = 1;
- g_haveability[id] = 1;
- g_roundsstealth[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- set_user_rendering(id, kRenderFxNone, 50, 50, 50, kRenderTransAdd, 50);
- set_user_footsteps(id, 1);
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- }
- case 4:
- {
- if (!get_cvar_num(CVAR_GLASSES))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[3]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_haveglasses[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[3]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(GLASSESCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- {
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(GLASSESCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[3], get_cvar_num(GLASSESCOST));
- g_haveglasses[id] = 1;
- g_haveability[id] = 1;
- g_roundsglasses[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- event_blinded(id);
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- }
- case 5:
- {
- if (!get_cvar_num(CVAR_MULTIJUMP))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[4]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_havemultijump[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[4]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(MULTIJUMPCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- {
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(MULTIJUMPCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[4], get_cvar_num(MULTIJUMPCOST));
- g_havemultijump[id] = 1;
- g_haveability[id] = 1;
- g_roundsmultijump[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- }
- case 6:
- {
- if (!get_cvar_num(CVAR_BUNNYHOP))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[5]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_havebunnyhop[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[5]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(BUNNYHOPCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- {
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(BUNNYHOPCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[5], get_cvar_num(BUNNYHOPCOST));
- g_havebunnyhop[id] = 1;
- g_haveability[id] = 1;
- g_roundsbunnyhop[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- }
- case 7:
- {
- if (!get_cvar_num(CVAR_HEALTH))
- {
- client_print(id, print_chat, "[Purchase Mod]: Sorry, %s is not allowed!", g_szAbilities[6]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (g_havehealth[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased %s!", g_szAbilities[6]);
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- if (!get_cvar_num(CVAR_MULTI) && g_haveability[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You already purchased a different skill!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- new userMoney = zp_get_user_ammo_packs(id);
- if(get_cvar_num(HEALTHCOST) > userMoney)
- {
- client_print(id, print_chat, "[Purchase Mod]: You have insufficient funds!");
- client_cmd(id,"spk purchasemod/sorry");
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- return PLUGIN_CONTINUE;
- }
- else
- {
- zp_set_user_ammo_packs(id, (userMoney - get_cvar_num(HEALTHCOST)));
- client_cmd(id,"spk purchasemod/buy");
- client_print(id, print_chat, "[Purchase Mod]: You purchased %s for $%d!", g_szAbilities[6], get_cvar_num(HEALTHCOST));
- g_havehealth[id] = 1;
- g_haveability[id] = 1;
- g_roundshealth[id] = get_cvar_num(CVAR_ROUNDS) - 1;
- new health = get_cvar_num(PLAYERHEALTH);
- set_user_health(id, get_user_health(id) + health);
- set_user_armor(id, get_cvar_num(PLAYERARMOR));
- if (get_cvar_num(CVAR_STAYOPEN))
- buypage(id);
- }
- }
- }
- menu_destroy(menu);
- return PLUGIN_HANDLED;
- }
- public droppage(id)
- {
- new ratephrase[60]
- format(ratephrase, 59, "\wPurchase Mod: \rDrop Menu (%d percent)", get_cvar_num(CVAR_DROPRATE))
- new menu = menu_create(ratephrase, "drop_handler")
- if (!g_havegravity[id])
- menu_additem(menu, "\dGravity", "1", 0);
- else
- menu_additem(menu, "\wGravity", "1", 0);
- if (!g_havespeed[id])
- menu_additem(menu, "\dSpeed", "2", 0);
- else
- menu_additem(menu, "\wSpeed", "2", 0);
- if (!g_havestealth[id])
- menu_additem(menu, "\dStealth", "3", 0);
- else
- menu_additem(menu, "\wStealth", "3", 0);
- if (!g_haveglasses[id])
- menu_additem(menu, "\dAnti-flash glasses", "4", 0);
- else
- menu_additem(menu, "\wAnti-flash glasses", "4", 0);
- if (!g_havemultijump[id])
- menu_additem(menu, "\dMulti jump", "5", 0);
- else
- menu_additem(menu, "\wMulti jump", "5", 0);
- if (!g_havebunnyhop[id])
- menu_additem(menu, "\dBunny hop", "6", 0);
- else
- menu_additem(menu, "\wBunny hop", "6", 0);
- if (!g_havehealth[id])
- menu_additem(menu, "\dHealth and Armor", "7", 0);
- else
- menu_additem(menu, "\wHealth and Armor", "7", 0);
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
- menu_display(id, menu, 0);
- }
- public drop_handler(id, menu, item)
- {
- new gravity_drop = (get_cvar_num(GRAVITYCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- new speed_drop = (get_cvar_num(SPEEDCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- new stealth_drop = (get_cvar_num(STEALTHCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- new glasses_drop = (get_cvar_num(GLASSESCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- new multijump_drop = (get_cvar_num(MULTIJUMPCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- new bunnyhop_drop = (get_cvar_num(BUNNYHOPCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- new health_drop = (get_cvar_num(HEALTHCOST) * get_cvar_num(CVAR_DROPRATE) / 100);
- if (item == MENU_EXIT)
- {
- menu_destroy(menu);
- startpage(id);
- return PLUGIN_HANDLED;
- }
- 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 (!g_havegravity[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[0]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + gravity_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[0], gravity_drop);
- g_havegravity[id] = 0;
- g_roundsgravity[id] = 0;
- set_user_gravity(id, 1.0);
- abilitycheck(id);
- }
- }
- case 2:
- {
- if (!g_havespeed[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[1]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + speed_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[1], speed_drop);
- g_havespeed[id] = 0;
- g_roundsspeed[id] = 0;
- set_user_maxspeed(id, 250.0);
- abilitycheck(id);
- }
- }
- case 3:
- {
- if(!g_havestealth[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[2]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + stealth_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[2], stealth_drop);
- g_havestealth[id] = 0;
- g_roundsstealth[id] = 0;
- set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
- set_user_footsteps(id,0);
- abilitycheck(id);
- }
- }
- case 4:
- {
- if(!g_haveglasses[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[3]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + glasses_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[3], glasses_drop);
- g_haveglasses[id] = 0;
- g_roundsglasses[id] = 0;
- event_blinded(id);
- abilitycheck(id);
- }
- }
- case 5:
- {
- if(!g_havemultijump[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[4]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + multijump_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[4], multijump_drop);
- g_havemultijump[id] = 0;
- g_roundsmultijump[id] = 0;
- abilitycheck(id);
- }
- }
- case 6:
- {
- if(!g_havebunnyhop[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[5]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + bunnyhop_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[5], bunnyhop_drop);
- g_havebunnyhop[id] = 0;
- g_roundsbunnyhop[id] = 0;
- abilitycheck(id);
- }
- }
- case 7:
- {
- if(!g_havehealth[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: You don't have %s!", g_szAbilities[6]);
- client_cmd(id,"spk purchasemod/sorry");
- }
- else
- {
- new userMoney = zp_get_user_ammo_packs(id);
- zp_set_user_ammo_packs(id, (userMoney + health_drop));
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: You dropped %s for $%d!", g_szAbilities[6], health_drop);
- g_havehealth[id] = 0;
- g_roundshealth[id] = 0;
- if (get_user_health(id) > 100)
- set_user_health(id, 100);
- if (get_user_armor(id) > 100)
- set_user_armor(id, 100);
- abilitycheck(id);
- }
- }
- }
- menu_destroy(menu);
- if (get_cvar_num(CVAR_STAYOPEN))
- droppage(id);
- return PLUGIN_HANDLED;
- }
- public client_PreThink(id)
- {
- if(g_havemultijump[id])
- {
- new nbut = get_user_button(id);
- new obut = get_user_oldbutton(id);
- if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
- {
- if(g_jumpnum[id] < get_cvar_num(MULTIJUMPNUMBER))
- {
- g_dojump[id] = true;
- g_jumpnum[id]++;
- return PLUGIN_CONTINUE;
- }
- }
- if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
- g_jumpnum[id] = 0;
- return PLUGIN_CONTINUE;
- }
- if(g_havebunnyhop[id])
- {
- entity_set_float(id, EV_FL_fuser2, 0.0);
- if (entity_get_int(id, EV_INT_button) & 2)
- {
- new flags = entity_get_int(id, EV_INT_flags);
- if (flags & FL_WATERJUMP)
- {
- return PLUGIN_CONTINUE;
- }
- if (entity_get_int(id, EV_INT_waterlevel) >= 2)
- {
- return PLUGIN_CONTINUE;
- }
- if(!(flags & FL_ONGROUND))
- {
- return PLUGIN_CONTINUE;
- }
- new Float:velocity[3];
- entity_get_vector(id, EV_VEC_velocity, velocity);
- velocity[2] += 250.0;
- entity_set_vector(id, EV_VEC_velocity, velocity);
- entity_set_int(id, EV_INT_gaitsequence, 6);
- }
- return PLUGIN_CONTINUE;
- }
- return PLUGIN_HANDLED;
- }
- public client_PostThink(id)
- {
- if(g_dojump[id] == true && g_havemultijump[id])
- {
- new Float:velocity[3];
- entity_get_vector(id,EV_VEC_velocity,velocity);
- velocity[2] = random_float(265.0,285.0);
- entity_set_vector(id,EV_VEC_velocity,velocity);
- g_dojump[id] = false;
- return PLUGIN_CONTINUE;
- }
- return PLUGIN_CONTINUE;
- }
- public speedb(id)
- {
- if(g_havespeed[id])
- set_user_maxspeed(id, get_cvar_float(PLAYERSPEED));
- return PLUGIN_HANDLED;
- }
- public event_blinded(id)
- {
- if(g_haveglasses[id])
- {
- message_begin(MSG_ONE,g_msgscreenfade,{0,0,0},id);
- write_short(~0);
- write_short(0);
- write_short(1<<12);
- write_byte(0);
- write_byte(0);
- write_byte(0);
- write_byte(100);
- message_end();
- set_task(0.0,"event_blinded",id)
- }
- return PLUGIN_HANDLED;
- }
- public roundchange(id)
- {
- if(g_haveability[id])
- strip(id);
- return PLUGIN_HANDLED;
- }
- public abilitycheck(id)
- {
- if(!g_havegravity[id] && !g_havespeed[id] && !g_havestealth[id] && !g_haveglasses[id] && !g_havemultijump[id] && !g_havebunnyhop[id] && !g_havehealth[id])
- g_haveability[id] = 0;
- return PLUGIN_CONTINUE;
- }
- public strip(id)
- {
- new arg[32], name[32];
- read_argv(1, arg,31);
- new player = cmd_target(id,arg,4);
- get_user_name(player,name,31);
- if(g_havegravity[id])
- {
- if (!g_roundsgravity[id])
- {
- set_user_gravity(id, 1.0);
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: Gravity set back to normal!");
- g_havegravity[id] = 0;
- }
- if (g_roundsgravity[id] > 0)
- {
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with %s", g_roundsgravity[id], g_szAbilities[0]);
- g_roundsgravity[id]--;
- set_user_gravity(id, get_cvar_float(PLAYERGRAVITY)/800);
- }
- }
- if(g_havespeed[id])
- {
- if (!g_roundsspeed[id])
- {
- set_user_maxspeed(id, 250.0);
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: Speed set back to normal!");
- g_havespeed[id] = 0;
- }
- if (g_roundsspeed[id] > 0)
- {
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with %s", g_roundsspeed[id], g_szAbilities[1]);
- g_roundsspeed[id]--;
- }
- }
- if(g_havestealth[id])
- {
- if (!g_roundsstealth[id])
- {
- set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
- set_user_footsteps(id,0);
- client_cmd(id,"spk purchasemod/drain");
- client_print(id, print_chat, "[Purchase Mod]: Stealth set to normal!");
- g_havestealth[id] = 0;
- }
- if (g_roundsstealth[id] > 0)
- {
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with %s", g_roundsstealth[id], g_szAbilities[2]);
- g_roundsstealth[id]--;
- }
- }
- if(g_haveglasses[id])
- {
- if (!g_roundsglasses[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: Flash glasses broke!");
- client_cmd(id,"spk purchasemod/drain");
- g_haveglasses[id] = 0;
- }
- if (g_roundsglasses[id] > 0)
- {
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with %s", g_roundsglasses[id], g_szAbilities[3]);
- g_roundsglasses[id]--;
- }
- }
- if(g_havemultijump[id])
- {
- if (!g_roundsmultijump[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: Multi-Jump ran out!");
- client_cmd(id,"spk purchasemod/drain");
- g_havemultijump[id] = 0;
- }
- if (g_roundsmultijump[id] > 0)
- {
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with %s", g_roundsmultijump[id], g_szAbilities[4]);
- g_roundsmultijump[id]--;
- }
- }
- if(g_havebunnyhop[id])
- {
- if (!g_roundsbunnyhop[id])
- {
- client_print(id, print_chat, "[Purchase Mod]: Bunny Hop ran out!");
- client_cmd(id,"spk purchasemod/drain");
- g_havebunnyhop[id] = 0;
- }
- if (g_roundsbunnyhop[id] > 0)
- {
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with %s", g_roundsbunnyhop[id], g_szAbilities[5]);
- g_roundsbunnyhop[id]--;
- }
- }
- if(g_havehealth[id])
- {
- if (!g_roundshealth[id])
- {
- client_cmd(id,"spk purchasemod/drain");
- set_user_health(id, 100);
- if (get_user_armor(id) <= 100)
- return PLUGIN_CONTINUE;
- set_user_armor(id, 100);
- g_havehealth[id] = 0;
- }
- if (g_roundshealth[id] > 0)
- {
- new health = get_cvar_num(PLAYERHEALTH);
- client_print(id, print_chat, "[Purchase Mod]: %d round(s) left with extra %s", g_roundshealth[id], g_szAbilities[6]);
- set_user_health(id, get_user_health(id) + health);
- set_user_armor(id, get_cvar_num(PLAYERARMOR));
- g_roundshealth[id]--;
- }
- }
- abilitycheck(id);
- return PLUGIN_HANDLED;
- }
Advertisement
Add Comment
Please, Sign In to add comment