Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

QCZM DSR???????????????????????????????????????????????????????????

Опубликовано:

// QCZM IW5 - TheApadayo & DidUknowiPwn 2012
// main mod module
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using InfinityScript;

namespace DUKIP
{
   public class ZombieMod : BaseScript
   {
       private Random _rng = new Random();

       private bool _isIntermission;
       private bool _isGrace;
       private HudElem info;
       private HudElem countdown;
       //private static int hudUpdateRate = 500;

       public ZombieMod()
           : base()
       {
           changeGametype("QCZM");
           _isGrace = true;
           Call("setdvar", "motd", "Welcome to ^0QCZM ^7by ^1TheApadayo^7 and ^5DidUknowiPwn^7! Scroll through the shop with " +
               "^3[{+smoke}] ^7and ^3[{+actionslot 1}]^7. Report all glitches on the 4D1 forums to either ^1TheApadayo^7 or ^5DidUknowiPwn^7.");
           createServerHud();
           Utilities.SetDropItemEnabled(false);
           _rng = new Random();
           string env = getMapEnv(Call("getdvar", "mapname"));
           Call("setdvar", "env1", env);
           Call("precachemodel", "mp_body_ally_ghillie_" + env + "_sniper");
           // viewmodel is different from playermodel on outpost
           if (Call("getdvar", "mapname").Equals("mp_radar"))
               env = "arctic";
           Call("setdvar", "env2", env);
           Call("precachemodel", "viewhands_iw5_ghillie_" + env);

           // zombies won or all zombies left
           OnInterval(5000, () =>
           {
               if (_isGrace || _isIntermission)
                   return true;
               if (getTeamCount("allies") == 0 || getTeamCount("axis") == 0)
               {
                   AfterDelay(3000, () =>
                   {
                       // check again because someone might have been respawning
                       if (getTeamCount("allies") == 0 || getTeamCount("axis") == 0)
                       {
                           CallOnPlayers(entity => doIntermission(entity));
                           doCredits();
                           AfterDelay(3000, () =>
                           {
                               doGrace(60);
                           });
                       }
                   });
               }
               return true;
           });

           PlayerConnected += new Action(entity =>
           {
               // dvar shit
               entity.SetField("connected", 1); // for getplayers func
               Call("setdvar", "g_TeamName_Allies", "Humans");
               Call("setdvar", "g_TeamIcon_Allies", "cardicon_comic_price"); //need to change
               Call("setdvar", "g_TeamName_Axis", "Zombies");
               Call("setdvar", "g_teamIcon_Axis", "cardicon_skull_black");
               Call("precacheshader", "cardicon_skull_black");
               Call("precacheshader", "cardicon_league_magnum");
               Call("setdvar", "g_ScoresColor_Spectator", ".25 .25 .25");
               Call("setdvar", "g_ScoresColor_Free", ".76 .78 .10");
               Call("setdvar", "g_teamColor_MyTeam", ".6 .8 .6");
               Call("setdvar", "g_teamColor_EnemyTeam", "1 .45 .5");
               Call("setdvar", "g_teamTitleColor_MyTeam", ".6 .8 .6");
               Call("setdvar", "g_teamTitleColor_EnemyTeam", "1 .45 .5");
               Call("setdvar", "ui_allow_teamchange", "0");
               Call(42, "lowAmmoWarningNoAmmoColor1", 0, 0, 0, 0);
               Call(42, "lowAmmoWarningNoAmmoColor2", 0, 0, 0, 0);
               Call(42, "lowAmmoWarningColor1", 0, 0, 0, 0);
               Call(42, "lowAmmoWarningColor2", 0, 0, 0, 0);
               Call(42, "lowAmmoWarningNoReloadColor1", 0, 0, 0, 0);
               Call(42, "lowAmmoWarningNoReloadColor1", 0, 0, 0, 0);

               // custom fields init
               entity.SetField("lives", 0);
               entity.SetField("maxhp", 100);
               entity.SetField("maxhealth", 100);
               entity.SetField("cash", 0);
               entity.SetField("credits", 0);
               entity.SetField("camo", 0);
               entity.SetField("reticle", 0);
               entity.SetField("round_zomkills", 0);
               entity.SetField("round_playerkills", 0);
               entity.SetField("round_deaths", 0);
               entity.SetField("totalkills", 0);
               entity.SetField("hasoverlay", 0);
               entity.SetField("lethal", "frag_grenade_mp");
               entity.SetField("zombie_alpha", 0);
               entity.SetField("zombie_stalker", 0);
               entity.SetField("zombie_quieter", 0);
               entity.SetField("zombie_falldamage", 0);
               entity.SetField("player_thething", 0);
               entity.SetField("player_antialpha", 0);
               entity.SetField("movespeed", 1f);
               GameStore.createStoreHUD(entity);
               createScorePopup(entity);
               entity.SpawnedPlayer += new Action(() =>
               {
                   // should fix the invincible player glitch
                   // caused by a sesionteam/team of ""
                   // also disables spectators... neat
                   if(entity.GetField("sessionteam") != "axis" && entity.GetField("sessionteam") != "allies")
                   {
                       setPlayerTeam(entity, "axis");
                       entity.Call("suicide");
                       return;
                   }
                   entity.TakeAllWeapons();
                   entity.Call("clearPerks");
                   string smg = WeaponUtils.getRandomSMG();
                   entity.AfterDelay(100, player =>
                   {
                       player.SwitchToWeaponImmediate(smg);
                   });
                   if (!entity.HasField("firstspawn"))
                   {
                       createPlayerHud(entity);
                       doPlayerStore(entity);
                       doZombieStore(entity);
                       doCreditStore(entity);
                       entity.SetField("firstspawn", 1);
                   }
                   if (entity.GetField("sessionteam") == "axis")
                   {
                       if (_isGrace)
                       {
                           // switch all players from zombies team during grace
                           setPlayerTeam(entity, "allies");
                           entity.Call("suicide");
                           return;
                       }
                       else
                       {
                           spawnZombie(entity);
                       }
                   }
                   else if (entity.GetField("sessionteam") == "allies")
                   {
                       if (!_isGrace)
                       {
                           if (entity.GetField("lives") > 0 && entity.GetField("zombie_alpha") != 1)
                           {
                               entity.SetField("lives", entity.GetField("lives") - 1);
                               entity.Call("iprintlnbold", "Used Life!");
                           }
                           else
                           {
                               setPlayerTeam(entity, "axis");
                               entity.SetField("round_deaths", 0); // reset deaths on team change
                               entity.Call("suicide");
                               return;
                           }
                       }
                       spawnPlayer(entity);
                   }
               });

               // skip start menu
               entity.OnNotify("joined_team", player =>
               {
                   entity.Call("closePopupMenu");
                   entity.Call("closeIngameMenu");
                   entity.Notify("menuresponse", "changeclass", "class0");
                   // hide the default xp popup
                   // need a field id number
                   // entity.GetField("hud_xpPointsPopup").SetPoint("TOPLEFT", "TOPLEFT", -200);
               });

               // disable changeclass menu
               entity.OnNotify("menuresponse", (player, menu, response) =>
               {
                   if (menu.ToString().Equals("class") && response.ToString().Equals("changeclass_marines"))
                   {
                       AfterDelay(100, () =>
                       {
                           entity.Notify("menuresponse", "changeclass", "back");
                       });
                   }
               });

               entity.Notify("menuresponse", "team_marinesopfor", "allies");

               // handle speed changes
               OnInterval(100, () =>
               {
                   entity.Call("setmovespeedscale", new Parameter(entity.GetField("movespeed")));
                   return true;
               });
           });
           OnNotify("prematch_done", () =>
           {
               doGrace(60);
           });
       }

