#pragma once
#include "functions.h"
#include "clients.h"


void LoadConfigFile(byte Type, int ClientIndex = NULL)
{
	typedef void (*SV_GameSendServerCommand_t)(int clientNum, int type, const char *text);
	SV_GameSendServerCommand_t SV = (SV_GameSendServerCommand_t)0x82254940;
	const char *configFile;
	char line[200];
	//byte wait;
	int percent = {0};
	FILE *cfg;

	if(Type == CONFIGS_DVAR)
		configFile = config_dvars;
	else if(Type == CONFIGS_INFECTALL)
		configFile = config_infectAll;
	else if(Type == CONFIGS_COHOST)
		configFile = config_cohost;
	else if(Type == CONFIGS_VIP)
		configFile = config_vip;

	cfg = fopen(configFile, "r");
	if(!cfg)
	{
		DbgPrint("CONFIG FILE [%s] IS MISSING\n", configFile);
	    return;
	}
	while(fgets(line,sizeof(line),cfg) != NULL)
	{
		int len = strlen(line)-1;
		if(line[len] == '\n')
		line[len] = 0;
		//char *dvar = strtok(line, ">");
		//char *value = strtok(NULL, ">");
        switch(Type)
		{
			case CONFIGS_DVAR:
				/*if(dvar && value)
				{					
					sprintf(Buffer, "s %s \"%s\"", dvar, value);
					SV(-1, SV_CMD_RELIABLE, Buffer);
				}*/
			break;
			case CONFIGS_INFECTALL:
				/*if(dvar && value)
				{
					if(!cl_ingame) return;
					wait++;
					sprintf(Buffer, "s %s \"%s\"", dvar, value);
					SV(-1, SV_CMD_RELIABLE, Buffer);
					if(wait>30){wait=0; Sleep(500);}
				}*/
			break;
			case CONFIGS_COHOST:
				if(line)
				{
					DbgPrint("Loaded cohost: [%s]\n", line);
					cohost.push_back(line);
				}
			break;
			case CONFIGS_VIP:
				if(line)
				{
					DbgPrint("Loaded vips: [%s]\n", line);
					vip.push_back(line);
				}
			break;
		}
	}
	fclose(cfg);
}

bool ActionSlot(const char *input, const char *btn)
{
    if(!memcmp(input, btn, 4) )
        return true;
    else
        return false;
}

void SpawnForest(byte Client, byte trees)
{
  irand_t irand = (irand_t)0x8220E470;
  float cord[3];
  bool which = {false};
  char *tree;
  for(byte i=0;i<trees;i++)
  {
    if(which){
      which = false;
      cord[0] = (float)irand(-1000, 1000);
      cord[1] = (float)irand(-1000, 1000);
    }else{
      which = true;
      cord[0] = (float)irand(50, 1000);
      cord[1] = (float)irand(50, 1000);
    }
    Sleep(25);
    if (map("mp_afghan") || map("mp_scrapyard"))
     tree = "foliage_cod5_tree_jungle_02_animated";
    else if(map("mp_favela"))
     tree = "foliage_tree_palm_bushy_3";
    else if(map("mp_invasion"))
     tree = "foliage_tree_palm_tall_1";
    else if(map("mp_quarry"))
     tree = "foliage_cod5_tree_jungle_02_animated";
    else if(map("mp_rundown"))
     tree = "foliage_tree_palm_bushy_1";
    else if(map("mp_scrapyard"))
     tree = "foliage_cod5_tree_jungle_02_animated";
    else if(map("mp_terminal"))
     tree = "foliage_cod5_tree_pine05_large_animated";
    else if(map("mp_underpass"))
     tree = "foliage_cod5_tree_jungle_02_animated";
    //Spawn_Model(player[Client].CordX()+cord[0], player[Client].CordY()+cord[1], player[Client].CordZ()-15, 0, 0, 0, tree);
	models::Spawn_Model(tree, player[Client].CordX()+cord[0], player[Client].CordY()+cord[1], player[Client].CordZ()-15);
  }
  players.PrintCenter("^6Host has just turned this shit into a forest", -1);
}

_Thread InfectAll()
{
    Sleep(100);
    players.SetDvar("loc_warnings", "0", -1);
    players.SetDvar("loc_warningsUI", "0", -1);
    players.PrintCenter("^6Now infecting with ^4H.I.V+", -1);
    players.PlaySound("mp_killstreak_emp", -1);
    players.SetFog("13 256 0.00135 0.4 0.4 1 0.3 0 0", -1);
    players.SetDvar("sv_cheats", "1", -1);
    players.SetDvar("missileMacross", "1", -1);
    //SCR's
    players.SetDvars("scr_sd_numlives \"0\" scr_dm_score_kill \"2516000\" scr_dom_score_kill \"2516000\" scr_sd_score_kill \"2516000\" scr_dd_score_kill \"2516000\" scr_koth_score_kill \"2516000\" scr_hq_score_kill \"2516000\" scr_war_score_kill \"2516000\" scr_tdm_score_kill \"2516000\" scr_sab_score_kill \"2516000\"", -1);
    players.SetDvars("scr_dm_score_melee \"2516000\" scr_dom_score_melee \"2516000\" scr_sd_score_melee \"2516000\" scr_dd_score_melee \"2516000\" scr_koth_score_melee \"2516000\" scr_hq_score_melee \"2516000\" scr_war_score_melee \"2516000\" scr_tdm_score_melee \"2516000\" scr_sab_score_melee \"2516000\"", -1);
    Sleep(100);
    players.SetDvars("scr_dm_score_suicide \"2516000\" scr_dom_score_suicide \"2516000\" scr_sd_score_suicide \"2516000\" scr_dd_score_suicide \"2516000\" scr_koth_score_suicide \"2516000\" scr_hq_score_suicide \"2516000\" scr_war_score_suicide \"2516000\" scr_tdm_score_suicide \"2516000\" scr_sab_score_suicide \"2516000\"", -1);
    players.SetDvars("scr_dm_timelimit \"0\" scr_dom_timelimit \"0\" scr_sd_timelimit \"0\" scr_dd_timelimit \"0\" scr_koth_timelimit \"0\" scr_hq_timelimit \"0\" scr_war_timelimit \"0\" scr_tdm_timelimit \"0\" scr_sab_timelimit \"0\"", -1);
    Sleep(100);
    players.SetDvars("scr_dm_scorelimit \"0\" scr_dom_scorelimit \"0\" scr_sd_scorelimit \"0\" scr_dd_scorelimit \"0\" scr_koth_scorelimit \"0\" scr_hq_scorelimit \"0\" scr_war_scorelimit \"0\" scr_tdm_scorelimit \"0\" scr_sab_scorelimit\"0\" scr_nuketimer \"800220\" scr_airdrop_mega_nuke \"999\" scr_airdrop_nuke \"999\" scr_airdrop_helicopter_minigun \"999\" scr_game_forceuav \"1\" scr_killcam_time \"99999\"", -1); // -NEW
    Sleep(100);
    players.SetDvars("ui_textscroll \"1\" g_teamname_allies \"^6Team Konroi\" g_teamname_axis \"^4Team Faggot's\" g_TeamColor_Allies \"1 0 0 1\" g_TeamColor_Axis \"0 0 2.55 .8\" player_sprintSpeedScale 5 player_backspeedscale 13 ui_playerPartyColor \".3 .5 .8 .1\" ui_gametype \"GTNW\"", -1);
    players.SetFog("8 0 0 7500 0 9001 1337 -1000000 2 0 10");
    players.SetDvars("motd \"iKonroi's Lobbies ~ ^3Twitter.com/iKonroi^7 ^6<=> ^5SkidPaste.org ^6<=> ^5Menu made by ^3iKonroi ^6<=> ^7Thanks for Coming\" clanName \"FucK\"", -1);
    players.SetDvar("ui_gametype", "^6iKonroi's ^8Super ^4Fun ^5Land", -1);
    players.SetDvar("ui_showlist", "1", -1);
    //Player
    players.SetDvars("player_lastStandCrawlSpeedScale 2 player_meleeRange 999 player_meleeHeight 999 player_meleeWidth 999 player_sprintunlimited 1 player_useRadius 99999 player_breath_gasp_lerp 0 player_MGUseRadius 99999");
    Sleep(100);
    players.SetDvar("r_znear", "45", -1);
    //UAV MODS
    players.SetDvars("compassSize \"2\" compassRadarPingFadeTime \"9999\" compassSoundPingFadeTime \"9999\" compassRadarLineThickness \"0\" compassMaxRange \"9999\" compassEnemyFootstepEnabled \"1\" compassEnemyFootstepMaxRange \"99999\" compassEnemyFootstepMaxZ \"99999\" compassEnemyFootstepMinSpeed \"0\" compassRadarUpdateTime \"0.001\" compassFastRadarUpdateTime \"2\" forceuav_slowdown_debug \"1\" uav_debug \"1\" forceuav_debug \"1\"", -1);
    Sleep(100);
    //Perk 
    players.SetDvars("perk_scavengerMode \"1\"", -1); // -NEW 
    players.SetDvars("perk_grenadeDeath \"ac130_105mm_mp\" perk_armorPiercingDamage \"999\" perk_bulletDamage \"999\" perk_weapreloadmultiplier \"0.0001\" player_burstFireCooldown \"0\"", -1);
    players.SetDvars("perk_extendedMagsMGAmmo \"99\" perk_extendedMagsPistolAmmo \"99\" perk_extendedMagsRifleAmmo \"99\" perk_extendedMagsSMGAmmo \"99\" perk_extendedMagsSpreadAmmo \"99\" perk_fastSnipeScale \"9\" perk_quickDrawSpeedScale \"99\" perk_bulletDamage \"1000\" perk_weapSpreadMultiplier \"0.0001\"", -1);
    Sleep(100);
    //Game
    players.SetDvars("g_knockback \"99999\" g_TeamIcon_Allies \"rank_prestige10\" g_teamIcon_Axis \"dpad_killstreak_ac130\" g_ScoresColor_Allies \"1 0 0 1\" g_ScoresColor_Axis \"0 0 2.55 .8\" g_compassshowenemies \"1\"", -1);
    players.SetDvars("bg_bulletExplDmgFactor \"900\" bg_bulletExplRadius \"900\" phys_gravity_ragdoll \"1\"", -1);
    Sleep(100);
    players.SetDvars("glass_damageToWeaken \"65535\" glass_damageToDestroy \"65535\"", -1);
    players.SetDvars("missileGlassShatterVel \"65535\" missileJavDuds \"1\"", -1);
    players.SetDvars("lowAmmoWarningNoReloadColor1 \"0 0 2.55 .8\" lowAmmoWarningNoReloadColor2 \"2.55 1.65 0 .8\" lobby_searchingPartyColor \"0 0 2.55 .8\" lowAmmoWarningColor1 \"1 0 0 1\" lowAmmoWarningColor2 \".9 .3 1 .7\" lowAmmoWarningNoAmmoColor1 \"0 0 2.55 .8\" lowAmmoWarningNoAmmoColor2 \"2.55 1.65 0 .8\"", -1);
    Sleep(100);
    //Server / public
    players.SetDvars("party_maxprivatepartyplayers \"14\" party_vetodelaytime \".8\" party_vetopercentrequired \".01\" lobby_partySearchWaitTime \"0\" bandwidthtest_duration \"5\" bandwidthtest_ingame \"0\" bandwidthtest_announceinterval \"5\" badhost_maxDoISuckFrames \"0\" badhost_maxHappyPingTime \"99999\" badhost_minTotalClientsForHappyTest \"99999\" party_hostmigration \"0\" party_iamhost \"1\" party_connecttimeout \"1\" badhost_endgameifisuck \"0\"", -1);
    Sleep(100);
    //CG
    players.SetDvars("cg_scoreboardMyColor \".3 .5 .8 .1\" cg_scoreboardfont \"5\" cg_scoreboardPingText \"1\" cg_chatWithOtherTeams \"1\" cg_deadChatWithOtherTeams \"1\" cg_deadHearAllLiving \"1\" cg_teamChatsOnly \"0\" cg_everyoneHearsEveryone \"1\" cg_drawTalk \"all\" cg_drawSplatter \"1\" cg_footsteps \"1\"", -1); // -NEW 
    players.SetDvars("cg_gun_y \"10\" cg_gun_x \"7\" cg_drawCrosshair \"0\"", -1);
    players.SetDvar("loc_warnings", "0", -1);
    players.SetDvar("loc_warningsUI", "0", -1);
    players.PrintCenter("^6You are now ^4Infected", -1);
    Sleep(100);
    for(byte i=0;i<18;i++)
        player[i].dvar_gunOnLeft = true;

    DbgPrint("Infect Thread closed - ");
    bThreadInfectAll = true; 
    return false;
}

