void(float cost, float type) BuyGrenade = { local string z; local float x, y; if (self.ammo_shells < cost) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not enough money.\n"); return; } sound (self, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); self.ammo_shells = self.ammo_shells - cost; sprint(self, PRINT_HIGH, "you bought a "); if (type == 1) y = IID_GREN_SMOKE; if (type == 2) y = IID_GREN_FRAG; if (type == 3) y = IID_GREN_EMP; z = GetItemName(y); sprint(self, PRINT_HIGH, z); sprint(self, PRINT_HIGH, "\n"); //put grenade in inventory //finds existing grenades, otherwise, empty slot x = SlotOfItem(self, y); if (x != 0) //found existing grenades SetItemSlot(self, x, SlotVal(y, 1)); if (x == 0) x = FindEmptySlot(self); SetItemSlot(self, x, SlotVal(y, 1)); }; void() BuyBandages = { local string y; if (self.ammo_shells < 2) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not enough money.\n"); return; } if (self.class != 2) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not a medic.\n"); return; } if (self.bandages >= 50) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "too many bandages.\n"); return; } sound (self, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); self.bandages = self.bandages + 25; self.ammo_shells = self.ammo_shells - 2; if (self.bandages > 50) self.bandages = 50; y = ftos(self.bandages); sprint(self, PRINT_HIGH, "you now have "); sprint(self, PRINT_HIGH, y); sprint(self, PRINT_HIGH, "/50 bandages.\n"); }; void(float cost, float type) BuyChem = { /* local string x; local float y; if (self.ammo_shells < cost) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not enough money.\n"); return; } if (type >= 2 && self.class != 1) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not a medic.\n"); return; } if (self.equipment == 1) y = 4; else y = 2; if (self.chemcount >= y) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "you can't hold any more chems.\n"); return; } sound (self, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); self.chemcount = y; self.chem = type; self.ammo_shells = self.ammo_shells - cost; x = GetChemName(); sprint (self, PRINT_HIGH, x); sprint(self, PRINT_HIGH, " purchased.\n"); */ }; void(string type) ChangeAmmo = { if (self.ammo_shells < 1) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not enough money.\n"); return; } sound (self, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); if (self.current_slot == 1) self.ammotype1 = type; if (self.current_slot == 2) self.ammotype2 = type; }; void() BuyScraps = { local string y; if (self.ammo_shells < 5) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not enough money.\n"); return; } if (self.class != 6) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "not a scientist.\n"); return; } if (self.scraps >= 15) { self.currentmenu = "none"; sprint(self, PRINT_HIGH, "too many metal scraps.\n"); return; } sound (self, CHAN_BODY, "items/armor1.wav", 1, ATTN_NORM); self.scraps = self.scraps + 5; self.ammo_shells = self.ammo_shells - 5; if (self.scraps > 15) self.scraps = 15; y = ftos(self.scraps); sprint(self, PRINT_HIGH, "you now have "); sprint(self, PRINT_HIGH, y); sprint(self, PRINT_HIGH, "/15 scraps.\n"); }; void (float wt, float cost, float wid) BuyWeapon = { local string z; local float x, y; if (self.ammo_shells < cost) { self.currentmenu = "none"; sound (self, CHAN_BODY, "misc/menu3.wav", 1, ATTN_IDLE); sprint(self, PRINT_HIGH, "not enough money.\n"); return; } sound (self, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); self.ammo_shells = self.ammo_shells - cost; sprint(self, PRINT_HIGH, "you bought "); z = GetItemName(wid); sprint(self, PRINT_HIGH, z); sprint(self, PRINT_HIGH, ".\n"); //put new weapon in current slot //put old weapon in empty slot //otherwise, drop it. x = SlotOfItem(self, IID_NONE); if (x == 0)//no more room DropFromSlot (self.current_slot, 1, 0); else //found a place to stick old weapon SetItemSlot(self, x, SlotVal(self.current_slot, 1)); SetItemSlot(self, self.current_slot, SlotVal(wid, 1)); x = WeaponMagQuant(wid);//load weapon with full ammo (may be changed) if (self.current_slot == 1) self.islot1 = SlotVal(wid, x + ToStatus(1)); if (self.current_slot == 2) self.islot2 = SlotVal(wid, x + ToStatus(2)); x = SlotOfItem(self, IID_NONE); //give ammo if (x != 0) SetItemSlot(self, x, WeaponAmmoType(wid)); }; void (float cost, float item) BuyPerk = { if (self.frags < cost) { sprint (self, PRINT_HIGH, "not enough kills\n"); self.currentmenu = "none"; return; } sprint (self, PRINT_HIGH, "ok, ability gained.\n"); self.perk = item; self.currentmenu = "none"; return; }; /* void (float wt, float cost, float item) BuyArmor = { local float curr; local float lbs; local string x; lbs = weightx (); if (((item >= TE_LIGHTNING2) && (self.protect >= SPAWNFLAG_SUPERSPIKE))) { sprint (self, PRINT_HIGH, "remove your hardware before buying\nany kind of advanced armor!\ntoo much interference otherwise."); self.currentmenu = "none"; return; } if ((cost > self.ammo_shells)) { sprint (self, PRINT_HIGH, "not enough money.\n"); self.currentmenu = "none"; return; } if ((((lbs + wt) - GetItemsWeight(self.islot3)) > self.max_weight)) { sprint (self, PRINT_HIGH, "you can't carry that much.\n"); self.currentmenu = "none"; return; } sound (self, CHAN_BODY, "misc/item2.wav", 1, ATTN_NORM); self.ammo_shells = (self.ammo_shells - cost); // self.armor_weight = wt; self.armor = item; x = GetArmorName(); sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, " purchased.\n"); return; };*/ void (float wt, float cost, float item) BuyArmor = { local string z; local float x, y; if (self.ammo_shells < cost) { self.currentmenu = "none"; sound (self, CHAN_BODY, "misc/menu3.wav", 1, ATTN_IDLE); sprint(self, PRINT_HIGH, "not enough money.\n"); return; } sound (self, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); self.ammo_shells = self.ammo_shells - cost; sprint(self, PRINT_HIGH, "you bought "); z = GetItemName(item); sprint(self, PRINT_HIGH, z); sprint(self, PRINT_HIGH, ".\n"); //put new armor in armor slot //put old armor in inventory x = FindEmptySlot(self); if (x == 0) sprint(self, 2, "no more room. giving armor to merchant.\n"); if (x != 0) //found a place to stick old armor SetItemSlot(self, x, SlotVal(self.islot3, 1)); SetItemSlot(self, 3, SlotVal(item, 1)); }; void (float cost, float item) BuyEquipment = { local float lbs; local string x; lbs = weightx (); if ((cost > self.ammo_shells)) { sprint (self, PRINT_HIGH, "not enough money.\n"); self.currentmenu = "none"; return; } sound (self, CHAN_BODY, "items/item1.wav", 1, ATTN_NORM); self.equipment = item; x = GetEquipmentName(); sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, " purchased.\n"); self.ammo_shells = (self.ammo_shells - cost); return; }; void (float cost, float item) BuyProtect = { local string x; /* if ((self.armor >= TE_LIGHTNING2)) { sprint (self, PRINT_HIGH, "too many electronics in\nyour currently worn armor!"); self.currentmenu = "none"; return; } */ if ((cost > self.ammo_shells)) { sprint (self, PRINT_HIGH, "not enough money.\n"); self.currentmenu = "none"; return; } sound (self, CHAN_BODY, "items/item1.wav", 1, ATTN_NORM); self.ammo_shells = (self.ammo_shells - cost); self.protect = item; x = GetProtectName(); sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, " purchased.\n"); return; }; float (float input) overweight = { local float tmp; local float max; tmp = input + self.weight; max = self.max_weight; if (self.class == TE_LIGHTNING2) { max = max + SPAWNFLAG_LASER; } if (self.perk == TE_LAVASPLASH) { return (FALSE); } if (tmp > max) { return (TRUE); } else { return (FALSE); } }; void () W_GetClass = { if ((self.currentmenu == "select_skill")) { sound (self, CHAN_WEAPON, "buttons/switch02.wav", TRUE, ATTN_NORM); if (self.impulse == 1) { self.currentmenu = "none"; self.max_health = 80; self.class = 1; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nMedic - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } if ((self.impulse == 2)) { self.currentmenu = "none"; self.max_health = 70; self.class = 2; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nAssassin - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } if (self.impulse == 3) { self.currentmenu = "none"; self.max_health = 100; self.class = 3; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nSoldiier - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } if (self.impulse == 4) { self.max_health = 80; self.currentmenu = "none"; self.class = 4; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nScientist - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } } if (self.impulse > 4) return; }; void() W_PlayerMenu = { if (self.currentmenu == "none") return; if (self.currentmenu == "shop_list") { if (self.impulse == 1) self.currentmenu = "shop_trait"; if (self.impulse == 2) self.currentmenu = "shop_perk"; if (self.impulse == 3) self.currentmenu = "shop_armor"; if (self.impulse == 4) self.currentmenu = "shop_protect"; if (self.impulse == 5) self.currentmenu = "shop_weapons"; if (self.impulse == 6) self.currentmenu = "shop_equipment"; if (self.impulse == 7) self.currentmenu = "shop_chems"; if (self.impulse == 8) self.currentmenu = "shop_other"; DisplayMenu(); return; } if (self.currentmenu == "shop_trait") { if (self.impulse == 1) self.currentmenu = "shop_trait"; if (self.impulse == 2) self.currentmenu = "shop_perk"; if (self.impulse == 3) self.currentmenu = "shop_armor"; if (self.impulse == 4) self.currentmenu = "shop_protect"; if (self.impulse == 5) self.currentmenu = "shop_weapons"; if (self.impulse == 6) self.currentmenu = "shop_equipment"; if (self.impulse == 7) self.currentmenu = "shop_chems"; if (self.impulse == 8) self.currentmenu = "shop_other"; DisplayMenu(); return; } if (self.currentmenu == "shop_perk") { if (self.impulse == 1) BuyPerk(1, 1); if (self.impulse == 2) BuyPerk(1, 2); if (self.impulse == 3) BuyPerk(1, 3); if (self.impulse == 4) BuyPerk(2, 4); if (self.impulse == 5) BuyPerk(2, 5); if (self.impulse == 6) BuyPerk(2, 6); if (self.impulse == 7) BuyPerk(2, 7); if (self.impulse == 8) BuyPerk(3, 8); if (self.impulse == 9) BuyPerk(4, 9); return; } if (self.currentmenu == "shop_armor") { if (self.impulse == 1) BuyArmor(3, 03, IID_ARM_SHIRT); //weight, cost, item if (self.impulse == 2) BuyArmor(7, 05, IID_ARM_LEATHER); //weight, cost, item if (self.impulse == 3) BuyArmor(9, 10, IID_ARM_KEVLAR); //weight, cost, item if (self.impulse == 4) BuyArmor(15, 12, IID_ARM_METAL); //weight, cost, item if (self.impulse == 5) BuyArmor(12, 25, IID_ARM_COMBAT); //weight, cost, item if (self.impulse == 6) BuyArmor(17, 35, IID_ARM_BROTHERHOOD); //weight, cost, item if (self.impulse == 7) BuyArmor(5, 45, IID_ARM_FORCE); //weight, cost, item if (self.impulse == 8) BuyArmor(20, 55, IID_ARM_LPOWER); //weight, cost, item return; } if (self.currentmenu == "shop_protect") { if (self.impulse == 1) BuyProtect(20, 1); if (self.impulse == 2) BuyProtect(20, 2); if (self.impulse == 3) BuyProtect(30, 3); if (self.impulse == 4) BuyProtect(30, 4); if (self.impulse == 5) BuyProtect(40, 5); return; } if (self.currentmenu == "shop_weapons") { if (self.impulse == 1) self.currentmenu = "shop_melee"; if (self.impulse == 2) self.currentmenu = "shop_thrown"; if (self.impulse == 3) self.currentmenu = "shop_pistols"; if (self.impulse == 4) self.currentmenu = "shop_shotguns"; if (self.impulse == 5) self.currentmenu = "shop_rifles"; DisplayMenu(); return; } if (self.currentmenu == "shop_melee") { if (self.impulse == 1) BuyWeapon(1, 1, IID_WP_KNIFE); //weight, cost, item if (self.impulse == 2) BuyWeapon(6, 3, IID_WP_AXE); //weight, cost, item if (self.impulse == 3) BuyWeapon(3, 10, IID_WP_VIBROBLADE); //weight, cost, item if (self.impulse == 4) BuyWeapon(10, 15, IID_WP_POWERAXE); //weight, cost, item return; } if (self.currentmenu == "shop_thrown") { if (self.impulse == 1) BuyGrenade(3, 1); //weight, cost, item if (self.impulse == 2) BuyGrenade(4, 2); //weight, cost, item if (self.impulse == 3) BuyGrenade(5, 3); //weight, cost, item if (self.impulse == 4) BuyGrenade(6, 4); //weight, cost, item return; } if (self.currentmenu == "shop_pistols") { if (self.impulse == 1) BuyWeapon(1, 5, IID_WP_USP); //weight, cost, item if (self.impulse == 2) BuyWeapon(2, 7, IID_WP_DEAGLE); //weight, cost, item if (self.impulse == 3) BuyWeapon(2, 9, IID_WP_NEEDLER); //weight, cost, item if (self.impulse == 4) BuyWeapon(3, 14, IID_WP_MP9); //weight, cost, item if (self.impulse == 5) BuyWeapon(3, 17, IID_WP_MP7); //weight, cost, item if (self.impulse == 6) BuyWeapon(2, 21, IID_WP_ALIENBLASTER); //weight, cost, item return; } if (self.currentmenu == "shop_shotguns") { if (self.impulse == 1) BuyWeapon(3, 3, IID_WP_PIPERIFLE); //weight, cost, item if (self.impulse == 2) BuyWeapon(4, 7, IID_WP_WINCHESTER); //weight, cost, item if (self.impulse == 3) BuyWeapon(5, 12, IID_WP_MOSSBERG); //weight, cost, item if (self.impulse == 4) BuyWeapon(7, 34, IID_WP_JACKHAMMER); //weight, cost, item return; } if (self.currentmenu == "shop_rifles") { if (self.impulse == 1) BuyWeapon(3, 11, IID_WP_RANGERMASTER); //weight, cost, item if (self.impulse == 2) BuyWeapon(4, 21, IID_WP_AK112); //weight, cost, item if (self.impulse == 3) BuyWeapon(5, 25, IID_WP_AK74); //weight, cost, item if (self.impulse == 4) BuyWeapon(6, 28, IID_WP_DKS1); //weight, cost, item if (self.impulse == 5) BuyWeapon(5, 30, IID_WP_MOONLIGHT); //weight, cost, item if (self.impulse == 6) BuyWeapon(4, 32, IID_WP_SA80); //weight, cost, item if (self.impulse == 7) BuyWeapon(7, 40, IID_WP_GAUSERIFLE); //weight, cost, item if (self.impulse == 8) BuyWeapon(10, 45, IID_WP_PULSERIFLE); //weight, cost, item return; } if (self.currentmenu == "shop_equipment") { if (self.impulse == 1) BuyEquipment(20, 1); //cost, item if (self.impulse == 2) BuyEquipment(20, 2); //cost, item if (self.impulse == 3) BuyEquipment(20, 3); //cost, item if (self.impulse == 4) BuyEquipment(20, 4); //cost, item if (self.impulse == 5) BuyEquipment(20, 5); //cost, item if (self.impulse == 6) BuyEquipment(20, 6); //cost, item if (self.impulse == 7) BuyEquipment(20, 7); //cost, item if (self.impulse == 8) BuyEquipment(20, 8); //cost, item if (self.impulse == 9) BuyEquipment(20, 9); //cost, item if (self.impulse == 10) BuyEquipment(20, 10); //cost, item return; } if (self.currentmenu == "shop_chems") { if (self.impulse == 1) BuyChem(3, 1); //cost, item if (self.impulse == 2) BuyChem(5, 2); //cost, item if (self.impulse == 3) BuyChem(10, 3); //cost, item if (self.impulse == 4) BuyChem(12, 4); //cost, item if (self.impulse == 5) BuyChem(18, 5); //cost, item if (self.impulse == 6) BuyChem(21, 6); //cost, item } if (self.currentmenu == "shop_other") return; if (self.currentmenu == "select_team") { if (self.impulse == 1) { bprint(2, self.netname); bprint(2, " has joined the rangers.\n"); self.currentmenu = "confirm_team"; DisplayMenu(); self.team = 1; return; } if (self.impulse == 2) { bprint(2, self.netname); bprint(2, " has joined the raiders.\n"); self.currentmenu = "confirm_team"; DisplayMenu(); self.team = 2; return; } } if (self.currentmenu == "select_skill") { sound (self, CHAN_WEAPON, "buttons/switch02.wav", TRUE, ATTN_NORM); if (self.impulse == 1) { self.currentmenu = "none"; self.max_health = 80; self.class = 1; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nMedic - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } if ((self.impulse == 2)) { self.currentmenu = "none"; self.max_health = 70; self.class = 2; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nAssassin - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } if (self.impulse == 3) { self.currentmenu = "none"; self.max_health = 100; self.class = 3; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nSoldiier - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } if (self.impulse == 4) { self.max_health = 80; self.currentmenu = "none"; self.class = 4; self.currentmenu = "confirm_skill"; centerprint (self, "your class will be\n\nScientist - OK?\n1 Yes \n2 No \n"); self.ghost = 0; return; } } if (self.currentmenu == "confirm_team") { if (self.impulse == 1) { sound (self, CHAN_WEAPON, "buttons/switch02.wav", TRUE, ATTN_NORM); self.currentmenu = "select_skill"; DisplayMenu(); self.impulse = 0; return; } if (self.impulse == 2) { sound (self, CHAN_WEAPON, "buttons/switch02.wav", TRUE, ATTN_NORM); self.currentmenu = "select_team"; DisplayMenu(); self.impulse = 0; self.team = 0; return; } } if (self.currentmenu == "confirm_skill") { if (self.impulse == 1) { sound (self, CHAN_WEAPON, "buttons/switch02.wav", TRUE, ATTN_NORM); self.currentmenu = "none"; PutClientInServer(); self.impulse = 0; return; } if (self.impulse == 2) { sound (self, CHAN_WEAPON, "buttons/switch02.wav", TRUE, ATTN_NORM); self.currentmenu = "select_skill"; DisplayMenu(); self.impulse = 0; self.class = 0; return; } } };