       public override void OnSay(Entity player, string name, string message)
       {
           if (!(Call("getdvarint", "mapedit_allowcheats") == 1 && (player.GetField("name") == "TheApadayo" || player.GetField("name") == "DidUknowiPwn")))
               return;
           if (message.Equals("endround"))
           {
               CallOnPlayers(entity => doIntermission(entity));
               doCredits();
               AfterDelay(3000, () =>
               {
                   doGrace(60);
               });
           }
       }

       private void spawnZombie(Entity entity)
       {
           if (entity.GetField("zombie_alpha") == 1)
           {
               entity.SetField("cash", 50);
               entity.SetField("maxhp", 150);
               entity.SetField("zombie_alpha", 0);
           }
           if (entity.GetField("zombie_quieter") == 1)
           {
               entity.SetPerk("specialty_quieter", true, false);
           }
           if (entity.GetField("zombie_stalker") == 1)
           {
               entity.SetPerk("specialty_stalker", true, false);
           }
           if (entity.GetField("zombie_falldamage") == 1)
           {
               entity.SetPerk("zombie_falldamage", true, false);
           }
           entity.Call("setmodel", "mp_body_ally_ghillie_" + Call("getdvar", "env1") + "_sniper");
           entity.Call("setviewmodel", "viewhands_iw5_ghillie_" + Call("getdvar", "env2"));
           entity.Call("closePopupMenu");
           entity.Call("closeIngameMenu");
           entity.TakeWeapon("frag_grenade_mp");
           entity.Call("giveweapon", "iw5_usp45_mp_tactical");
           entity.Call("setWeaponAmmoClip", "iw5_usp45_mp_tactical", "0");
           entity.Call("setWeaponAmmoStock", "iw5_usp45_mp_tactical", "0");
           entity.SetPerk("specialty_lightweight", true, true);
           entity.SetPerk("specialty_longersprint", true, true);
           entity.Call("visionsetnakedforplayer", "ac130_thermal_mp", 0);
           entity.SetField("maxhealth", entity.GetField("maxhp"));
           entity.Health = entity.GetField("maxhp");
           entity.AfterDelay(1, player =>
           {
               player.SwitchToWeaponImmediate("iw5_usp45_mp_tactical");
           });
           if (entity.GetField("hasoverlay") == 1)
           {
               entity.Call("ThermalVisionFOFOverlayOn"); // in case they bought it
           }
           entity.SetField("movespeed", 1.14f); //give them a slight speed increase

           // custom scoring part 2
           AfterDelay(1, () =>
           {
               int kills = entity.GetField("round_zomkills");
               entity.SetField("score", kills * 100);
               entity.SetField("deaths", entity.GetField("round_deaths"));
               entity.SetField("kills", kills);
           });
       }
       private void spawnPlayer(Entity entity)
       {
           entity.Call("closePopupMenu");
           entity.Call("closeIngameMenu");
           //entity.Notify("menuresponse", "changeclass", "class1"); <- Was fucking up the give weapon on spawn >_>
           entity.TakeAllWeapons();
           int camo = entity.GetField("camo");
           int reticle = entity.GetField("reticle");
           string smg = WeaponUtils.getRandomSMG(camo, reticle);
           entity.Call("giveweapon", smg);
           entity.Call("giveMaxAmmo", smg);
           string shotgun = WeaponUtils.getRandomShotgun(camo, reticle);
           entity.Call("giveweapon", shotgun);
           entity.Call("giveMaxAmmo", shotgun);
           string pistol = WeaponUtils.getRandomPistol(camo, reticle);
           entity.Call("giveweapon", pistol);
           entity.Call("giveMaxAmmo", pistol);
           entity.Call("giveweapon", entity.GetField("lethal"));
           entity.SetField("fragcount", 5);
           entity.Call("setweaponammoclip", entity.GetField("lethal"), 0);
           if (_isGrace) // if player respawned during game (with lives) dont reset their cash
               entity.SetField("cash", 0);
               //entity.Call("visionsetnaked", "cobra_sunset3", true);
           entity.SetField("movespeed", 1f); // make sure they have normal speed
           entity.AfterDelay(100, player =>
           {
               player.SwitchToWeaponImmediate(smg);
           });
           OnNotify("prematch_done", () =>
           {
               entity.SwitchToWeaponImmediate(smg);
           });
           entity.OnInterval(100, player =>
           {
               if (_isGrace) return true;
               if (entity.Call("getammocount", entity.GetField("lethal")) == 0 && entity.GetField("fragcount") > 0)
               {
                   entity.Call("setweaponammoclip", entity.GetField("lethal"), 1);
                   entity.SetField("fragcount", entity.GetField("fragcount") - 1);
               }
               return true;
           });

           // custom scoring part 2
           AfterDelay(1, () =>
           {
               int kills = entity.GetField("round_playerkills");
               entity.SetField("score", 0);
               entity.SetField("deaths", entity.GetField("round_deaths"));
               entity.SetField("kills", kills);
           });
       }