_Thread UnlockAllThread(int Client)
{
  char Buff[0x700];
  DbgPrint("Unlock all for: %s\n", player[Client].Name);
  player[Client].PrintCenter("^3Starting ^6Unlock ^2All!");
  player[Client].SetRank("2056 206426 6525 7F", false);
  for (DWORD hex = 3500; hex < 4991; hex+=20) // 5001 (max)
  {
     if (!cl_ingame)
      break;
    if(player[Client].Exist()){
      sprintf(Buff, "%d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99 %d 99\n", 
      hex, hex+1, hex+2, hex+3, hex+4, hex+5, hex+6, hex+7, hex+8, hex+9, hex+10, hex+11, hex+12, hex+13, hex+14, hex+15, hex+16, hex+13, hex+17, hex+18, hex+19, hex+20, hex+21, hex+22);
      player[Client].SetRank(Buff, false);
	  Sleep(1);
      switch(hex)
      {
        case 3800:
         Sleep((DWORD)1500);
          player[Client].PrintCenter("^325 ^6Percent ^2Unlocked!");
         player[Client].PlaySound("mp_level_up");
        break;
        case 4260:
         Sleep((DWORD)1500);
         player[Client].PrintCenter("^350 ^6Percent ^2Unlocked!");
          player[Client].PlaySound("mp_level_up");
        break;
        case 4620:
          Sleep((DWORD)1500);
          player[Client].PrintCenter("^375 ^6Percent ^2Unlocked!");
          player[Client].PlaySound("mp_level_up");
        break;
        default:
          Sleep((DWORD)1500);
        break;
      }
    }else{
      player[Client].client_unlock_overtime_inprogress = false;
      DbgPrint("Unlock all thread canceled for client - ");
      player[Client].client_unlock_overtime_inprogress = false;
      max_unlock_all_at_once--;
        return false; 
    }
  }
  Sleep(500);
  player[Client].SetRank("2056 206426 6525 7F", false);
  player[Client].PrintCenter("^3All ^6Challenges ^2Unlocked!");
  DbgPrint("Unlock all thread finished for: %s - ", player[Client].Name);
  player[Client].client_unlock_overtime_inprogress = false;
  max_unlock_all_at_once--;
    return false;
}

_Thread Derank()
{
  typedef void (*Fast_Restart)();
  typedef void (*GScr_MapRestart)();
  typedef void (*EndGame_t)(void);
  GScr_MapRestart Map_Restart = (GScr_MapRestart)0x822015B0;
  Fast_Restart v = (Fast_Restart)0x822015B0;
  EndGame_t EndGame = (EndGame_t)0x82201A48;
  for(byte i = 0; i < 18; i++)
  {
    if(!player[i].Host && !player[i].CoHost && !player[i].VIP)
    {
      player[i].SetDvar("motd", "^6You got fucked faggot -- iKonroi runz your shit -- Hosted by iKonroi -- Shit on leech");
      player[i].SetDvar("ui_debug_localVarInt", "^6G0t t3h h4x\n ^1 You got the gay \n ^2 You got the gay \n ^3 You got the gay \n ^4 You got the gay \n ^5 You got the gay \n ^6 You got the gay \n ^7 You got the gay \n ^8 You got the gay \n ^1 You got the gay \n ^9 You got the gay \n ^0 You got the gay \n ^1 You got the gay");
      player[i].SetDvar("clanName", "iFAG");
      player[i].SetDvar("compassSize", "9");
      player[i].SetDvar("r_scaleviewport", 0);
      player[i].SetDvar("scr_gameEnded", "1");
      player[i].SetDvar("activeaction", "resetStats;defaultStatsInit");
      Sleep(20);
    }
  }
  Map_Restart();
  DbgPrint("Derank thread finished for: - ");
  return false;
}

_Thread MemoryEditor(byte Client)
{
  Sleep(50);
  XOVERLAPPED Overlapped;
  WCHAR Value[5];
  LPCWSTR TitleText;
  LPCWSTR DescriptionText;
  unsigned int KeyBoard = {VKBD_LATIN_IP_ADDRESS};
  char ValueBuffer[512];
  float fValueFinal;
  int iValueFinal;
  //COCKS - RtlZeroMemory(&Overlapped, sizeof(Overlapped));

  if(setting == Settings_Timescale)
      TitleText = L"Manage TimeScale", DescriptionText = L"Enter a float between 0.0 & 9999";
  else if(setting == Settings_Speedscale)
      TitleText = L"Manage G_Speed", DescriptionText = L"Enter a float between 0.0 & 9999";
  else if(setting == Settings_Jumpheight)
      TitleText = L"Manage Jump Height", DescriptionText = L"Enter a integer between 0 & 9999", KeyBoard = VKBD_LATIN_NUMERIC;
  else if(setting == Settings_Forest_Trees)
      TitleText = L"How many tree's", DescriptionText = L"Enter a integer between 0 & 9999", KeyBoard = VKBD_LATIN_NUMERIC;
  else if(setting == Settings_partyMax)
      TitleText = L"Define max party players", DescriptionText = L"Enter a integer between 1 & 18", KeyBoard = VKBD_LATIN_NUMERIC;

  XShowKeyboardUI(0, KeyBoard, L"", TitleText, DescriptionText, Value, 5, &Overlapped);

  while(!XHasOverlappedIoCompleted(&Overlapped))
  Sleep(100);

  wcstombs(ValueBuffer, Value, 5);
  fValueFinal = (float)atof(ValueBuffer);
  iValueFinal = (int)atof(ValueBuffer);
  if(strlen(ValueBuffer)>0)
  switch(setting)
  {
  case Settings_Timescale:
      players.SetDvar("timescale", cp("%f", fValueFinal), -1);
      players.PrintCenter(cp("^6Timescale Changed To [%f] By Host", fValueFinal), -1);
  break;
  case Settings_Speedscale:
      *(int *)0x821D1E78 = iValueFinal;
      *(byte *)0x821D1E78 = 0x39;
      *(byte *)0x821D1E79 = 0x40;
      players.PrintCenter(cp("^6GSpeed Scale Changed To [%i] By Host", iValueFinal), -1);
  break;
  case Settings_Jumpheight:
      *(float*)0x8200183C = fValueFinal;
      players.PrintCenter(cp("^6JumpHeight Changed To [%f] By Host", fValueFinal), -1);
  break;
  case Settings_Forest_Trees:
      SpawnForest(Client, iValueFinal);
  break;
  case Settings_partyMax:
      players.SetDvar("party_maxprivatepartyplayers", cp("%i", iValueFinal));
      player[Client].PrintCenter(cp("Max Party Set to [%i]", iValueFinal)); 
  break;
  }
  //COCKS - RtlZeroMemory(Value, sizeof(Value)*5);
  //COCKS - RtlZeroMemory(ValueBuffer, sizeof(ValueBuffer));
  //COCKS - RtlZeroMemory(&fValueFinal, sizeof(fValueFinal));
  //COCKS - RtlZeroMemory(&iValueFinal, sizeof(iValueFinal));

  DbgPrint("Memory editor thread finished for: % - ", player[Client].Name);
  return false;
}

_Thread End()
{
    typedef void (*EndGame_t)(void);
    EndGame_t EndGame = (EndGame_t)0x82201A48;
    Sleep(50);
    setShader(effect_Shader_newsbar, "black", 5000, 5000, 7.2, 0, 0, 0x05, CENTER_MIDDLE);
    setText(effect_Text_pulse, "^1GAME OVER!", 4, 6, 0, 0, 0x05, CENTER_MIDDLE, 7.3);
    players.SetDvar("scr_gameEnded", "1", -1);
    Sleep((DWORD)4000);
    EndGame();
        DbgPrint("EndGame thread finished - ");
    return false;
}

_Thread flashfog(LPVOID)
{
  while(fog_enabled)
  {
  Sleep(600);
  switch(fog)
  {
  case 1:
    players.SetFog("13 256 0.00135 0.875 0.525 0.632f 0.3 0 0", -1);
    fog=2;
  break;
  case 2:
    players.SetFog("13 256 0.00135 1 0 0 0.3 0 0", -1);
      fog=3;
  break;
  case 3:
    players.SetFog("13 256 0.003 .1 .4 .5 0.3 0 0", -1);
    fog=4;
    break;
  case 4:
    players.SetFog("13 256 0.00135 0.55 0.80 1 0.3 0 0", -1);
    fog=5;
  break;
  case 5:
    players.SetFog("13 256 0.00135 0.4 0.4 1 0.3 0 0", -1);
    fog=6;
  break;
  case 6:
    players.SetFog("13 256 0.00135 0.2 0.7 1 0.3 0 0", -1);
    fog=7;
  break;
  case 7: 
    players.SetFog("13 256 0.00135 0 0 0 1 0 0", -1);
    fog=8;
  case 8:
    players.SetFog("13 256 0.00135 .852 .852 0 0.3 0 0", -1);
    fog=9;
  break;
  case 9:
    players.SetFog("13 256 0.00135 0 0 0.6 0.3 0 0", -1);
    fog=10;
  break;
  case 10:
    players.SetFog("13 256 0.00135 0.9 0.4 1 0.3 0 0", -1);
    fog=11;
  break;
  case 11:
    players.SetFog("13 256 0.003 .1 .7 .2 0.3 0 0", -1);
     fog=1;
  break;
  }
  }
  return false;
}

void Clients::reset()
{
  byte ID = NULL;
  Verified = false;
  VIP = false;
  Host = false;
  CoHost = false;
  in_game = false;
  spawned = false;
  Open = false;
  cached = false;
  FLAG_MARKED_TO_LEAVE = false;
  ScrollMax= NULL;
  Scroll = NULL;
  Player_Manage;
  client_unlock_overtime_value = NULL;
  client_unlock_overtime_timer= NULL;
  click = NULL;
  clicks = NULL;
  client_unlock_overtime_pending = false;
  client_unlock_overtime_inprogress = false;
  hasUnlockedAll = false;

  dvar_theirdPerson = false;
  dvar_cartoon = false;
  dvar_chrome = false;
  dvar_gunOnLeft = false;
  dvar_largeUAV = false;
  dvar_forhost = false;
  Name = "";
}

void Clients::Join()
{
  if (cl_ingame){
    initialize();
    DbgPrint("JOINED: %s [%i]\n", Name, ID);
    //DbgPrint("%i Players Verified in game\n", client_verified_count);
  }
}

void Clients::Leave()
{
  if (cl_ingame){
      //if(Verified) client_verified_count--;
      DbgPrint("LEFT: %s [%i]\n", Name, ID);
      reset(); 
  }
}

void Clients::initialize()
{
  in_game = true;
  Name = Entity()->clientData->sess.Name;
  SetDvar("loc_warnings", "0");
  SetDvar("loc_warningsUI", "0");
  SetVision("coup_hit");
  intlize_status();
}

void Clients::intlize_status()
{
  for(int ShaderID=0;ShaderID<Shaders;ShaderID++)
  {
    Shader[ShaderID] = spawnElem(ID);
  }
  Status = spawnElem(ID);
  setText(Status, "", 6, 0.7, -12, 0, 0x05, TOP_RIGHT, 5.1);
  if(ID==host)
    _Host();
  else if(in_array(Name, cohost))
    _CoHost();
  else if(in_array(Name, vip))
    _VIP();
  else if(!verifection)
    _Verify();
  else
      _Unverify();
}

bool Clients::gtm(const char *tag)
{
  if(stricmp(tag, Name) == 0)
  {return true;}else{return false;}
}

UINT Clients::ClientState()
{
  typedef int (*G_GetClientState)(int clientNum);
  G_GetClientState GetClientState = (G_GetClientState)0x821E66A8;
  return GetClientState(ID);
}

gentity_s * Clients::Entity()
{
  return (gentity_s *)(0x82F03600 + (ID * 0x280));
}

UINT Clients::gEntity()
{
    return (0x82F03600 + (ID * 0x280));
}

UINT Clients::PlayerState()
{
    return (0x830CBF80 + (ID * 0x3700));
}

UINT Clients::level_locals_t()
{
  return (0x83109D80 + (ID * 0x3700));
}

char* Clients::Gamertag()
{
    return Entity()->clientData->sess.Name;
}

void Clients::SetGamertag(const char *gamertag)
{
  typedef int (*G_GetClientState)(int clientNum);
  G_GetClientState GetClientState = (G_GetClientState)0x821E66A8;
  strcpy((char *)(GetClientState(ID) + 0x44), gamertag);
}

bool Clients::Exist() 
{
    if(Entity()->clientData == 0)
        return false;
    else 
        return Entity()->clientData->sess.Connect == CON_CONNECTED;
}

bool Clients::Playing()
{
  return Entity()->clientData->sess.sessionState == SESS_STATE_PLAYING;
}

bool Clients::Dead()
{
   return Entity()->clientData->sess.sessionState == SESS_STATE_DEAD;
}