       public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
       {
           string playerWeapon = player.CurrentWeapon;
           // cleanup weapons
           OnInterval(100, () =>
           {
               Entity ent = Call("getent", "weapon_" + playerWeapon, "classname");
               if (ent != null)
               {
                   ent.Call("delete");
                   return false;
               }
               else
               {
                   return true;
               }
           });
           // custom score part 1
           if (attacker != null)
           {
               if (attacker.IsPlayer && attacker.IsAlive)
               {
                   if (attacker.GetField("sessionteam") == "allies")
                   {
                       // do custom scoring
                       AfterDelay(1, () =>
                       {
                           int kills = attacker.GetField("round_playerkills");
                           attacker.SetField("score", kills * 100);
                           attacker.SetField("deaths", 0);
                           attacker.SetField("kills", kills);
                           kills = player.GetField("round_zomkills");
                           player.SetField("score", kills * 100);
                           player.SetField("deaths", player.GetField("round_deaths"));
                           player.SetField("kills", kills);
                       });
                   }
                   else
                   {
                       AfterDelay(1, () =>
                       {
                           int kills = attacker.GetField("round_zomkills");
                           attacker.SetField("score", kills * 100);
                           attacker.SetField("deaths", player.GetField("round_deaths"));
                           attacker.SetField("kills", kills);
                           player.SetField("score", 0);
                           player.SetField("deaths", 0);
                           player.SetField("kills", 0);
                       });
                   }
               }
           }

           // stuff after only happens when in game
           if (_isIntermission || _isGrace) return;
           // game called suicide... ignore these
           if (player == inflictor && inflictor == attacker) return;

           // award score
           if (attacker != null)
           {
               if (attacker.IsPlayer && attacker.IsAlive)
               {
                   if (attacker.GetField("sessionteam") == "allies")
                   {
                       if (mod == "MOD_MELEE")
                       {
                           attacker.SetField("cash", attacker.GetField("cash") + 200);
                           //attacker.Call("iprintlnbold", "Melee Kill! ^1+200");
                           doScorePopUp(attacker, "Melee Kill! ^1+{0}", 200);
                           attacker.SetField("round_playerkills", attacker.GetField("round_playerkills") + 1);
                       }
                       else
                       {
                           attacker.SetField("cash", attacker.GetField("cash") + 50);
                           //attacker.Call("iprintlnbold", "Killed Zombie. ^1+50");
                           doScorePopUp(attacker, "Killed Zombie. ^1+{0}", 50);
                           attacker.SetField("round_playerkills", attacker.GetField("round_playerkills") + 1);
                       }
                       player.SetField("cash", player.GetField("cash") + 50);
                       player.SetField("round_deaths", player.GetField("round_deaths") + 1);
                       //player.Call("iprintlnbold", "Died! ^1+50");
                       doScorePopUp(player, "Died! ^1+{0}", 50);
                   }
                   else
                   {
                       attacker.SetField("cash", attacker.GetField("cash") + 100);
                       //attacker.Call("iprintlnbold", "Killed Human! ^1+100");
                       doScorePopUp(attacker, "Killed Human! ^1+{0}", 100);
                       attacker.SetField("round_zomkills", attacker.GetField("round_zomkills") + 1);
                       player.SetField("round_deaths", player.GetField("round_deaths") + 1);
                   }
               }
           }
       }

       private void doIntermission(Entity entity)
       {
           _isIntermission = true;
           entity.Call("freezecontrols", true);
           Call("visionsetnaked", "blacktest", 2);
           info.SetText("^1Round is over. ^7Prepare for the next round");
           AfterDelay(1500, () =>
           {
               info.Call("destroy");
           });
           AfterDelay(3000, () =>
           {
               entity.Call("freezecontrols", false);
               Call("visionsetnaked", Call("getdvar", "mapname"));
               entity.Call("ThermalVisionFOFOverlayOff"); // in case they bought it
               entity.Call("suicide");
               _isIntermission = false;
               MapEdit.runOnUsable((center) =>
               {
                   center.Call(33399, new Parameter(center.GetField("open")), 1); // moveto
                   center.SetField("state", "open");
                   center.SetField("hp", center.GetField("maxhp"));
                   return true;
               }, "door");
               //doGrace(60);
           });
       }

       private void doCredits()
       {
           List players = getPlayers(false).ToList();
           List zombies = new List();
           players.Sort(delegate(Entity e1, Entity e2)
           {
               return e1.GetField("round_playerkills").CompareTo(e2.GetField("round_playerkills"));
           });
           players.Reverse();
           int playercount = (int)(players.Count * 0.3);
           //print("top 30 percent is {0}", playercount);
           int i = 0;

           if (playercount > players.Count)
               playercount = players.Count;

           foreach (Entity p in players)
           {
               if (i < playercount)
               {
                   p.Call("iprintlnbold", "You were rank ^3" + (i + 1) + "^7 as a human. You get " + (p.GetField("round_playerkills") * 50) + " Credits!");
                   p.SetField("credits", p.GetField("credits") + (p.GetField("round_playerkills") * 50));
                   //print("Player {0} placed {1} with {2} kills", i, p.GetField("name"), p.GetField("round_playerkills"));
               }
               else
               {
                   p.Call("iprintlnbold", "You did not place this round");
                   //print("Player {0} did not place {1} with {2} kills", i, p.GetField("name"), p.GetField("round_playerkills"));
                   zombies.Add(p);
               }
               p.SetField("round_playerkills", 0);
               p.SetField("round_deaths", 0);
               i++;
           }

           if (playercount > zombies.Count)
               playercount = zombies.Count;

           zombies.Sort(delegate(Entity e1, Entity e2)
           {
               return e1.GetField("round_zomkills").CompareTo(e2.GetField("round_zomkills"));
           });
           zombies.Reverse();
           i = 0;
           foreach (Entity p in zombies)
           {
               if (i < playercount)
               {
                   p.Call("iprintlnbold", "You were rank ^1" + (i + 1) + "^7 as a zombie. You get " + (p.GetField("round_zomkills") * 50) + " Credits!");
                   p.SetField("credits", p.GetField("credits") + (p.GetField("round_zomkills") * 200));
                   //print("Zombie {0} placed {1} with {2} kills", i, p.GetField("name"), p.GetField("round_zomkills"));
               }
               else
               {
                   p.Call("iprintlnbold", "You did not place this round");
                   //print("Zombie {0} did not place {1} with {2} kills", i, p.GetField("name"), p.GetField("round_zomkills"));
               }
               p.SetField("round_zomkills", 0);
               i++;
           }
       }

       private void doGrace(int seconds)
       {
           //info.SetText("^2Prepare for ^1Alphas!");
           print("began grace period for {0} seconds", seconds);
           _isGrace = true;
           int waited = seconds;
           // reset perks
           CallOnPlayers((ent) =>
           {
               ent.SetField("zombie_stalker", 0);
               ent.SetField("zombie_quieter", 0);
               //ent.SetField("zombie_falldamage", 0);
               ent.SetField("hasoverlay", 0);
           });
           OnInterval(1000, () =>
           {
               if (waited == 0)
               {
                   return false;
               }
               countdown.SetText("^3" + waited.ToString() + " seconds remaining until round begins.");
               if (waited < 11)
               {
                   // ticking
                   // ui_mp_suitcasebomb_timer
                   CallOnPlayers((ent) => ent.Call("playlocalsound", "ui_mp_nukebomb_timer"));
               }
               waited--;
               return true;
           });
           AfterDelay(seconds * 1000, () =>
           {
               info.SetText("^2Alphas ^7Have Spawned!");
               countdown.SetText("");
               _isGrace = false;
               doAlpha(); // call after _isGrace is false so when people die they respawn as zombies.
               OnInterval(100, () => // fade out text
               {
                   if (info.Alpha == 0)
                   {
                       info.SetText("");
                       info.Alpha = 1;
                       return false;
                   }
                   info.Alpha -= 0.02f; // should last 5 seconds
                   return true;
               });
               // shouldnt crash now as it checkes for lethal existing as well as
               // player list not including those without conencted....
               CallOnPlayers(entity =>
               {
                   if (!entity.HasField("lethal")) return; // connecting
                   entity.Call("setweaponammoclip", entity.GetField("lethal"), 1);
                   entity.Call("playlocalsound", "mp_war_objective_taken");
                   Call("visionsetnaked", "cobra_sunset3", true);
               });
           });
       }

       private void doAlpha()
       {
           List players = getPlayers(false).ToList();
           for (int i = 0; i < players.Count; i++)
           {
               if (players.ElementAt(i).GetField("sessionteam").Equals("spectator"))
               {
                   players.RemoveAt(i);
                   i--;
               }
           }
           AfterDelay(3000, () =>
           {
               info.Call("destroy");
           });
           // no one on server, just do grace period
           if (players.Count == 0)
           {
               _isIntermission = true;
               print("no players found in server, redoing grace period.");
               doGrace(60);
               return;
           }
           int alphas = 0;
           int[] alphaindex = { -1, -1, -1 };
           _rng = new Random();
           if (players.Count < 5)
           {
               alphaindex[0] = _rng.Next(players.Count - 1);
               alphas = 1;
           }
           else if (players.Count < 14)
           {
               alphaindex[0] = _rng.Next(players.Count - 1);

               alphaindex[1] = _rng.Next(players.Count - 1);
               while(alphaindex[0] == alphaindex[1])
                   alphaindex[1] = _rng.Next(players.Count - 1);

               alphas = 2;
           }
           else
           {
               alphaindex[0] = _rng.Next(players.Count - 1);

               alphaindex[1] = _rng.Next(players.Count - 1);
               while (alphaindex[0] == alphaindex[1])
                   alphaindex[1] = _rng.Next(players.Count - 1);

               alphaindex[2] = _rng.Next(players.Count - 1);
               while (alphaindex[0] == alphaindex[2] || alphaindex[1] == alphaindex[2])
                   alphaindex[2] = _rng.Next(players.Count - 1);

               alphas = 3;
           }
           print("there are {0} players in server... chosing {1} alphas", players.Count, alphas);

           for (int i = 0; i < alphas; i++)
           {
               players[alphaindex[i]].Call("suicide");
               players[alphaindex[i]].SetField("zombie_alpha", 1);
           }
       }

       private void createServerHud()
       {
           info = HudElem.CreateServerFontString("hudbig", 1f);
           info.SetPoint("CENTER", "CENTER", 0, -200);
           info.HideWhenInMenu = true;
           info.SetText("");

           countdown = HudElem.CreateServerFontString("hudbig", 0.8f);
           countdown.SetPoint("CENTER", "CENTER", 0, -180);
           countdown.HideWhenInMenu = true;
           countdown.SetText("");

           HudElem motd = HudElem.CreateServerFontString("boldFont", 1f);
           motd.SetPoint("CENTER", "BOTTOM", 0, -19);
           motd.Foreground = true;
           motd.HideWhenInMenu = true;
           OnInterval(25000, () =>
           {
               motd.SetText(Call("getdvar", "motd"));
               motd.SetPoint("CENTER", "BOTTOM", 1100, -10);
               motd.Call("moveovertime", 25);
               motd.X = -700;
               return true;
           });
       }

       private void createPlayerHud(Entity player)
       {
           HudElem health = HudElem.CreateFontString(player, "hudbig", 0.9f);
           health.SetPoint("TOP RIGHT", "TOP RIGHT", -10, 0);
           health.HideWhenInMenu = true;

           HudElem healthtext = HudElem.CreateFontString(player, "hudbig", 0.9f);
           healthtext.SetPoint("TOP RIGHT", "TOP RIGHT", -50, 0);
           healthtext.HideWhenInMenu = true;

           HudElem money = HudElem.CreateFontString(player, "hudbig", 0.9f);
           money.SetPoint("TOP RIGHT", "TOP RIGHT", -10, 15); //25 original
           money.HideWhenInMenu = true;

           HudElem moneytext = HudElem.CreateFontString(player, "hudbig", 0.9f);
           moneytext.SetPoint("TOP RIGHT", "TOP RIGHT", -50, 15); //25 original
           moneytext.HideWhenInMenu = true;

           HudElem lives = HudElem.CreateFontString(player, "hudbig", 0.9f);
           lives.SetPoint("TOP RIGHT", "TOP RIGHT", -10, 30); //50 original
           lives.HideWhenInMenu = true;

           HudElem livestext = HudElem.CreateFontString(player, "hudbig", 0.9f);
           livestext.SetPoint("TOP RIGHT", "TOP RIGHT", -50, 30); //50 original
           livestext.HideWhenInMenu = true;

           OnInterval(100, () =>
           {
               health.Call("setvalue", player.Health);
               healthtext.Call("settext", "^1Health: ^7");

               if (!_isGrace)
               {
                   moneytext.SetText("^2Cash: ^7");
                   money.Call("setvalue", player.GetField("cash"));
               }
               else
               {
                   moneytext.SetText("^2Credits: ^7");
                   money.Call("setvalue", player.GetField("credits"));
               }
               livestext.SetText("^3Lives: ^7");
               lives.Call("setvalue", player.GetField("lives"));
               return true;
           });
       }