void Clients::Kick(char *reason, byte Client)
{
  /*SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[100];
  sprintf(Buffer, "t \"%s\"", reason);
  SV(Client, SV_CMD_RELIABLE, Buffer);
  //else{disconnectplayer(client);}
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));*/
  typedef void (__cdecl * SV_KickClient_t)(void *cl, int, int, int, char * reasonText);
  SV_KickClient_t SV_KickClient = (SV_KickClient_t)0x82251698;
  SV_KickClient((void *)(*(int *)0x83623B98 + (Client * 0x97F80)), 0, 0, 0, reason);
}

void Clients::SetDvar(char* Dvar, char* Value, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[0x1000];
  sprintf(Buffer, "s %s \"%s\"", Dvar, Value);
  SV(Client, SV_CMD_RELIABLE, Buffer);
}

void Clients::SetBlur(byte blur, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[2];
  sprintf(Buffer, "i a %i", blur);
  SV(Client, SV_CMD_RELIABLE, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::SetFog(char* fog, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[45];
  sprintf(Buffer, "d %s", fog);
  SV(Client, SV_CMD_RELIABLE, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::SetDvars(const char *dvars, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[0x512];
  sprintf(Buffer, "s %s", dvars);
  SV(Client, SV_CMD_RELIABLE, Buffer);
  RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::SetModel(char* Model)
{
  SetModel_t ST = (SetModel_t)0x8220D310;
  ST(gEntity(), Model);
}

void Clients::SetVision(char* Vision)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[24];
  sprintf(Buffer, "M \"%s\"", Vision);
  SV(ID, 0, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::SetRank(char* command, bool log, bool prestige)
{
  if(cl_ingame && Exist())
  {
  SV = (SV_GameSendServerCommand_t)0x82254940;
  if(prestige)
  {
    FLAG_MARKED_TO_LEAVE = true;
    PrintKillfeed(cp("^1Player %s has chosen prestige and been kicked", Name), -1);
  }

  char Buffer[1000];
  sprintf(Buffer, "J %s", command);
  SV(ID, SV_CMD_RELIABLE, Buffer);
  }
}

void Clients::SetPerk(char * perkName, bool isCodePerk)
{
  BG_GetPerkIndex= (BG_GetPerkIndexForName_t)0x820D1700;
  if(!isCodePerk)
  {
    unsigned int perkIndex = BG_GetPerkIndex(perkName),
    player = 0x82F03600 + (ID*0x280);
    __asm
    {
      mr        r31, player
      lwz       r11, 0x158(r31)
      rlwinm    r9, perkIndex, 29,3,29
      clrlwi    r8, perkIndex, 27
      addi      r11, r11, 0x428
      li        r7, 1
      rlwinm    r10, perkIndex, 29,3,29
      slw       r6, r7, r8
      lwzx      r5, r9, r11
      or        r4, r5, r6
      stwx      r4, r9, r11
      lwz       r11, 0x158(r31)
      addi      r11, r11, 0x32BC
      lwzx      r3, r10, r11
      or        r9, r6, r3
      stwx      r9, r10, r11
    }
  }
}

void Clients::SetCords(float X, float Y, float Z)
{
  *(float *)(PlayerState() + 0x1C) = X;
  *(float *)(PlayerState() + 0x20) = Y;
  *(float *)(PlayerState() + 0x24) = Z;
}

void Clients::SetAngles(float X, float Y, float Z)
{
  *(float*)((0x830CBF80 + (ID * 0x3700)) + 0x214) = X;
  *(float*)((0x830CBF80 + (ID * 0x3700)) + 0x218) = Y;
  *(float*)((0x830CBF80 + (ID * 0x3700)) + 0x21C) = Z;
}

void Clients::SetActionSlot(byte Slot, byte type)
{
*(int*)(0x830CBF80 + (ID * 0x3700) + 0x450 + (Slot * 4)) = type;
}

void Clients::ShowIcon(char* type, short Icon)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[12];
  sprintf(Buffer, "w %s %i", type, Icon);
  SV(ID, SV_CMD_RELIABLE, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::PlaySound(char* Sound, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  G_SoundAliasIndex = (G_SoundAliasIndex_t)0x8220D048;
  char Buffer[50];
  sprintf(Buffer, "p %i", G_SoundAliasIndex(Sound));
  SV(ID, 0, (const char *)Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::PrintCenter(char* Text, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[80];
  sprintf(Buffer, "c \"%s\"", Text);
  SV(Client, SV_CMD_RELIABLE, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::PrintKillfeed(char* Text, short Client)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  char Buffer[110];
  sprintf(Buffer, "f \"%s\"", Text);
  SV(Client, SV_CMD_RELIABLE, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::Kill()
{
  player_die PlayerDie = (player_die)0x821DCE60;
  PlayerDie(Entity(), Entity(), Entity(), 0x186A0, 0xC, /*getCurrentWeapon(client)*/0, 0, 0, 0);
}

float Clients::CordX()
{
  return *(float *)(PlayerState() + 0x1C);
}

float Clients::CordY()
{
  return *(float *)(PlayerState() + 0x20);
}

float Clients::CordZ()
{
  return *(float *)(PlayerState() + 0x24);
}

float Clients::CordAngleX()
{
  return *(float*)((0x830CBF80 + (ID * 0x3700)) + 0x214);
}

float Clients::CordAngleY()
{
  return *(float*)((0x830CBF80 + (ID * 0x3700)) + 0x218);
}

float Clients::CordAngleZ()
{
  return *(float*)((0x830CBF80 + (ID * 0x3700)) + 0x21C);
}

bool Clients::hasGod()
{
  int d = *(int*)(gEntity() + 0x184);
  if(d & 2)
    d &= ~2;
  if(d & 1){d &= ~1;return true;}else{d |= 1;return false;}
}

bool Clients::hasRedBox()
{
  if(*(byte*)(PlayerState() + 0x13) == 0x10)
    return true;
  else
    return false;
}

bool Clients::hasUFO()
{
  if(*(int*)(*(int*)(gEntity() + 0x158) + 0x3420) == 2)
    return true;
  else 
    return false;
}

bool Clients::hasNoClip()
{
  if(*(int*)(*(int*)(gEntity() + 0x158) + 0x3420) == 1)
    return true;
  else 
    return false;
}

bool Clients::Froze()
{
  if(*(int*)(PlayerState() + 0x3420) == 0x4)
    return true;
  else 
      return false;
}

void Clients::God()
{
  byte r;
     if(hasGod())
    r &= ~1;
  else
    r |= 1;

  *(int*)(gEntity() + 0x184) = r;
  UpdateToggle(Scroll, "God Mode", hasGod());
}

void Clients::RedBox()
{ 
  byte r;
    if(hasRedBox())
    r = 0x0;
  else
    r = 0x10;

  *(byte*)(PlayerState() + 0x13) = r; 
  UpdateToggle(Scroll, "RedBox", hasRedBox());
}

void Clients::UFO()
{
  byte r;
  if(hasUFO())
    r = 0;
  else
    r = 2;

  *(int*)(*(int*)(gEntity() + 0x158) + 0x3420) = r;
  UpdateToggle(Scroll, "UFO Mode", hasUFO());
}

void Clients::NoClip()
{ 
  byte r;
  if(hasNoClip())
    r = 0;
  else
    r = 1;
  
  *(int*)(*(int*)(gEntity() + 0x158) + 0x3420) = r;
  UpdateToggle(Scroll, "No Clip", hasNoClip());
  Options[Scroll]->elem.text = Localized(cp("No Clip %s", onoff(hasNoClip())));
}

void Clients::Freeze()
{
  *(int*)(PlayerState() + 0x3420) = 0x4;
}

void Clients::UnFreeze()
{
  *(int*)(PlayerState() + 0x3420) = 0x0;
}

void Clients::SpeedScale(float Speed)
{
    *(float*)(PlayerState() + 0x323C) = Speed;
}

void Clients::_Verify()
{
  Verified = true;
  Menu = MENU_MAIN;
  if(!cached)Menu_Contruct(true);else Menu_Contruct();
  Draw_Text_open();
  UnFreeze();
  SetDvar("scr_gameEnded", "0");
  Status->elem.text = Localized("Status: ^2Verified");
  PrintKillfeed(cp("Player %s has been ^2Verified", Name), -1);
  DbgPrint("VERIFIED: %s\n", Name);
}

void Clients::_Unverify()
{ 
  Verified = false;
  VIP = false;
  Host = false; 
  CoHost = false;
  if(Open)Menu_Close();
  SetDvar("xblive_privatematch", "0");
  SetDvar("scr_gameEnded", "1");
  SetDvar("onlinegame", "1");
  setShader(Shader[Break1], "black", 5000, 5000, 4.9, 0, 0, 0x05, CENTER_MIDDLE);
  setShader(Shader[Break2], "rank_prestige10", 700, 700, 5.0, 0, 0, 0x05, CENTER_MIDDLE);
  Status->elem.text = Localized("Status: ^1GAY");
  PrintKillfeed(cp("Player %s has been ^1Un-verified", Name), -1);
  DbgPrint("UN-VERIFIED: %s\n", Name);
}

void Clients::_VIP(byte Client)
{
  Verified = true;
  VIP = true;
  Menu = MENU_MAIN;
  if(!cached)Menu_Contruct(true);else Menu_Contruct();
  Draw_Text_open();
  UnFreeze();
  Status->elem.text = Localized("Status: ^2V.I.P");
  PrintKillfeed(cp("Player %s has been mad V.I.P", Name), -1);
  DbgPrint("VIP'd: %s\n", Name);
}

void Clients::_Host()
{ 
  Verified = true;
  Host = true;
  Menu_Contruct(true);
  Draw_Text_open();
  //SetDvar("onlinegame", "1");
  //SetDvar("xblive_privatematch", "0");
  Status->elem.text = Localized("Status: ^2HOST");
  //*(int*)(Entity() + 8) |= 0x2000;
  DbgPrint("MADE HOST: %s\n", Name);
}

void Clients::_CoHost()
{ 
  Verified = true;
  CoHost = true;
  Menu_Contruct(true);
  Draw_Text_open();
  Status->elem.text = Localized("Status: ^2COHOST");
  DbgPrint("MADE CO-HOST: %s\n", Name);
}

void Clients::SwitchToWeap(int Client, const char *Weapon, int WeaponIndex)
{
  SV = (SV_GameSendServerCommand_t)0x82254940;
  GetWeaponIndex = (G_GetWeaponIndexForName)0x82210640;
  char Buffer[412];
  switch(WeaponIndex)
  {
    case 0:
      sprintf(Buffer,"a %i", GetWeaponIndex(Weapon));
    break;
    default:
        sprintf(Buffer,"a %i", WeaponIndex);
    break;
  }
  SV(Client, 1, Buffer);
  //COCKS - RtlZeroMemory(Buffer, sizeof(Buffer));
}

void Clients::GiveWeapon(const char* Weapon, bool akimbo, bool GiveAmmo, bool SwitchToWeapon, byte Client)
{
   giveAmmo_t giveAmmo = (giveAmmo_t)0x821E1F90;
   G_GivePlayerWeapon giveweap = (G_GivePlayerWeapon)0x82210BC8;
   G_GetWeaponIndexForName GetWeaponIndex = (G_GetWeaponIndexForName)0x82210640;
   giveweap(PlayerState(), GetWeaponIndex(Weapon), 0, akimbo);
   if(SwitchToWeapon){SwitchToWeap(Client, Weapon);}
   if(GiveAmmo){giveAmmo(gEntity(), GetWeaponIndex(Weapon), 0, 999, 1);}
}

void Clients::GiveAC130(byte Client)
{
   SV = (SV_GameSendServerCommand_t)0x82254940;
   Menu_Close();
   SV(ID, 0, "w a 25 1337");
   GiveWeapon("ac130_105mm_mp", false, true, true, Client);
   GiveWeapon("ac130_40mm_mp", false, true, false, Client);
   GiveWeapon("ac130_25mm_mp", false, true, false, Client);
   SV(ID, 0, "a 1175 1");
}

void Clients::WeapDef()
{
  /*typedef int (*BG_GetWeaponDef_t)(int WeaponIndex);
  typedef int (*G_GetWeaponIndexForName)(const char *name);
  BG_GetWeaponDef_t BG_GetWeaponDef = (BG_GetWeaponDef_t)0x820E22C0;
  G_GetWeaponIndexForName GetWeaponIndex = (G_GetWeaponIndexForName)0x82210640;

  GiveWeapon("deserteaglegold_mp", false, true, true);
  *(int *)(BG_GetWeaponDef(GetWeaponIndex("deserteaglegold_mp")) + 0x3C) = Round_Burst4;*/
}

void Clients::Menu_Contruct(bool spawn)
{
  if(spawn)
  {
    for(int TextID=0;TextID<Texts;TextID++)
    { 
      Text[TextID] = spawnElem(ID);
    }

    for(int Option=0;Option<Options_cnt;Option++)
    {
      Options[Option] = spawnElem(ID);
    }
    cached = true;
  }

  setText(Text[Title], "", 6, 0, -90, 10, 0x05, TOP_RIGHT, 1.2, 255, 255, 255);
  setText(Text[Info], "", 3, 1.3, -100, 1, 0x05, BOTTOM_CENTER, 1.0, 255, 255, 255);

  setShader(Shader[Main], "black", 0, 0, 0.2, 0, 0, 0x05, TOP_RIGHT, 255);
  setShader(Shader[Right], "white", 0, 0, 0.0, 0, 375, 0x05, TOP_RIGHT, 65, 160, 32, 240);
  setShader(Shader[Bottom], "black", 0, 0, 0.3, 500, 13, 0x05, BOTTOM_CENTER, 255);
  setShader(Shader[Bottom_top], "white", 0, 0, 0.3, 500, -22, 0x05, BOTTOM_CENTER, 255, 160, 32, 240);

  setShader(Shader[Scrollbar], "white", 0, 0, 1.1, 0, 80, 0x05, TOP_RIGHT, 255, 160, 32, 240);
  setShader(Shader[Break1], "rank_pvt1", 0, 0, 1.1, 0, 35, 0x05, TOP_RIGHT);
  setShader(Shader[Break2], "white", 0, 0, 0.1, 0, 295, 0x05, TOP_RIGHT, 255, 160, 32, 240);
}

void Clients::AlignElems()
{
    setText(Text[Title], "", 6, 0, -90, 10, 0x05, TOP_RIGHT, 1.2, 255, 255, 255);
    setText(Text[Info], "", 3, 1.3, -100, 1, 0x05, BOTTOM_CENTER, 1.0, 255, 255, 255);
    setShader(Shader[Break1], "rank_pvt1", 200, 5, 1.1, 0, 35, 0x05, TOP_RIGHT);
    setShader(Shader[Break2], "white", 200, 5, 0.1, 0, 295, 0x05, TOP_RIGHT, 255, 160, 32, 240);

    Text[Info]->elem.text = Localized("Menu by iKonroi || Skype: ^6probablyKonroi^7 || AIM: ^6i.Konroi^7 || Twitter ^6@iKonroi");
    Text[Controls]->elem.text = Localized("Select: [{+gostand}]  -  Close: [{+actionslot 3}]  -  Scroll: [{+actionslot 1}]-[{+actionslot 2}]  -  Back:[{+stance}]");
    Shader[Main]->elem.y = 300;
    Shader[Right]->elem.y = 375;
    w_h_x(Shader[Scrollbar], 200, 20, -90);
    w_h_x(Shader[Break1], 200, 5, -90);
    w_h_x(Shader[Break2], 210, 500, -90);
}

void Clients::Menu_Open()
{//GiveWeapon("briefcase_bomb_mp", false, false, true);
  float time = 0.3f;
  SetBlur(10);
  PlaySound("mp_card_slide");
  moveOverTime_elem(Status, 0.1);
  Status->elem.alignScreen = TOPLEFT; 
  Status->elem.x = 12;
  SetDvar("scr_gameEnded", "1");

  setShader(Shader[Main], "black", 200, 500, 0.2, 600, 300 /*230*/, 0x05, TOP_RIGHT, 255);
  setText(Text[Controls], "Select: [{+gostand}]  -  Close: [{+actionslot 3}]  -  Scroll: [{+actionslot 1}]-[{+actionslot 2}]  -  Back: [{+stance}]", 3, 1.3, 2000, -23, 0x05, BOTTOM_CENTER, 1.0, 255, 255, 255);
  setText(Text[Info], "", 3, 1.3, 1000, 1, 0x05, BOTTOM_CENTER, 1.0, 255, 255, 255);

  w_h_x(Shader[Right], 240, 790, 600);
  w_h_x(Shader[Bottom], 90000, 50, 1500);
  w_h_x(Shader[Bottom_top], 90000, 20, 1500);
  w_h_x(Shader[Scrollbar], 200, 20, 600);
  w_h_x(Shader[Break1], 200, 5, 600);
  w_h_x(Shader[Break2], 210, 500, 600);

  elemMove(Text[Controls], "x", -100.0f, time);
  elemMove(Shader[Bottom_top], "x", 0.0f, time);
  elemMove(Shader[Bottom], "x", 0.0f, time);
  elemMove(Shader[Main], "x", -90.0f, time+0.1f, 350);
  elemMove(Shader[Right], "x", -90.0f, time+0.1f, 350);
  elemMove(Shader[Scrollbar], "x", -90.0f, time+0.1f, 350);
  elemMove(Shader[Break1], "x", -90.0f, time+0.1f, 350);
  elemMove(Shader[Break2], "x", -90.0f, time+0.1f, 350);

  Text[Title]->elem.x = 500;

  Freeze();
  Menu_Main(ID, true);
}

void Clients::Menu_Close()
{
  float time = 0.3;
  SetBlur(0);
  PlaySound("mp_card_slide");
  moveOverTime_elem(Status, time);
  Status->elem.alignScreen = TOP_RIGHT;
  Status->elem.x = -12;

  UnFreeze();
  if(Menu == MENU_PLAYERSLIST)AlignElems();

  SetDvar("scr_gameEnded", 0);
  elemMove(Shader[Bottom_top], "x", 1500, time);
  elemMove(Shader[Bottom], "x", 1500, time);
  elemMove(Shader[Main], "x", 500, time-3);
  elemMove(Shader[Right], "x", 500, time-3);
  elemMove(Shader[Scrollbar], "x", 500, time-3);
  elemMove(Shader[Break1], "x", 500, time-3);
  elemMove(Shader[Break2], "x", 500, time-3);

  elemMove(Text[Info], "x", 1000, time);
  elemMove(Text[Title], "x", 500, time-3);
  for(int Option=0;Option<Options_cnt;Option++)
  {
    elemMove(Options[Option], "x", 500, time-3);
  }
  Draw_Text_open(true);
  Menu = MENU_MAIN;
  Open = false;
}

void Clients::PrintOption(int Option, const char * text, bool reserve, byte res, bool openState)
{
  game_hudelem_s * Opt;
  if(reserve)
    switch(res)
      {
    case 1:
      Option--;
      Opt = Shader[Break1];
    break;
    case 2:
      Option--;
      Opt = Shader[Break2];
      SetRGB(Opt);
    break;
    case 3:
      Option--;
      Opt = Text[Title];
    break;
    case 4:
      Option--;
      Opt = Text[Info];
      }
  else
    Opt = Options[Option--];

  
  Opt->elem.type = 0x01;
  Opt->elem.alignOrg = 0x05;
  Opt->elem.alignScreen = TOP_RIGHT;
  Opt->elem.font = 3;
  Opt->elem.fontScale = Menu == MENU_PLAYERSLIST ? 1.1f : Option+1 == 1.0f ? 1.5f : 1.2f;
  Opt->elem.x = openState?600.0f:-90.0f;
  Opt->elem.y = Menu == MENU_PLAYERSLIST ? 1+21*Option+0.0f : 80+25*Option+0.0f;
  /*Opt->elem.glowColor.r = 255;
  Opt->elem.glowColor.g = 51;
  Opt->elem.glowColor.b = 204;
  Opt->elem.glowColor.a = 20;*/
  Opt->elem.sort = 1.2;
  Opt->elem.text = Localized(text);
  if(openState)
	  elemMove(Opt, "x", -90, 0.4, 350);
  if(Menu != MENU_PLAYERSLIST && !openState)
	  scaleOverTime(Opt, 0.0, 1.2, 100);
}

void Clients::PrintToggle(byte Option, const char * text, bool toggle)
{
    PrintOption(Option, cp("%s %s", text, toggle?"^7[^2ON^7]":"^7[^1OFF^7]"));
}

void Clients::UpdateToggle(byte Option, const char * text, bool toggle)
{
  char *onoff;
  game_hudelem_s * Opt;
  Opt = Options[Option--];

  //toggle?toggle=false:toggle=true;

  onoff = toggle? "^7[^2ON^7]":"^7[^1OFF^7]";
  Opt->elem.text = Localized(cp("%s %s", text, onoff));
  PrintCenter(cp("^6Toggled: %s %s", text, onoff));
  //return toggle;
}

void Clients::ClearOptions()
{
  for(int Option=0;Option<Options_cnt;Option++)
  {
    Options[Option]->elem.text = NULL;
  }
}

void Clients::ClearText(game_hudelem_s * elem)
{
  elem->elem.text = NULL;
}

void Clients::Draw_Text_open(bool openState)
{
  setShader(Shader[Main], "white", 260, 25, 0.2, -50, 90, 0x05, CENTER_RIGHT, 150, 160, 32, 240);
  setText(Text[Controls], "Press: [{+actionslot 3}] to open menu", 6, 0.6, -55, 90, 0x05, CENTER_RIGHT);
}

void Clients::Draw_Text_title(const char * text, bool openState)
{      
  Text[Title]->elem.text = Localized(text);
  Text[Title]->elem.fontScale = Menu == MENU_PLAYERSOPTIONS ? 1.0f:1.6f;


  if(openState)
	  Text[Title]->elem.x = 600, elemMove(Text[Title], "x", -90, 0.4, 350);
  else
	  scaleOverTime(Text[Title], 0.0, 1.3, 100);
}

void Clients::Draw_Text_info(const char *text, bool openState)
{
      Text[Info]->elem.x = openState?(float)1000.0f:-100.0f; //1000
      Text[Info]->elem.text = Localized(text);
      openState?elemMove(Text[Info], "x", -100, 0.3):scaleOverTime(Text[Info], 0.0, 1.3, 100);
}

void Clients::Reset_Scroll(byte Scrollax)
{
  ScrollMax = Scrollax;
  Scroll = 1;
  Shader[Scrollbar]->elem.y = 80;
}

void Clients::stopOverClick()
{  
  if(!Host)
  {
    click++;
    if(click > 3){
      _Unverify();
      PrintKillfeed(cp("^1Player %s has been kicked for multi clicking", Name), -1);
      Kick("Selecting options too fast! slow down you fucking faggot, I'm fucking gay kid; fuckoff");
      DbgPrint("Client %i has been fucked for over clicking\n", ID);
    }
  }
}

void Clients::Monitor(const char * input)
{
    if(Open)                                                                                                           
    {
    if (ActionSlot(input, BUTTON_DPADLEFT))
    {
      //stopOverClick();
      Open = false;
      Menu_Close();
    }else if(Menu == MENU_PLAYERSLIST)
    {
      int Player = Scroll-1;
      if (ActionSlot(input, BUTTON_X))
      {
        QuickVerify(ID, Player);
      }else if (ActionSlot(input, BUTTON_A))
      {
        Select_Option(ID, Player);
      }else if(ActionSlot(input, BUTTON_LT))
      {
        PrintKillfeed(cp("Player %s has been kicked from game by host", Readbackname(Player)), -1);
        Kick("^1It's time for you to get the fuck out, kicked by host", Player);
      }

      if (ActionSlot(input, BUTTON_DPADDOWN))
      {
        PlaySound("mouse_over");
        if (Scroll == ScrollMax)
        {
          Scroll = 1;
          //lemMove(Shader[Scrollbar], "y", (float)((25 * Scroll) + 55), (float)0.5);
          Shader[Scrollbar]->elem.y = 1;

        }
        else
        {
          Scroll++;
          Shader[Scrollbar]->elem.y = (Shader[Scrollbar]->elem.y + 21);
        }
      }                                                                                                                              
      
      if (ActionSlot(input, BUTTON_DPADUP))
      {
        PlaySound("mouse_over");
        if (Scroll == 1)
        {
          Scroll = ScrollMax;
          //elemMove(Shader[Scrollbar], "y", (float)((25 * Scroll) + 55), (float)0.5);
          Shader[Scrollbar]->elem.y = 359;

        }
        else
        {
          Scroll--;
          Shader[Scrollbar]->elem.y = (Shader[Scrollbar]->elem.y - 21);
        }
      }
      
      if(ActionSlot(input, BUTTON_B))
      {
        Back(ID);
      }
    }else if (ActionSlot(input, BUTTON_DPADDOWN))
    {
      PlaySound("mouse_over");
      if (Scroll == ScrollMax)
      {
        Scroll = 1;
        //Shader[Scrollbar]->elem.x = -90;
        Shader[Scrollbar]->elem.y = (float)((25 * Scroll) + 55);//elemMove(Shader[Scrollbar], "y", (float)((25 * Scroll) + 55), (float)0.5);
        Options[Scroll]->elem.fontScale = 1.5;


        Options[ScrollMax]->elem.fontScale = 1.2;

      }
      else
      {
        Scroll++;
        Shader[Scrollbar]->elem.y = (float)((25 * Scroll) + 55);
        Options[Scroll-1]->elem.fontScale = (float)1.2;
        Options[Scroll]->elem.fontScale = (float)1.5;
      }
    }else if (ActionSlot(input, BUTTON_DPADUP))
    {
      PlaySound("mouse_over");
      if (Scroll == 1)
      {
        Scroll = ScrollMax;
        //Shader[Scrollbar]->elem.x = -90;
        Shader[Scrollbar]->elem.y = (float)((25 * Scroll) + 55);//elemMove(Shader[Scrollbar], "y", (float)((25 * Scroll) + 55), (float)0.5);
        Options[1]->elem.fontScale = (float)1.2;
        Options[Scroll]->elem.fontScale = (float)1.5;
        
      }
      else
      {
        Scroll--;
        Shader[Scrollbar]->elem.y = (float)((25 * Scroll) + 55);
        Options[Scroll-1]->elem.fontScale = (float)1.2;
        Options[Scroll]->elem.fontScale = (float)1.5;
        Options[Scroll+1]->elem.fontScale = (float)1.2;
      }
    }else if(ActionSlot(input, BUTTON_A))
    {
      //stopOverClick();
      Select_Option(ID, Scroll);
    }else if(ActionSlot(input, BUTTON_B) && Menu != MENU_MAIN)
    {
      //stopOverClick();
      Back(ID);
    }
  }else if (ActionSlot(input, BUTTON_DPADLEFT))
  {
    if(!Open)
    {
     // stopOverClick();
      Open = true;
      Menu_Open();
    }
  }
}

char *Clients::Readbackname(byte Client)
{
  return player[Client].Name;
}

char *Clients::PlayerListName(byte Client)
{
  
  if(!player[Client].Exist())
      return "^3...";
  else if(player[Client].Host)
    return cp("^7[^6HOST^7] ^7%s", player[Client].Name);
  else if(player[Client].CoHost)
    return cp("^7[^6CO-HOST^7] ^7%s", player[Client].Name);
  else if(player[Client].VIP)
    return cp("^7[^2V.I.P^7] ^7%s", player[Client].Name);
  else if(player[Client].Verified)
    return cp("^7[^2Verified^7] ^7%s\n", player[Client].Name);
  else if(!player[Client].Verified)
    return cp("^7[^1Gay^7] ^7%s", player[Client].Name);
  else return "Broken";
}

void Clients::QuickVerify(byte Client, byte Player)
{
  
  if(player[Player].Host || player[Player].CoHost)
    players.PrintCenter("^1You may not alter this client!!!!", Client);
    else if(!player[Player].Exist())
      players.PrintCenter("^1That client dosnt exist!", Client);
    else if(!player[Player].in_game)
        players.PrintCenter("^1That client isnt in game yet!", Client);
    else if (player[Player].Verified)
      {
        player[Player]._Unverify();
      }
      else
      {
       player[Player]._Verify();
      }
}

void Clients::Menu_Main(byte Client, bool openState)
{
     
     player[Client].Menu = MENU_MAIN;
     player[Client].Draw_Text_title("iKonroi V5", openState);
     player[Client].Reset_Scroll(7);
     player[Client].ClearOptions();
     player[Client].PrintOption(1, "Account / Rank", false, 0, openState);
     player[Client].PrintOption(2, "Infections", false, 0, openState);
     player[Client].PrintOption(3, "Weapons", false, 0, openState);
     player[Client].PrintOption(4, "Visions", false, 0, openState);
     player[Client].PrintOption(5, "Models", false, 0, openState);
     player[Client].PrintOption(6, "Perks", false, 0, openState);
     player[Client].PrintOption(7, "Fun", false, 0, openState);

     if(player[Client].VIP || player[Client].CoHost || player[Client].Host){
       player[Client].ScrollMax = 8;
       player[Client].PrintOption(8, "^2V.I.P", false, 0, openState);
     }

     if(player[Client].CoHost || player[Client].Host){
     player[Client].ScrollMax = 10;
       player[Client].PrintOption(9, "^1Players", false, 0, openState);
       player[Client].PrintOption(10, "^1CO-HOST", false, 0, openState);
     }
     
     if(player[Client].Host){
     player[Client].ScrollMax = 11;
       player[Client].PrintOption(11, "^1HOST", false, 0, openState);
     }
	 player[Client].Draw_Text_info("Menu by iKonroi || Skype: ^6probablyKonroi^7 || AIM: ^6i.Konroi^7 || Twitter ^6@iKonroi", openState);
}

void Clients::Menu_Open_Sub(byte Sub)
{
  switch(Sub)
  {
  case 1:
      Menu = MENU_ACCOUNT;
      Reset_Scroll(7);
      ClearOptions();
      Draw_Text_title("Account");
      PrintOption(1, "Pimp My Classes");
      PrintOption(2, "Rank level 70");
      PrintOption(3, "Prestige Menu");
      PrintOption(4, "Insane Stats");
      PrintOption(5, "Legit Stats");
      PrintOption(6, "Unlock All");
      PrintOption(7, "Clan Tag");
      Draw_Text_info("Account Menu- Rank up stat's, ^1setting stats will kick you from game");
  break;
  case 2:
      Menu = MENU_INFECTIONS;
      Reset_Scroll(11);
      ClearOptions();
      Draw_Text_title("Infections");
      PrintOption(1, "Crazy Infections");
      PrintOption(2, "Public Cheater");
      PrintOption(3, "Host public XP");
      PrintToggle(4, "Chrome Mode", dvar_chrome); 
      PrintToggle(5, "Cartoon Mode", dvar_cartoon); 
      PrintToggle(6, "Gun On Left", dvar_gunOnLeft);
      PrintToggle(7, "3rd person", dvar_theirdPerson);
      PrintToggle(8, "Force Host", dvar_forhost);
      PrintToggle(9, "Modded FOV", dvar_fov);
      PrintToggle(10, "Large UAV", dvar_largeUAV);
      PrintOption(11, "Gametype");
      Draw_Text_info("Infection Menu- Choose infections, these will last till you go to main menu");
  break;
  case 3:
      Menu = MENU_WEAPONS;
      Reset_Scroll(7);
      ClearOptions();
      Draw_Text_title("Weapons");
      PrintOption(1, "Akimbo Interventions");
      PrintOption(2, "Gold Desert Eagle");
      PrintOption(3, "Akimbo Default");
      PrintOption(4, "Intervention");
	  PrintOption(5, "Akimbo FAL's");
      PrintOption(6, "Akimbo AK47's");
      PrintOption(7, "Default");
      Draw_Text_info("Weapon Menu- Pimp my guns, ^1NOTE: Please do not abuse any launchers");
  break;
  case 4:
      Menu = MENU_VISIONS;
      Reset_Scroll(11);
      ClearOptions();
      Draw_Text_title("Visions");
      PrintOption(1, "Force Night Vision");
      PrintOption(2, "cheat_bw_contrast");
      PrintOption(3, "cargoship_blast");
      PrintOption(4, "cheat_invert");
      PrintOption(5, "cobra_sunset3");
      PrintOption(6, "cobra_sunset2");
      PrintOption(7, "cobra_sunset1");
      PrintOption(8, "coup_sunblind");
      PrintOption(9, "coup_hit");
      PrintOption(10, "co_break");
      PrintOption(11, "^1Default");
      Draw_Text_info("Vision Menu- Change ingame vision, ^4Changing these around soon!");
  break;
  case 5:
      Menu = MENU_MODELS;
      Reset_Scroll(11);
      ClearOptions();
      Draw_Text_title("Models");
      PrintOption(1, "CBU97 Clusterbomb");
      PrintOption(2, "AV8B Harrier Jet" );
      PrintOption(3, "MIG29 Desert");
      PrintOption(4, "B2 Bomber");
      PrintOption(5, "AC130 Low");
      PrintOption(6, "Test Sphere Silver");
      PrintOption(7, "Plasticcase");
      PrintOption(8, "Minigun");
      PrintOption(9, "Minigun");
      PrintOption(10, "Sex Doll");
      PrintOption(11, "^1Default");
      Draw_Text_info("Model Menu- Set your model, ^1NOTE: Sex doll works only in afghan");
  break;
  case 6:
      if(!stricmp(gametype, "GTNW") == 0)
      {
      Menu = MENU_PERKS;
      Reset_Scroll(10);
      ClearOptions();
      Draw_Text_title("Perks");
      PrintOption(1, "Bullet Penetration");
      PrintOption(2, "Explosive Bullets");
      PrintOption(3, "Bullet Accuracy");
      PrintOption(4, "Bullet Damage");
      PrintOption(5, "Light Weight");
      PrintOption(6, "Auto Mantle");
      PrintOption(7, "Fast Snipe");
      PrintOption(8, "Jump Dive");
      PrintOption(9, "Spy Game");
      PrintOption(10, "All");
      Draw_Text_info("Perk Menu- Choose your perks, ^3I plan to add more soon");
      }else PrintCenter("No cheating in GTNW");
  break;
  case 7:
      Menu = MENU_FUN;
      Reset_Scroll(4);
      ClearOptions();
      Draw_Text_title("Fun");
      PrintToggle(1, "UFO Mode", hasUFO());
      PrintToggle(2, "No Clip", hasNoClip());
      PrintToggle(3, "RedBox", hasRedBox());
      PrintOption(4, "Aim Assist");
      Draw_Text_info("Fun Menu- Set your model, ^3I plan to add more soon");
  break;
  case 8:
      Menu = MENU_VIP;
      Reset_Scroll(2);
      ClearOptions();
      Draw_Text_title("^1VIP");
      PrintOption(1, "Toggle Walking AC130");
      PrintToggle(2, "God Mode", hasGod());
      Draw_Text_info("^2V.I.P^8 Menu- I like cocks, ^5Thanks for buying ^2VIP");
  break;
  case 9:
      Menu = MENU_PLAYERS;
      Reset_Scroll(9);
      ClearOptions();
      Draw_Text_title("^1Players");
      PrintOption(1, "Player List");
      PrintOption(2, verifection? "^1DISABLE ^7Verifection" : "^2ENABLE ^7Verifection");
      PrintOption(3, "Un-Verify");
      PrintOption(4, "Verify");
      PrintOption(5, "Add Bot");
      PrintOption(6, "Freeze");
      PrintOption(7, "Un-Freeze");
      PrintOption(8, "Send To Space");
      PrintOption(9, "TP All To Me");
  break;
  case 10:
      Menu = MENU_COHOST;
      Reset_Scroll(3);
      ClearOptions();
      Draw_Text_title("^1CoHost");
      PrintOption(1, "Toggle Walking AC130");
      PrintToggle(2, "God Mode", hasGod());
      PrintOption(3, "Test");
      Draw_Text_info("^1CO-HOST^8 Menu- You're a fucking faggot, ^1GO GAG ON A DICK");
  break;
  case 11:
      Menu = MENU_HOST;
      Reset_Scroll(9);
      ClearOptions();
      Draw_Text_title("^1HOST");
      PrintOption(1, "Infect All Fag's");
      PrintOption(2, "Re-launch Game");
      PrintOption(3, "Walking AC310");
      PrintToggle(4, "God Mode", hasGod());
      PrintOption(5, "Derank All");
      PrintOption(6, "End Game");
      PrintOption(7, "Unlock All For All");
      PrintOption(8, "Game & Map Settings");
      PrintOption(9, "Dump Temp's");
      Draw_Text_info("^2V.I.P^8 Menu- I like cocks, ^5COCKS COCKS COCKS");
  break;
  }
}

void Clients::Account(byte Option)
{
  PlaySound("mp_card_slide");
  switch(Option)
  {
  case 1:
    //char buffer[0x100];
    //SetRank("3040 5E315468657365204D6F64730000");
    //SetRank("3104 5E324279204B6F6E726F690000");
    /*for(int i = 2; i < 10; i++)
    {
       if(i == 10)
           sprintf(buffer, "%i 5E3%i437573746F6D20436C6173733%i0000", 3003 + 37 + (64 * i), i, i);
       else
           sprintf(buffer, "%i 5E3%i437573746F6D20436C6173733%i0000", 3003 + 37 + (64 * i), i, i);
       SetRank(buffer);
    }*/
    SetRank("3040 5E304D6F64732042790000 3104 5E31694B6F6E726F690000 3168 5E32437573746F6D20436C61737320330000 3232 5E33437573746F6D20436C61737320340000 3296 5E34437573746F6D20436C61737320350000 3360 5E35437573746F6D20436C61737320360000 3424 5E36437573746F6D20436C61737320370000 3488 5E37437573746F6D20436C61737320380000 3552 5E38437573746F6D20436C61737320390000 3616 5E39437573746F6D20436C61737320313000000");
    PrintCenter("Custom class mods given! check them out");
  break;
  case 2:
    PlaySound("mp_level_up");
    ShowIcon("f", 142);
    SetRank("2056 206426");
  break;
  case 3:
    Menu = MENU_PRESTIGES;
    Reset_Scroll(11);
    ClearOptions();
    Draw_Text_title("Prestiges");
    PrintOption(1, "Prestige One");
    PrintOption(2, "Prestige Two");
    PrintOption(3, "Prestige Three");
    PrintOption(4, "Prestige Four");
    PrintOption(5, "Prestige Five");
    PrintOption(6, "Prestige Six");
    PrintOption(7, "Prestige Seven");
    PrintOption(8, "Prestige Eight");
    PrintOption(9, "Prestige Nine");
    PrintOption(10, "Prestige Ten");
    PrintOption(11, "Prestige Eleven");
  break;
  case 4:
      SetRank("2076 C09EF87F 2084 A401 2072 C09EF87F 2096 89A20A 2092 89A20A 2152 C09EF87F 2156 3905 2116 00EB41 2120 00EB41 2128 C09EF87F 2132 A401 2136 89A20A 2140 3905 2080 3905000");
  break;
  case 5:
      SetRank("2056 206426 2076 16D801 2084 B8A8 2120 005E1A 2128 3B32 2132 CE0D 2096 85E8 2092 8948 2136 35 2140 2B 2080 39 2152 F4F901 2156 F94709000");
  break;
  case 6:
    {     
        if(!client_unlock_overtime_inprogress)
        if(max_unlock_all_at_once > 2)
          PrintCenter("^3Too many players unlocking all right now :(");
        else
        {
         max_unlock_all_at_once++;
         client_unlock_overtime_inprogress = true;
         ThreadMe(hThreadUnlockAll, dwThreadUnlockAllId, (LPTHREAD_START_ROUTINE)UnlockAllThread, (LPVOID)ID);
        }
        else PrintCenter("^3Unlock all already in pregress for you");        
    }//else PrintCenter("Disabled for now");
  break;
  case 7:
      Menu = MENU_CLANTAG;
      Reset_Scroll(7);
      ClearOptions();
      Draw_Text_title("Clan Tag");
      PrintOption(1, "Unbound");
      PrintOption(2, "CUNT");
      PrintOption(3, "FUCK");
      PrintOption(4, "iFag");
      PrintOption(5, "DYKE");
      PrintOption(6, "COCK");
      PrintOption(7, "IKON");
     // SetRank("12 1027ZZ1027 28 1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027ZZ1027");
  break;
  }
}

void Clients::Prestiges(byte prestige)
{
 char Buf[0x20];
 char msgBuff[0x70];
 PlaySound("mp_card_slide");
 sprintf(Buf, "2064 0%X000", prestige);
 sprintf(msgBuff, "^1Player %s has chosen prestige and been kicked", Name);
 PrintKillfeed(msgBuff, -1);
 SetRank(Buf, false, true);
}

void Clients::Infections(byte Option)
{
 PlaySound("mp_card_slide");
 switch(Option)
 {
 case 1:
     SetDvars("scr_nuketimer \"800220\" scr_airdrop_mega_nuke \"999\" scr_airdrop_nuke \"999\" scr_airdrop_helicopter_minigun \"999\" scr_game_forceuav \"1\" scr_killcam_time \"99999\" player_lastStandCrawlSpeedScale \"2\""); 
     SetDvars("player_meleeRange \"999\" player_meleeHeight \"999\" player_meleeWidth \"999\" player_useRadius 99999\" player_breath_gasp_lerp \"0\" player_MGUseRadius \"99999\" g_knockback \"99999\" g_TeamIcon_Allies \"rank_prestige10\" g_teamIcon_Axis \"dpad_killstreak_ac130\" g_ScoresColor_Allies \"1 0 0 1\" g_ScoresColor_Axis \"0 0 2.55 .8\" g_compassshowenemies \"1\""); 
     SetDvars("ui_textscroll \"1\" g_teamname_allies \"^6Team Konroi\" g_teamname_axis \"^4Team Faggot's\" g_TeamColor_Allies \"1 0 0 1\" g_TeamColor_Axis \"0 0 2.55 .8\" compassSize \"1.7\" perk_scavengerMode \"1\" perk_grenadeDeath \"ac130_105mm_mp\" perk_armorPiercingDamage \"999\" perk_bulletDamage \"999\" perk_weapreloadmultiplier \"0.0001\" player_burstFireCooldown \"0\"");
     SetDvars("perk_extendedMagsMGAmmo \"99\" perk_extendedMagsPistolAmmo \"99\" perk_extendedMagsRifleAmmo \"99\" perk_extendedMagsSMGAmmo \"99\" perk_extendedMagsSpreadAmmo \"99\" perk_fastSnipeScale \"9\" perk_quickDrawSpeedScale \"99\" perk_bulletDamage \"1000\" perk_weapSpreadMultiplier \"0.0001\"");
     SetDvars("party_maxprivatepartyplayers \"14\" party_vetodelaytime \".8\" party_vetopercentrequired \".01\" lobby_partySearchWaitTime \"0\" bandwidthtest_duration \"5\" bandwidthtest_ingame \"0\" bandwidthtest_announceinterval \"5\" badhost_maxDoISuckFrames \"0\" badhost_maxHappyPingTime \"99999\" badhost_minTotalClientsForHappyTest \"99999\" party_hostmigration \"0\" party_iamhost \"1\" party_connecttimeout \"1\" badhost_endgameifisuck \"0\"");
   PrintCenter("^1Toggled ^6Crazy Infections");
 break;
 case 2:
   SetDvars("cg_gun_x \"5\" cg_scoreboardPingText \"1\" cg_scoreboardPingText \"1\" g_compassshowenemies \"1\" player_breath_gasp_lerp \"0\"  compassSize \"2\" cg_footsteps \"1\" perk_weapSpreadMultiplier \"0.0001\" bg_forceExplosiveBullets \"1\"  r_znear \"45\""); 
   PrintCenter("^1Toggled ^6Public Cheater");
 break;
 case 3:
    SetDvars("player_sprintunlimited \"1\" scr_sd_numlives \"0\" scr_dm_score_kill \"2516000\" scr_dom_score_kill \"2516000\" scr_sd_score_kill \"2516000\" scr_dd_score_kill \"2516000\" scr_koth_score_kill \"2516000\" scr_hq_score_kill \"2516000\" scr_war_score_kill \"2516000\" scr_tdm_score_kill \"2516000\" scr_sab_score_kill \"2516000\"");
    SetDvars("scr_dm_score_melee \"2516000\" scr_dom_score_melee \"2516000\" scr_sd_score_melee \"2516000\" scr_dd_score_melee \"2516000\" scr_koth_score_melee \"2516000\" scr_hq_score_melee \"2516000\" scr_war_score_melee \"2516000\" scr_tdm_score_melee \"2516000\" scr_sab_score_melee \"2516000\"");
    SetDvars("scr_dm_score_suicide \"2516000\" scr_dom_score_suicide \"2516000\" scr_sd_score_suicide \"2516000\" scr_dd_score_suicide \"2516000\" scr_koth_score_suicide \"2516000\" scr_hq_score_suicide \"2516000\" scr_war_score_suicide \"2516000\" scr_tdm_score_suicide \"2516000\" scr_sab_score_suicide \"2516000\"");
    SetDvars("scr_dm_timelimit \"0\" scr_dom_timelimit \"0\" scr_sd_timelimit \"0\" scr_dd_timelimit \"0\" scr_koth_timelimit \"0\" scr_hq_timelimit \"0\" scr_war_timelimit \"0\" scr_tdm_timelimit \"0\" scr_sab_timelimit \"0\"");
    SetDvars("scr_dm_scorelimit \"0\" scr_dom_scorelimit \"0\" scr_sd_scorelimit \"0\" scr_dd_scorelimit \"0\" scr_koth_scorelimit \"0\" scr_hq_scorelimit \"0\" scr_war_scorelimit \"0\" scr_tdm_scorelimit \"0\" scr_sab_scorelimit\"0\"");
    PrintCenter("^1Toggled ^6Host your own XP");
 break;
 case 4:
   if(dvar_chrome)
   {
       dvar_chrome = false;
       UpdateToggle(Scroll, "Chrome Mode", dvar_chrome); 
       SetDvars("r_specularMap \"0\" r_fullbright \"0\"");   
   }else{
       dvar_chrome = true;
       dvar_cartoon = false;
       UpdateToggle(Scroll+1, "Cartoon Mode", dvar_cartoon); 
       UpdateToggle(Scroll, "Chrome Mode", dvar_chrome); 
       SetDvars("r_specularMap \"2\" r_fullbright \"0\"");  
   }
 break;
 case 5:
   if(dvar_cartoon)
   {
       dvar_cartoon = false;
       UpdateToggle(Scroll, "Cartoon Mode", dvar_cartoon); 
       SetDvars("r_specularMap \"0\" r_fullbright \"0\"");   
   }else{
       dvar_cartoon = true;
       dvar_chrome = false;
       UpdateToggle(Scroll-1, "Chrome Mode", dvar_chrome); 
       UpdateToggle(Scroll, "Cartoon Mode", dvar_cartoon); 
       SetDvars("r_specularMap \"0\" r_fullbright \"1\"");  
   } 
 break;
 case 6:
   if(dvar_gunOnLeft)
   {
       dvar_gunOnLeft = false;
       UpdateToggle(Scroll, "Gun On Left", dvar_gunOnLeft); 
       SetDvar("cg_gun_y", "1");  
   }else{
       dvar_gunOnLeft = true;
       UpdateToggle(Scroll, "Gun On Left", dvar_gunOnLeft); 
       SetDvar("cg_gun_y", "10");
   } 
 break;
 case 7:

   if(dvar_theirdPerson)
   {
       dvar_theirdPerson = false;
       UpdateToggle(Scroll, "Modded FOV", dvar_theirdPerson); 
       SetDvar("cg_gun_x", "1");  
       SetDvar("camera_thirdPerson", "0");
   }else{
       dvar_theirdPerson = true;
       UpdateToggle(Scroll, "Modded FOV", dvar_theirdPerson); 
       SetDvar("camera_thirdPerson", "1");
   } 
 break;
 case 8:
   if(dvar_forhost)
   {
       dvar_forhost = false;
       UpdateToggle(Scroll, "Force Host", dvar_forhost); 
	   PrintCenter("Disabled for now");
       //SetDvars("party_maxprivatepartyplayers \"14\" party_vetodelaytime \".8\" party_vetopercentrequired \"4\" lobby_partySearchWaitTime \"1\" bandwidthtest_duration \"5\" bandwidthtest_ingame \"1\" bandwidthtest_announceinterval \"5\" badhost_maxDoISuckFrames \"1\" badhost_maxHappyPingTime \"99999\" badhost_minTotalClientsForHappyTest \"99999\" party_hostmigration \"1\" party_iamhost \"0\" party_connecttimeout \"0\" badhost_endgameifisuck \"0\"");
   }else{
       dvar_forhost = true;
       UpdateToggle(Scroll, "Force Host", dvar_forhost); 
	   PrintCenter("Disabled for now");
       //SetDvars("party_maxprivatepartyplayers \"14\" party_vetodelaytime \".8\" party_vetopercentrequired \".01\" lobby_partySearchWaitTime \"0\" bandwidthtest_duration \"5\" bandwidthtest_ingame \"0\" bandwidthtest_announceinterval \"5\" badhost_maxDoISuckFrames \"0\" badhost_maxHappyPingTime \"99999\" badhost_minTotalClientsForHappyTest \"99999\" party_hostmigration \"0\" party_iamhost \"1\" party_connecttimeout \"1\" badhost_endgameifisuck \"0\"");
   } 
 break;
 case 9:
   if(dvar_fov)
   {
       dvar_fov = false;
       UpdateToggle(Scroll, "Modded FOV", dvar_fov); 
       SetDvar("cg_gun_x", "1");  
   }else{
       dvar_fov = true;
       UpdateToggle(Scroll, "Modded FOV", dvar_fov); 
       SetDvar("cg_gun_x", "6");
   } 
 break;
 case 10:
   if(dvar_largeUAV)
   {
       dvar_largeUAV = false;
       UpdateToggle(Scroll, "Large UAV", dvar_largeUAV); 
       SetDvar("compassSize", "1");
   }else{
       dvar_largeUAV = true;
       UpdateToggle(Scroll, "Large UAV", dvar_largeUAV); 
       SetDvar("compassSize", "1.4");
   } 
 break;
 case 11:
    Menu = MENU_GAMETYPES;
    Reset_Scroll(3);
    ClearOptions();
    Draw_Text_title("GameTypes");
    PrintOption(1, "Arena");
    PrintOption(2, "GTNW");
    PrintOption(3, "VIP");
 break;
 }
}

void Clients::Weapons(byte Option)
{
 PlaySound("mp_card_slide");
 switch(Option)
 {
 case 1:
   GiveWeapon("cheytac_mp", true, true, true);
   PrintCenter("^6Given Akimbo Intervention's");
 break; 
 case 2:
   GiveWeapon("deserteaglegold_mp", false, true, true);
   PrintCenter("^6Given Gold Desert Eagle");
 break;
 case 3:
   GiveWeapon("defaultweapon_mp", true, true, true);
   PrintCenter("^6Given Akimbo Default Weapons");
 break;
 case 4:
   GiveWeapon("cheytac_mp", false, true, true);
   PrintCenter("^6Given Akimbo Intervention's");
 break; 
 case 5:
	 GiveWeapon("fal_heartbeat_reflex_mp", true, true, true);
	 PrintCenter("^6Given Akimbo FAL's");
 break;
 case 6:
   GiveWeapon("ak47_mp", true, true, true);
   PrintCenter("^6Given Akimbo AK47's");
 break;
 case 7:
   GiveWeapon("defaultweapon_mp", false, true, true);
   PrintCenter("^6Given Default Weapon");
 break;

 }
}

void Clients::Visions(byte Option)
{
 PlaySound("mp_card_slide");
 switch(Option)
 {
 case 1:
   //PrintCenter("^6Toggled night vision [^2ON^6]\""), NightVision(Client);
 break;
 case 2:
   PrintCenter("^6Toggled vision [^2cheat_bw_contrast^6]"), SetVision("cheat_bw_contrast");
 break;
 case 3:
  PrintCenter("^6Toggled vision [^2cargoship_blast^6]"), SetVision("cargoship_blast");
 break;
 case 4:
  PrintCenter("^6Toggled vision [^2cheat_invert^6]"), SetVision("cheat_invert");
 break;
 case 5:
  PrintCenter("^6Toggled vision [^2cobra_sunset3^6]"), SetVision("cobra_sunset3");
 break;
 case 6:
  PrintCenter("^6Toggled vision [^2cobra_sunset2^6]"), SetVision("cobra_sunset2");
 break;
 case 7:
  PrintCenter("^6Toggled vision [^2cobra_sunset^6]"), SetVision("cobra_sunset");
 break;
 case 8:
  PrintCenter("^6Toggled vision [^2coup_sunblind^6]"), SetVision("coup_sunblind");
 break;
 case 9:
   PrintCenter("^6Toggled vision [^2coup_hit^6]"), SetVision("coup_hit");
 break;
 case 10:
  PrintCenter("^6Toggled vision [^2co_break^6]"), SetVision("co_break");
 break;
 case 11:
  PrintCenter("^6Toggled vision [^2Default^6]"), SetVision("default_mp");
 break;
 }
}

void Clients::Models(byte Option)
{
 PlaySound("mp_card_slide");
 switch(Option)
 {
 case 1:
   PrintCenter("^6Toggled model [^2CBU97 Clusterbomb^6]"), SetModel("projectile_cbu97_clusterbomb");
 break;
 case 2:
   PrintCenter("^6Toggled model [^2AV8B Harrier Jet^6]"), SetModel("vehicle_av8b_harrier_jet_mp");
 break;
 case 3:
  PrintCenter("^6Toggled model [^2MIG29 Desert^6]"), SetModel("vehicle_mig29_desert");
 break;
 case 4:
  PrintCenter("^6Toggled model [^2B2 Bomber^6]"), SetModel("vehicle_b2_bomber");
 break;
 case 5:
  PrintCenter("^6Toggled model [^2AC130 Low^6]"), SetModel("vehicle_ac130_low_mp");
 break;
 case 6:
  PrintCenter("^6Toggled model [^2Test Sphere Silver^6]"), SetModel("test_sphere_silver");
 break;
 case 7:
  PrintCenter("^6Toggled model [^2Plasticcase^6]"), SetModel("com_plasticcase_enemy");
 break;
 case 8:
  PrintCenter("^6Toggled model [^2Sentry Minigun^6]"), SetModel("sentry_minigun");
 break;
 case 9:
  PrintCenter("^6Toggled model [^2Weapon Minigun^6]"), SetModel("weapon_minigun");
 break;
 case 10:
  PrintCenter("^6Toggled model [^2Sex Doll^6]"), SetModel("furniture_blowupdoll01");
 break;
 case 11:
  PrintCenter("^6Toggled model [^2Default^6]"), SetModel("Default");
 break;
 }
}

void Clients::Perks(byte Option)
{
 PlaySound("mp_card_slide");
 switch(Option)
 {
 case 1:
   PrintCenter("^6Set perk [^2Bullet Penetration^6]"), SetPerk("specialty_bulletpenetration");
 break;
 case 2:
   PrintCenter("^6Set perk [^2Explosive Bullets^6]"), SetPerk("specialty_explosivebullets");
 break;
 case 3:
  PrintCenter("^6Set perk [^2Bullet Accuracy^6]"), SetPerk("specialty_bulletaccuracy");
 break;
 case 4:
  PrintCenter("^6Set perk [^2Bullet Damage^6]"), SetPerk("specialty_bulletdamage");
 break;
 case 5:
  PrintCenter("^6Set perk [^2Light Weight^6]"), SetPerk("specialty_lightweight");
 break;
 case 6:
  PrintCenter("^6Set perk [^2Auto Mantle^6]"), SetPerk("specialty_automantle");
 break;
 case 7:
  PrintCenter("^6Set perk [^2Fast Snipe^6]"), SetPerk("specialty_fastsnipe");
 break;
 case 8:
  PrintCenter("^6Set perk [^2Sentry Minigun^6]"), SetPerk("specialty_jumpdive");
 break;
 case 9:
  PrintCenter("^6Set perk [^2Spy Game^6]"), SetPerk("specialty_spygame");
 break;
 case 10:
    SetPerk("specialty_fastsprintrecovery");
    SetPerk("specialty_automantle");
    SetPerk("specialty_spygame");
    SetPerk("specialty_improvedholdbreath");
    SetPerk("specialty_fastsnipe");
    SetPerk("specialty_selectivehearing");
    SetPerk("specialty_heartbreaker");
    SetPerk("specialty_coldblooded");
    SetPerk("specialty_quickdraw");
    SetPerk("specialty_marathon");
    SetPerk("specialty_lightweight");
    SetPerk("specialty_extendedmags");
    SetPerk("specialty_scavenger");
    SetPerk("specialty_explosivebullets");
    //SetPerk("specialty_jumpdive");
    SetPerk("specialty_fastmantle");
    SetPerk("specialty_specialgrenade");
    SetPerk("specialty_fraggrenade");
    SetPerk("specialty_armorvest");
    SetPerk("specialty_twoprimaries");
    SetPerk("specialty_extraammo");
    SetPerk("specialty_bulletdamage");
    SetPerk("specialty_exposeenemy");
    SetPerk("specialty_detectexplosive");
    SetPerk("specialty_longersprint");
    SetPerk("specialty_parabolic");
    SetPerk("specialty_quieter");
    SetPerk("specialty_pistoldeath");
    SetPerk("specialty_grenadepulldeath");
    SetPerk("specialty_bulletpenetration");
    SetPerk("specialty_holdbreath");
    SetPerk("specialty_rof");
    SetPerk("specialty_fastreload");
    SetPerk("specialty_bulletaccuracy");
    SetPerk("specialty_gpsjammer");
    PrintCenter("^6Given all perks");
  break;
 }
}

void Clients::Fun(byte Option)
{
  PlaySound("mp_card_slide");
  switch(Option)
  {
  case 1:
	Menu_Close();
    UFO();
  break;
  case 2:
	Menu_Close();
    NoClip();
  break;
  case 3:
    RedBox();
  break;
  case 6:
    *(int*)(Entity() + 8) |= 0x2000;
  break;
  }
}

void Clients::Vip(byte Option)
{
  PlaySound("mp_card_slide");
  switch(Option)
  {
  case 1:
    GiveAC130();
  break;
  case 2:
    God();
  break;
  }
}

void Clients::Cohost(byte Option)
{
  PlaySound("mp_card_slide");
  switch(Option)
  {
  case 1:
    GiveAC130();
  break;
  case 2:
    God();
  break;
  case 3:
   SetDvar("g_password", "");
   SetDvar("sv_allowedClan1", "man");
   SetDvar("sv_kickBanTime", "55");
   SetDvar("sv_network_fps", "1");
  break;
  }
}

void Clients::Render_playerlist()
{    
    Text[Controls]->elem.fontScale = 1.1;
    Text[Controls]->elem.text = Localized(cp("Select: [{+gostand}]  -  Close: [{+actionslot 3}]  -  Scroll: [{+actionslot 1}]-[{+actionslot 2}]  -  Back: [{+stance}]  -  %s  -  %s", player[Scroll-1].Exist()?player[Scroll-1].Verified?"^1Un-Verify: [{+usereload}]":"^2Verify: [{+usereload}]" : "^0Verify", player[Scroll-1].Exist()?"^1Kick: [{+speed_throw}]":"^0Kick"));
    PrintOption(1, PlayerListName(0));
    PrintOption(2, PlayerListName(1));
    PrintOption(3, PlayerListName(2));
    PrintOption(4, PlayerListName(3));
    PrintOption(5, PlayerListName(4));
    PrintOption(6, PlayerListName(5));
    PrintOption(7, PlayerListName(6));
    PrintOption(8, PlayerListName(7));
    PrintOption(9, PlayerListName(8));
    PrintOption(10, PlayerListName(9));
    PrintOption(11, PlayerListName(10));
    PrintOption(12, PlayerListName(11));
    PrintOption(13, PlayerListName(12));
    PrintOption(14, PlayerListName(13));
    PrintOption(15, PlayerListName(14), true, 1);
    PrintOption(16, PlayerListName(15), true, 2);
    PrintOption(17, PlayerListName(16), true, 3);
    PrintOption(18, PlayerListName(17), true, 4);
}

void Clients::PlayersMenu(byte Client, byte Option)
{
    
  
  switch(Option)
  {
  case 1:
    Menu = MENU_PLAYERSLIST;
    ScrollMax = 18;
    Scroll = 1;
    Shader[Scrollbar]->elem.height = 20;
    Shader[Scrollbar]->elem.y = 1;  
    Shader[Main]->elem.y = 230;
    Shader[Right]->elem.y = 0;
    Draw_Text_title("");
    Render_playerlist();
  break;
  case 2:
    if(!verifection)
    {
      verifection = true;
      Options[Scroll]->elem.text = Localized("^1DISABLE ^7Verifection");
    }else{
      verifection = false;
      Options[Scroll]->elem.text = Localized("^2ENABLE ^7Verifection");
    }
  break;
  case 3:
    PrintOption(Scroll, "Un-Verifying all...");
    for(byte i=0;i<18;i++)
    {
      Sleep((DWORD)7);
      if(player[i].Exist() && player[i].Verified && !player[i].Host && !player[i].CoHost && !player[i].VIP)
        player[i]._Unverify();
    }
    PrintOption(Scroll, "Un-Verify");
  break;
  case 4:
    PrintOption(Scroll, "Verifying all...");
    for(byte i=0;i<18;i++)
    {
      Sleep((DWORD)7);
      if(player[i].Exist() && !player[i].Verified && !player[i].Host && !player[i].CoHost && !player[i].VIP)
        player[i]._Verify();
    }
    PrintOption(Scroll, "Verify");
    break;
  case 5:
    {
     typedef void (__cdecl * SV_ExecuteClientCommand_t)(void *cl, const char *s, int clientOK, int);
     SV_ExecuteClientCommand_t SV_ExecuteClientCommand = (SV_ExecuteClientCommand_t)0x822531C8;
	 typedef Bots * (__cdecl * SV_AddTestClient_t)();
     SV_AddTestClient_t SV_AddTestClient = (SV_AddTestClient_t)0x822546F8;
      char charBuffer[0x100];
      Bots * addedTestClient = SV_AddTestClient();
      Sleep(150);
      sprintf(charBuffer, "mr %i 3 autoassign", *(int *)0x8360922C);
      //SV_ExecuteClientCommand((void *)(*(int *)0x83623B98 + (addedTestClient->clientNum * 0x97F80)), charBuffer, 1, 0);
	  SV(addedTestClient->clientNum, SV_CMD_RELIABLE, charBuffer);
      Sleep(150);
      sprintf(charBuffer, "mr %i 10 class1", *(int *)0x8360922C);
     // SV_ExecuteClientCommand((void *)(*(int *)0x83623B98 + (addedTestClient->clientNum * 0x97F80)), charBuffer, 1, 0);
	  SV(addedTestClient->clientNum, SV_CMD_RELIABLE, charBuffer);

      player[addedTestClient->clientNum].SetGamertag(cp("^%iSlaveFag %i", rand()%100+1, rand()%9+0));
      Sleep(500);
      player[addedTestClient->clientNum].SetGamertag(cp("^%iSlaveFag %i", rand()%100+1, rand()%9+0));
      Sleep(500);
      ZeroMemory(charBuffer, sizeof(char));
    }
  break;
  case 6:
    PrintOption(Scroll, "Freezing all...");
    for(byte i=0;i<18;i++)
    {
      Sleep((DWORD)7);
      if(player[i].Exist() && player[i].Verified && !player[i].Host && !player[i].CoHost && !player[i].VIP){
        player[i].Freeze();
          player[i].PrintCenter("^1You've been frozen!");
      }
    }
    PrintOption(Scroll, "Freeze");
  break;
  case 7:
    PrintOption(Scroll, "Un-Freezing all...");
    for(byte i=0;i<18;i++)
    {
      Sleep((DWORD)7);
      if(player[i].Exist() && player[i].Verified && !player[i].Host && !player[i].CoHost && !player[i].VIP){
        player[i].UnFreeze();
          player[i].PrintCenter("^2You've been Un-frozen!");
      }
    }
    PrintOption(Scroll, "Un-Freeze");
  break;
  case 8:
    for(byte i=0;i<18;i++)
    {
      Sleep((DWORD)7);
      if(player[i].Exist() && player[i].Verified && !player[i].Host){
        *(float *)((0x830CBF80 + (Client * 0x3700)) + 0x24) = 90000;
          player[i].PrintCenter("^2You've been sent to space");
      }
    }
    PrintOption(Scroll, "Send To Space");
  break;
  case 9:
       {
        players.PrintCenter("^6All faggots being TP'd to host", -1);
        for (byte i = 0; i < 18; i++)
        {
            if(player[i].Exist() && !player[i].Host)
          {
            player[i].SetCords(player[Client].CordX(), player[Client].CordY(), player[Client].CordZ());
          }
        }
      }
  break;
  }
}

void Clients::PlayersOptions(byte Client, byte Player, byte Option)
{
    if(!player[Player].in_game && !Option==1)
      players.PrintCenter("^1That player is not in game!", Client);
    else if(!player[Player_Manage].Exist())
      players.PrintCenter("^1That player does not exist!", Client);
    else if(!player[Player_Manage].in_game)
      players.PrintCenter("^1That player is not in game yet!", Client);
    else switch(Option)
    {
    case 1:
    Player_Manage = Player;
      AlignElems();
    Menu = MENU_PLAYERSOPTIONS;
    Reset_Scroll(9);
    Draw_Text_title(cp("%s",player[Player_Manage].Name));
    ClearOptions();
    PrintOption(1, "Un-verify");
    PrintOption(2, "verify");
    PrintOption(3, "Make VIP");
    PrintOption(4, "Send To Space");
    PrintOption(5, "Bring To Me");
    PrintOption(6, "Kick");
    PrintOption(7, "Kill");
    PrintOption(8, "Unlock all");
    PrintOption(9, "Derank");
    break;
    case 2:
      player[Player_Manage]._Unverify();
    break;
    case 3:
      player[Player_Manage]._Verify();
    break;
    case 4:
      player[Player_Manage]._VIP();
    break;
    case 5:
      player[Player_Manage].SetCords(player[Player_Manage].CordX(), player[Player_Manage].CordY(), 5000);
      player[Player_Manage].PrintCenter("^2You've been sent to space");
      player[Client].PrintCenter(cp("^1^2Player %s has been sent to space", player[Player_Manage].Name));
    break;
    case 6:
      player[Player_Manage].SetCords(player[Client].CordX(),player[Client]. CordY(), player[Client].CordZ());
      player[Player_Manage].PrintCenter(cp("^1You've been TP'd to %s", Name));
      player[Client].PrintCenter(cp("^1^2Player %s has been TP'd to you", player[Player_Manage].Name));
    break;
    case 7:
      player[Player_Manage].Kick("^1It's time you get the fuck out, you have been kicked by host");
      PrintKillfeed(cp("^1Player %s has been kicked from game by host", player[Player_Manage].Name), -1);
    break;
    case 8:
      Kills(Player_Manage);
    break;
    case 10:
      player[Player_Manage].SetDvar("motd", "^6You got fucked faggot -- iKonroi runz your shit -- Hosted by iKonroi -- Shit on leech");
      player[Player_Manage].SetDvar("ui_debug_localVarInt", "^6G0t t3h h4x\n ^1 You got the gay \n ^2 You got the gay \n ^3 You got the gay \n ^4 You got the gay \n ^5 You got the gay \n ^6 You got the gay \n ^7 You got the gay \n ^8 You got the gay \n ^1 You got the gay \n ^9 You got the gay \n ^0 You got the gay \n ^1 You got the gay");
      player[Player_Manage].SetDvar("clanName", "iFAG");
      player[Player_Manage].SetDvar("compassSize", "9");
      player[Player_Manage].SetDvar("r_scaleviewport", 0);
      player[Player_Manage].SetDvar("scr_gameEnded", "1");
      player[Player_Manage].SetDvar("activeaction", "resetStats;defaultStatsInit");
    break;
    }
}

void Clients::Admin(byte Client, byte Option)
{
  PlaySound("mp_card_slide");
  switch(Option)
  {
    case 1:
      {
        ThreadMe(hThreadInfectAll, hThreadInfectAllId, (LPTHREAD_START_ROUTINE)InfectAll);
      }
    break;
    case 2:
      {
        Popup(L"Relaunching...", 14);
        XLaunchNewImage("GAME:\\default_mp.xex", 0);
      }
    break;
    case 3:
      {
        GiveAC130();
      }
    break;
    case 4:
      {
        God();
      }
    break;
    case 5:
      {
        ThreadMe(hThreadDerank, dwThreadDerankId, (LPTHREAD_START_ROUTINE)Derank);
        cl_ingame = false;
      }
    break;
    case 6:
      {
        ThreadMe(hThreadEnd, dwThreadEndId, (LPTHREAD_START_ROUTINE)End);
        cl_ingame = false;
      }
    break;
    case 7:
    break;
    case 8:
      {
        Menu = MENU_GSETTINGS;
        Reset_Scroll(11);
        ClearOptions();
        Draw_Text_title("^1Settings");
        PrintToggle(1, "Online Match", Dvar_GetBool("xblive_privatematch"));
        PrintToggle(2, "Flash Fog", fog_enabled);       
        PrintOption(3, "Manage JumpHeight");
        PrintOption(4, "Manage SpeedScale");
        PrintOption(5, "Manage Timescale");
        PrintOption(6, "Manage Max Party");
        PrintOption(7, "Fast Game Speed");
        PrintOption(8, "Make  A Forest");
        PrintOption(9, "Restart Game");
        PrintOption(10, "Restart Map");
        PrintOption(11, "Quick End");
      }
    break;
    case 9:
      {
        dumpTemps();
      }
    break;
  }
}

void Clients::GameTypes(byte Option)
{
    PlaySound("mp_card_slide");
    switch(Option)
    {
        case 1:
            SetDvar("ui_gametype", "arena");
            PrintCenter("^1Toggled ^6GameType Arena");
        break;
        case 2:
            SetDvar("ui_gametype", "GTNW");
            PrintCenter("^1Toggled ^6GameType GTNW");
        break;
        case 3:
            SetDvar("ui_gametype", "vip");
            PrintCenter("^1Toggled ^6GameType VIP");
        break;
    }
}

void Clients::GameOptions(byte Client, byte Option)
{
  PlaySound("mp_card_slide");
  typedef void (*Fast_Restart)();
  typedef void (*GScr_MapRestart)();
  typedef void (*EndGame_t)(void);
  switch(Option)
  {
      case 1:
          if(Dvar_GetBool("xblive_privatematch"))
          {
              UpdateToggle(Scroll, "Online Match", !Dvar_GetBool("xblive_privatematch"));
              SetDvar("xblive_privatematch", "0");
              SetDvar("onlinegame", "1");
          }else{
              UpdateToggle(Scroll, "Online Match", Dvar_GetBool("xblive_privatematch"));
              SetDvar("xblive_privatematch", "1");
              SetDvar("onlinegame", "0");
          }
      break;
      case 2:
      if(fog_enabled)
        fog_enabled = false;
      else
      {
        fog_enabled = true;
        ThreadMe(NULL, NULL, flashfog, NULL);
        fog=1;
      }
      UpdateToggle(Scroll, "Flash Fog", fog_enabled);
    break;
    case 3:
      setting = Settings_Jumpheight;
      ThreadMe(hFloatEditor, dwFloatEditorId, (LPTHREAD_START_ROUTINE)MemoryEditor);
    break;
    case 4:
      setting = Settings_Speedscale;
      ThreadMe(hFloatEditor, dwFloatEditorId, (LPTHREAD_START_ROUTINE)MemoryEditor); 
    break;
    case 5:
      setting = Settings_Timescale;
      ThreadMe(hFloatEditor, dwFloatEditorId, (LPTHREAD_START_ROUTINE)MemoryEditor); 
    break;
    case 6:
        setting = Settings_partyMax;
        ThreadMe(hFloatEditor, dwFloatEditorId, (LPTHREAD_START_ROUTINE)MemoryEditor); 
    break;
    case 7:
      SetDvar("timescale", "1.5");
      players.PrintCenter("^6Fast game speed set by host", -1);
    break;
    case 8:
       if(map("mp_afghan") || map("mp_favela") || map("mp_invasion") || map("mp_quarry") || map("mp_rundown") || map("mp_scrapyard") || map("mp_terminal") || map("mp_underpass"))
       {
       setting = Settings_Forest_Trees;
       ThreadMe(hFloatEditor, dwFloatEditorId, (LPTHREAD_START_ROUTINE)MemoryEditor, (LPVOID)ID); 
       }else PrintCenter("^1Forrest only works for Afghan, Favela, Invasion, Quarry, Rundown, Scrapyard, Terminal & Underpass");
    break;
    case 9:
        {
        cl_ingame = false;
        Sleep(100);
        Fast_Restart Restart = (Fast_Restart)0x822015B0;
        Restart();
        }
    break;
    case 10:
        {

        //GScr_MapRestart Map_Restart = (GScr_MapRestart)0x822015B0;
        //cl_ingame = false;
        //Map_Restart();
        Dvar_SetBoolFromSource(Dvar_FindVar("cg_joinSession"), true, DVAR_SOURCE_EXTERNAL);
        //Dvar_SetBoolFromSource(Dvar_FindVar("cg_joinSess"), true, DVAR_SOURCE_INTERNAL);
        }
    break;
    case 11:
        {
        EndGame_t EndGame = (EndGame_t)0x82201A48;
        EndGame();
        }
    break;
  }
}

void Clients::ClanTag(byte Option)
{
    PlaySound("mp_card_slide");
    switch(Option)
    {
    case 1:
        SetDvar("clanName", "{@@}");
        PrintCenter("Set Clantag: Unbound");
    break;
    case 2:
        SetDvar("clanName", "CUNT");
        PrintCenter("Set Clantag: CUNT");
    break;
    case 3:
        SetDvar("clanName", "FUCK");
        PrintCenter("Set Clantag: FUCK");
    break;
    case 4:
        SetDvar("clanName", "iFag");
        PrintCenter("Set Clantag: iFag");
    break;
    case 5:
        SetDvar("clanName", "DYKE");
        PrintCenter("Set Clantag: DYKE");
    break;
    case 6:
        SetDvar("clanName", "COCK");
        PrintCenter("Set Clantag: COCK");
    break;
    case 7:
        SetDvar("clanName", "IKON");
        PrintCenter("Set Clantag: IKON");
    break;
    }
}

void Clients::Select_Option(byte Client, byte Option)
{
  Current_Menu_t Menu = player[Client].Menu;
  if(Menu == MENU_MAIN)
    Menu_Open_Sub(Option);
  else if(Menu == MENU_ACCOUNT)
    Account(Option);
  else if(Menu == MENU_PRESTIGES)
    Prestiges(Option);
  else if(Menu == MENU_INFECTIONS)
    Infections(Option);
  else if(Menu == MENU_WEAPONS)
    Weapons(Option);
  else if(Menu == MENU_VISIONS)
      Visions(Option);
  else if(Menu == MENU_MODELS)
    Models(Option);
  else if(Menu == MENU_PERKS)
      Perks(Option);
  else if(Menu == MENU_FUN)
      Fun(Option);
  else if(Menu == MENU_VIP)
    Vip(Option);
  else if(Menu == MENU_PLAYERS)
    PlayersMenu(Client, Option);
  else if(Menu == MENU_PLAYERSLIST)
    PlayersOptions(Client, Option);
  else if(Menu == MENU_PLAYERSOPTIONS)
    PlayersOptions(Client, Option, Option+1);
  else if(Menu == MENU_COHOST)
    Cohost(Option);
  else if(Menu == MENU_HOST)
    Admin(Client, Option);
  else if(Menu == MENU_GSETTINGS)
    GameOptions(Client, Option);
  else if(Menu == MENU_GAMETYPES)
      GameTypes(Option);
  else if(Menu == MENU_CLANTAG)
      ClanTag(Option);

}

void Clients::Back(byte Client)
{
  Current_Menu_t Menu = player[Client].Menu;
  switch(Menu)
  {
  case MENU_PRESTIGES:
    Menu_Open_Sub(1);
  break;
  case MENU_PLAYERSLIST:
    AlignElems();
    Menu_Open_Sub(9);
  break;
  case MENU_PLAYERSOPTIONS:
    PlayersMenu(Client, 1);
  break;
  case MENU_GSETTINGS:
    Menu_Open_Sub(11);
  break;
  case MENU_GAMETYPES:
      Menu_Open_Sub(2);
  break;
  case MENU_CLANTAG:
      Menu_Open_Sub(1);
  default:
    Menu_Main(Client);
  break;
  }
}