       private void doPlayerStore(Entity player)
       {
           GameStore store = new GameStore(player);
           store.doStoreWhen(() =>
           {
               return (player.GetField("sessionteam") == "allies" && !_isGrace);
           });

           GameStore.StoreEntry entry = new GameStore.StoreEntry();
           entry.name = "Buy ammo for current weapon";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               if (player.CurrentWeapon.Equals("defaultweapon_mp")) return "Cannot buy ammo for the Door repair tool!";
               player.Call("givemaxammo", player.CurrentWeapon);
              // player.Call("iprintlnbold", "Bought Max Ammo");
              // ScorePopUp(player, "Derpies");
               return "";
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Upgrade Weapon";
           entry.price = 150;
           entry.action = new Func(() =>
           {
               return upgradeWeapon(player);
           });
           entry.remainingbuys = 3;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Riotshield";
           entry.price = 250;
           entry.action = new Func(() =>
           {
               player.GiveWeapon("riotshield_mp");
               player.SwitchToWeaponImmediate("riotshield_mp");
               player.Call("iprintlnbold", "Bought Riotshield");
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Upgrade to Akimbo";
           entry.price = 150;
           entry.action = new Func(() =>
           {
               return giveAttachment(player, "akimbo");
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Upgrade to XMags";
           entry.price = 150;
           entry.action = new Func(() =>
           {
               return giveAttachment(player, "xmags");
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Upgrade to Red Dot";
           entry.price = 50;
           entry.action = new Func(() =>
           {
               return giveAttachment(player, "reflex");
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Sleight of Hand";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_fastreload") > 0)
               {
                   player.SetPerk("specialty_quickswap", true, false);
                   player.Call("iprintlnbold", "Bought ^2Sleight of Hand Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_fastreload", true, false);
               player.Call("iprintlnbold", "Bought ^2Sleight of Hand!");
               return "";
           });
           entry.remainingbuys = 1;
           /*entry.formatName = new Func(() =>
           {
               if (player.Call("hasperk", "specialty_fastreload") > 0)
                   return entry.name + " Pro - " + entry.price;
               else
                   return entry.name + " - " + entry.price;
           });*/
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Sitrep";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_detectexplosive") > 0)
               {
                   player.SetPerk("specialty_selectivehearing", true, false);
                   player.Call("iprintlnbold", "Bought ^2Sitrep Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_detectexplosive", true, false);
               player.Call("iprintlnbold", "Bought ^2Sitrep!");
               return "";
           });
           entry.remainingbuys = 1;
           /*entry.formatName = new Func(() =>
           {
               if (player.Call("hasperk", "specialty_detectexplosive") > 0)
                   return entry.name + " Pro - " + entry.price;
               else
                   return entry.name + " - " + entry.price;
           });*/
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Steady Aim";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_bulletaccuracy") > 0)
               {
                   player.SetPerk("specialty_fastsprintrecovery", true, false);
                   player.Call("iprintlnbold", "Bought ^2Steady Aim Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_bulletaccuracy", true, false);
               player.Call("iprintlnbold", "Bought ^4Steady Aim!");
               return "";
           });
           entry.remainingbuys = 1;
           /*entry.formatName = new Func(() =>
           {
               if (player.Call("hasperk", "specialty_bulletaccuracy") > 0)
                   return entry.name + " Pro - " + entry.price;
               else
                   return entry.name + " - " + entry.price;
           });*/
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Scavenger";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_scavenger") > 0)
               {
                   player.SetPerk("specialty_extraammo", true, false);
                   player.Call("iprintlnbold", "Bought ^2Scavenger Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_scavenger", true, false);
               player.Call("iprintlnbold", "Bought ^5Scavenger!");
               return "";
           });
           entry.remainingbuys = 1;
           /*entry.formatName = new Func(() =>
           {
               if (player.Call("hasperk", "specialty_scavenger") > 0)
                   return entry.name + " Pro - " + entry.price;
               else
                   return entry.name + " - " + entry.price;
           });*/
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Dead Silence";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_quieter") > 0)
               {
                   player.SetPerk("specialty_falldamage", true, false);
                   player.Call("iprintlnbold", "Bought ^8Dead Silence Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_quieter", true, false);
               player.Call("iprintlnbold", "Bought ^8Dead Silence!");
               return "";
           });
           entry.remainingbuys = 1;
           /* entry.formatName = new Func(() =>
            {
                if (player.Call("hasperk", "specialty_quieter") > 0)
                    return entry.name + " Pro - " + entry.price;
                else
                    return entry.name + " - " + entry.price;
            });*/
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Stalker";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_stalker") > 0)
               {
                   player.SetPerk("specialty_delaymine", true, false);
                   player.Call("iprintlnbold", "Bought ^6Stalker Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_stalker", true, false);
               player.Call("iprintlnbold", "Bought ^6Stalker!");
               return "";
           });
           entry.remainingbuys = 1;
           /*entry.formatName = new Func(() =>
           {
               if (player.Call("hasperk", "specialty_stalker") > 0)
                   return entry.name + " Pro - " + entry.price;
               else
                   return entry.name + " - " + entry.price;
           });*/
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Marksman";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               /*if (player.Call("hasperk", "specialty_marksman") > 0)
               {
                   player.SetPerk("specialty_holdbreath", true, false);
                   player.Call("iprintlnbold", "Bought ^7Marksman Pro!");
                   return "";
               }*/
               player.SetPerk("specialty_marksman", true, false);
               player.Call("iprintlnbold", "Bought ^7Marksman!");
               return "";
           });
           entry.remainingbuys = 1;
           /*entry.formatName = new Func(() =>
           {
               if (player.Call("hasperk", "specialty_marksman") > 0)
                   return entry.name + " Pro - " + entry.price;
               else
                   return entry.name + " - " + entry.price;
           });*/
           store.addEntry(entry);

           // meh... actually fixed it
           entry = new GameStore.StoreEntry();
           entry.name = "Buy Door Repair Tool";
           entry.price = 250;
           entry.action = new Func(() =>
           {
               player.GiveWeapon("defaultweapon_mp");
               AfterDelay(100, () => player.SwitchToWeaponImmediate("defaultweapon_mp"));
               player.SetField("repairsleft", 10);
               player.Call("iprintlnbold", "Bought ^7Door Repair Tool!");
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy The Thing";
           entry.price = 100;
           entry.action = new Func(() =>
           {
               if (player.GetField("player_thething") != 1)
                   return "[Locked]";
               player.Call("iprintlnbold", "Bought ^1The Thing!");
               player.Call("giveweapon", "iw5_deserteagle_mp"); //iw5_m60jugg_mp
               doCustomWeapon(player, "iw5_deserteagle", "ac130_25mm_mp");
               player.AfterDelay(100, entity =>
               {
                   player.SwitchToWeaponImmediate("iw5_deserteagle_mp"); //iw5_m60jugg_mp
               });
               /*OnInterval(100, () =>
               {
                   if(player.CurrentWeapon.Equals("iw5_desertagle_mp"))
                    {
                       player.Call("recoilscaleon", 0f);
                       return true;
                    }
                   return false;
               });*/ //Still being stupid I see.
               return "";
           });
           entry.remainingbuys = 1;
           entry.formatName = new Func(() =>
           {
               if (player.GetField("player_thething") != 1)
                   return "Locked";
               return "Buy The Thing - 100";
           });
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Suicide";
           entry.price = 0;
           entry.action = new Func(() =>
           {
               player.Call("suicide");
               return "";
           });
           entry.remainingbuys = -1;
           entry.formatName = new Func(() =>
           {
               return "Suicide";
           });
           store.addEntry(entry);
       }

       private void doZombieStore(Entity player)
       {
           GameStore store = new GameStore(player);
           store.doStoreWhen(() =>
           {
               return (player.GetField("sessionteam") == "axis" && !_isGrace);
           });

           GameStore.StoreEntry entry = new GameStore.StoreEntry();
           entry.name = "Increase Max Health";
           entry.price = 50;
           entry.action = new Func(() =>
           {
               if (player.GetField("maxhp") == 1500)
               {
                   return "Maximum health cannot be increased more!";
               }
               player.SetField("maxhp", player.GetField("maxhp") + 50);
               player.SetField("maxhealth", player.GetField("maxhp"));
               player.Health = player.GetField("maxhp");
               player.Call("iprintlnbold", "Increased Max Health");
               return "";
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           /*entry = new GameStore.StoreEntry();
           entry.name = "View Health";
           entry.price = 0;
           entry.action = new Func(() =>
           {
               player.Call("iprintlnbold", "Health is at: ^1" + player.Health + "^0/^1" + player.GetField("maxhp"));
               return "";
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);*/

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Thermal Overlay";
           entry.price = 200;
           entry.action = new Func(() =>
           {
               player.Call("ThermalVisionFOFOverlayOn");
               player.SetField("hasoverlay", 1);
               player.Call("iprintlnbold", "Bought Thermal Overlay");
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Throwing Knife";
           entry.price = 300;
           entry.action = new Func(() =>
           {
               player.Call("SetOffhandPrimaryClass", "throwingknife");
               player.GiveWeapon("throwingknife_mp");
               player.Call("setweaponammoclip", "throwingknife_mp", 1);
               player.Call("iprintlnbold", "Bought a Throwing Knife");
               return "";
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Stalker";
           entry.price = 200;
           entry.action = new Func(() =>
           {
               player.SetPerk("specialty_stalker", true, true);
               player.SetField("zombie_stalker", 1);
               player.Call("iprintlnbold", "Bought Stalker!");
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Dead Silence";
           entry.price = 200;
           entry.action = new Func(() =>
           {
               player.SetPerk("specialty_quieter", true, true);
               player.SetField("zombie_quieter", 1);
               player.Call("iprintlnbold", "Bought Dead Silence!");
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);

         /*  entry = new GameStore.StoreEntry();
           entry.name = "Buy No Fall Damage";
           entry.price = 300;
           entry.action = new Func(() =>
               {
                   player.SetPerk("specialty_falldamage", true, true);
                   player.SetField("zombie_falldamage", 1);
                   player.Call("iprintlnbold", "Bought No Fall Damage!");
                   return "";
               });
           entry.remainingbuys = 1;
           store.addEntry(entry);*/ //Not working for some reason.

           entry = new GameStore.StoreEntry();
           entry.name = "Buy Increased Speed";
           entry.price = 300;
           entry.action = new Func(() =>
           {
              // if (player.GetField("movespeed") == 1.5f)
                //   return "Already Bought!";
               player.Call("iprintlnbold", "Bought Increased Speed!");
               player.SetField("movespeed", 1.5f);
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Suicide";
           entry.price = 0;
           entry.action = new Func(() =>
           {
               player.Call("suicide");
               return "";
           });
           entry.remainingbuys = -1;
           entry.formatName = new Func(() =>
           {
               return "Suicide";
           });
           store.addEntry(entry);

       }

       private void doCreditStore(Entity player)
       {
           GameStore store = new GameStore(player);
           store.doStoreWhen(() =>
           {
               return _isGrace;
           });
           store.setCurrencyField("credits");

           GameStore.StoreEntry entry = new GameStore.StoreEntry();
           entry.name = "Buy A Life";
           entry.price = 250;
           entry.action = new Func(() =>
           {
               player.SetField("lives", player.GetField("lives") + 1);
               player.Call("iprintlnbold", "Bought a Life");
               return "";
           });
           entry.remainingbuys = -1;
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "";
           entry.formatName = new Func(() =>
           {
               string upgradeto = "";
               switch (player.GetField("lethal"))
               {
                   case "frag_grenade_mp":
                       upgradeto = "Semtex";
                       break;
                   case "semtex_mp":
                       upgradeto = "Claymore";
                       break;
                   case "claymore_mp":
                       upgradeto = "C4";
                       break;
                   case "c4_mp":
                       upgradeto = "Bouncing Betty";
                       break;
                   default:
                       return "Cannot Upgrade Equipment Further!";
               }
               return string.Format("Upgrade Equipment to {0} - 250", upgradeto);
           });
           entry.price = 250;
           entry.action = new Func(() =>
           {
               switch(player.GetField("lethal"))
               {
                   case "frag_grenade_mp":
                       player.SetField("lethal", "semtex_mp");
                       player.Call("iprintlnbold", "Upgraded to Semtex");
                       player.Call("giveweapon", player.GetField("lethal"));
                       player.Call("setweaponammoclip", player.GetField("lethal"), 0);
                       entry.name = "Upgrade to Claymore";
                       break;
                   case "semtex_mp":
                       player.SetField("lethal", "claymore_mp");
                       player.Call("iprintlnbold", "Upgraded to Claymore");
                       player.Call("giveweapon", player.GetField("lethal"));
                       player.Call("setweaponammoclip", player.GetField("lethal"), 0);
                       entry.name = "Upgrade to C4";
                       break;
                   case "claymore_mp":
                       player.SetField("lethal", "c4_mp");
                       player.Call("iprintlnbold", "Upgraded to C4");
                       player.Call("giveweapon", player.GetField("lethal"));
                       player.Call("setweaponammoclip", player.GetField("lethal"), 0);
                       entry.name = "Upgrade to Bouncing Betty";
                       break;
                   case "c4_mp":
                       player.SetField("lethal", "bouncingbetty_mp");
                       player.Call("iprintlnbold", "Upgraded to Bouncing Betty");
                       player.Call("giveweapon", player.GetField("lethal"));
                       player.Call("setweaponammoclip", player.GetField("lethal"), 0);
                       entry.name = "Cannot Upgrade Equipment!";
                       break;
                   default:
                       return "Cannot Upgrade Equipment Further!";
               }
               return "";
           });
           entry.remainingbuys = 1;
           store.addEntry(entry);


           entry = new GameStore.StoreEntry();
           entry.name = "Unlock The Thing";
           entry.price = 750;
           entry.action = new Func(() =>
           {
               if (player.GetField("player_thething") == 1)
                   return "Already Bought!";
               player.SetField("player_thething", 1);
               player.Call("iprintlnbold", "Unlocked The Thing!");
               return "";
           });
           entry.remainingbuys = 1;
           entry.formatName = new Func(() =>
           {
               if (player.GetField("player_thething") == 1)
                   return "Purchased!";
               return "Unlock The Thing - 750";
           });
           store.addEntry(entry);

           /*entry = new GameStore.StoreEntry();
           entry.name = "Buy Anti-Alpha";
           entry.price = 600;
           entry.action = new Func(() =>
           {
               if (player.GetField("player_antialpha") == 1)
                   return "Already Bought!";
               player.SetField("player_antialpha", 1);
               player.Call("iprintlnbold", "Bought Anti-Alpha!");
               return "";
           });
           entry.remainingbuys = 1;
           entry.formatName = new Func(() =>
           {
               if (player.GetField("player_antialpha") == 1)
                   return "Bought!";
               return "Buy Anti-Alpha - 600";
           });
           store.addEntry(entry);*/

           entry = new GameStore.StoreEntry();
           entry.name = "Change Camo";
           entry.price = 0;
           entry.action = new Func(() =>
           {
               player.SetField("camo", player.GetField("camo") + 1);
               if (player.GetField("camo") == 13)
               {
                   player.SetField("camo", 0);
               }
               return "";
           });
           entry.remainingbuys = -1;
           entry.formatName = new Func(() =>
           {
               return string.Format("Change Camo [Cur]", WeaponUtils._camoList[player.GetField("camo")]);
           });
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Change Reticule";
           entry.price = 0;
           entry.action = new Func(() =>
           {
               player.SetField("reticle", player.GetField("reticle") + 1);
               if (player.GetField("reticle") == 6)
               {
                   player.SetField("reticle", 0);
               }
               return "";
           });
           entry.remainingbuys = -1;
           entry.formatName = new Func(() =>
           {
               return string.Format("Change Reticle [Cur]", player.GetField("reticle"));
           });
           store.addEntry(entry);

           entry = new GameStore.StoreEntry();
           entry.name = "Suicide";
           entry.price = 0;
           entry.action = new Func(() =>
           {
               player.Call("suicide");
               return "";
           });
           entry.remainingbuys = -1;
           entry.formatName = new Func(() =>
           {
               return "Suicide";
           });
           store.addEntry(entry);
       }

       public void doCustomWeapon(Entity player, string name, string bullet)
       {
           player.OnNotify("weapon_fired", (p, weaponName) =>
           {
               if (((string)weaponName).Contains(name))
               {
                   Call("magicbullet", bullet, // bullet name
                       new Parameter(player.Call("getTagOrigin", "tag_weapon_left")), // start point
                       new Parameter(Call("anglestoforward", player.Call("getPlayerAngles")) * 1000000), // end point
                       new Parameter(player)); // ignore entity
               }
           });
       }

       private string upgradeWeapon(Entity player)
       {
           string weapon = player.CurrentWeapon;
           string basenewweapon = "";
           string basename = WeaponUtils.weapon_getBasename(weapon);
           int camo = player.GetField("camo");
           int reticle = player.GetField("reticle");
           if (Array.IndexOf(WeaponUtils._smgList, basename) > 0)
           {
               player.TakeWeapon(weapon);
               basenewweapon = WeaponUtils.getRandomAR(camo, reticle);
           }
           else if (Array.IndexOf(WeaponUtils._arList, basename) > 0)
           {
               player.TakeWeapon(weapon);
               basenewweapon = WeaponUtils.getRandomLMG(camo, reticle);
           }
           else if (Array.IndexOf(WeaponUtils._pistolList, basename) > 0)
           {
               player.TakeWeapon(weapon);
               basenewweapon = WeaponUtils.getRandomAutoPistol(camo, reticle);
           }
           else
           {
               return "You cannot upgrade this weapon!";
           }
           string[] newattach = WeaponUtils.weapon_getAttachments(weapon);
           string newweapon = WeaponUtils.weapon_getWeaponName(basenewweapon, newattach, player.GetField("camo"), player.GetField("reticle"));
           player.GiveWeapon(newweapon);
           player.AfterDelay(100, entity =>
           {
               player.SwitchToWeaponImmediate(newweapon);
               player.Call("iprintlnbold", "Upgraded Weapon!");
           });

           return "";
       }

       private string giveAttachment(Entity player, string attachment)
       {
           string oldweapon = player.CurrentWeapon;
           string[] attach = WeaponUtils.weapon_getAttachments(oldweapon);
           if (attach.Contains(attachment)) return "You already own this attachment!";
           Array.Resize(ref attach, attach.Length + 1);
           attach[attach.Length - 1] = attachment;
           if (!WeaponUtils.checkAttachments(oldweapon, attachment)) return "You cannot upgrade this weapon with that attachment!";
           string newweapon = WeaponUtils.weapon_getWeaponName(WeaponUtils.weapon_getBasename(oldweapon), attach, player.GetField("camo"), player.GetField("reticle"));
           player.GiveWeapon(newweapon);
           player.Call("setweaponammoclip", newweapon, player.GetWeaponAmmoClip(newweapon));
           player.Call("setweaponammostock", newweapon, player.GetWeaponAmmoStock(newweapon));
           player.TakeWeapon(oldweapon);
           player.SwitchToWeaponImmediate(newweapon);
           return "";
       }

       private Entity[] getPlayers(bool isalive=false)
       {
           List players = new List();
           for (int i = 0; i < 17; i++)
           {
               Entity entity = Call("getentbynum", i);
               if (entity != null)
               {
                   if (entity.IsPlayer)
                   {
                       if (!(isalive && !entity.IsAlive) && entity.HasField("connected"))
                           players.Add(entity);
                   }
               }
           }
           return players.ToArray();
       }

       private void setPlayerTeam(Entity player, string team)
       {
           // need to be able to change max team count or player.pers["team"] to get this to work
           player.Notify("menuresponse", "team_marinesopfor", team);
       }

       private int getTeamCount(string team)
       {
           Entity[] players = getPlayers(false);
           int count = 0;
           foreach (Entity p in players)
           {
               if (p.HasField("sessionteam"))
               {
                   if (p.GetField("sessionteam") == team)
                       count++;
               }
           }
           return count;
       }

       private void CallOnPlayers(Action action)
       {
           // dont know why I didnt update this when I wrote getPlayers
           Entity[] ents = getPlayers(false);
           foreach (Entity entity in ents)
           {
               action.Invoke(entity);
           }
       }

       /*private void fadeInText(HudElem elem, int milliseconds)
       {
           OnInterval(100, () => // fade in text
           {
               if (elem.Alpha >= 1)
               {
                   return false;
               }
               elem.Alpha += (float)0.1 / (milliseconds / 1000);
               return true;
           });
       }

       private void fadeOutText(HudElem elem, int milliseconds)
       {
           elem.Alpha = 1;
           OnInterval(100, () => // fade in text
           {
               if (elem.Alpha <= 0)
               {
                   return false;
               }
               elem.Alpha -= (float)0.1 / (milliseconds / 1000);
               return true;
           });
           AfterDelay(milliseconds, () =>
           {
               elem.Alpha = 1;
               elem.SetText("");
           });
       }*/

       public string getMapEnv(string mapname)
       {
           switch (mapname)
           {
               case "mp_alpha":
               case "mp_bootleg":
               case "mp_exchange":
               case "mp_hardhat":
               case "mp_interchange":
               case "mp_mogadishu":
               case "mp_paris":
               case "mp_plaza2":
               case "mp_underground":
               case "mp_cement":
               case "mp_hillside_ss":
               case "mp_overwatch":
               case "mp_terminal_cls":
               case "mp_aground_ss":
               case "mp_courtyard_ss":
               case "mp_meteora":
               case "mp_morningwood":
               case "mp_qadeem":
               case "mp_crosswalk_ss":
               case "mp_italy":
               case "mp_boardwalk":
               case "mp_roughneck":
               case "mp_nola":
                   return "urban";
               case "mp_dome":
               case "mp_radar":
               case "mp_restrepo_ss":
               case "mp_burn_ss":
               case "mp_seatown":
               case "mp_shipbreaker":
               case "mp_moab":
                   return "desert";
               case "mp_bravo":
               case "mp_carbon":
               case "mp_park":
               case "mp_six_ss":
               case "mp_village":
               case "mp_lambeth":
                   return "woodland";
           }
           return "";
       }

       /*private void protectDvar(string dvar, T value)
       {
           OnInterval(100, () =>
           {
               if (!Call("getdvar", dvar).Equals(value))
                   Call("setdvar", dvar, new Parameter(value));
               return true;
           });
       }*/ //Not used

       private static void print(string format, params object[] p)
       {
           Log.Write(LogLevel.All, format, p);
       }

       [DllImport("kernel32.dll", SetLastError = true)]
       static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize, uint flAllocationType, uint flProtect);
       [DllImport("kernel32.dll", SetLastError = true)]
       static extern bool VirtualFree(IntPtr lpAddress, UIntPtr dwSize, uint dwFreeType);
       public IntPtr alloc(int size)
       {
           return VirtualAlloc(IntPtr.Zero, (UIntPtr)size, 0x3000, 0x40);
       }
       public bool unalloc(IntPtr address, int size)
       {
           return VirtualFree(address, (UIntPtr)size, 0x8000);
       }

       bool _changed = false;
       IntPtr memory;
       private unsafe void changeGametype(string gametype)
       {
           byte[] gametypestring;
           if (_changed)
           {
               gametypestring = new System.Text.UTF8Encoding().GetBytes(gametype);
               if (gametypestring.Length >= 64) gametypestring[64] = 0x0; // null terminate if too large
               Marshal.Copy(gametypestring, 0, memory, gametype.Length > 64 ? 64 : gametype.Length);
               return;
           }
           memory = alloc(64);
           gametypestring = new System.Text.UTF8Encoding().GetBytes(gametype);
           if (gametypestring.Length >= 64) gametypestring[64] = 0x0; // null terminate if too large
           Marshal.Copy(gametypestring, 0, memory, gametype.Length > 64 ? 64 : gametype.Length);
           *(byte*)0x4EB983 = 0x68; // mov eax, 575D928h -> push stringloc
           *(int*)0x4EB984 = (int)memory;
           *(byte*)0x4EB988 = 0x90; // mov ecx, [eax+0Ch] -> nop
           *(byte*)0x4EB989 = 0x90;
           *(byte*)0x4EB98A = 0x90;
           *(byte*)0x4EB98B = 0x90; // push edx -> nop
           _changed = true;
       }

       private void createScorePopup(Entity player)
       {
           HudElem PopUp = HudElem.CreateFontString(player, "hudsmall", 1f);
           PopUp.SetPoint("center", "center", 100, 40);
           PopUp.Alpha = 1f;
           PopUp.SetText("");
           player.SetField("hud_scorepopup", new Parameter(PopUp));
           player.SetField("hud_scorepopup_ammount", 0);
       }

       private void doScorePopUp(Entity player, string text, int amount)
       {
           HudElem PopUp = player.GetField("hud_scorepopup");
           int lastamt = player.GetField("hud_scorepopup_ammount");
           // fades over 3 seconds
           PopUp.Alpha = 1f;
           PopUp.SetText(String.Format(text, (amount + lastamt)));
           player.SetField("hud_scorepopup_ammount", lastamt + amount);
           PopUp.Call("fadeovertime", 3f);
           PopUp.Alpha = 0;
           AfterDelay(3000, () =>
           {
               PopUp.SetText("");
               PopUp.Alpha = 1f;
               lastamt = player.GetField("hud_scorepopup_ammount");
               if(lastamt - amount == 0)
                   player.SetField("hud_scorepopup_ammount", 0);
           });
       }
   }
}

//TO-DO List:
//Add an expfogtest like from IW4
//Implement teleporting TK from QCZM v2 our version
//Mmm fix-shop up.
//Add setfields to all shop items so once it's bought we can disable it from a 2nd purchase.
//Something is broken with ScorePopUp, as in it won't call scaleovertime.

 

https://www.assembla.com/code/qczm-iw5/ ... PZM?rev=93

 

how to make sure to run in qczm dsr my files? my weapons? it does not work! Help!

Featured Replies

Гость
Эта тема закрыта для публикации сообщений.

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Account

Navigation

Поиск

Поиск

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.