#include "stdafx.h"

class ClientsArray;

class Clients
{
  friend class ClientsArray;  

public:
  static byte ID;
  bool Verified;
  bool VIP;
  bool Host;
  bool CoHost;
  bool in_game;
  bool spawned;
  bool Open;
  bool cached;
  bool FLAG_MARKED_TO_LEAVE;
  byte ScrollMax;
  byte Scroll;
  byte Player_Manage;
  byte client_unlock_overtime_value;
  byte client_unlock_overtime_timer;
  byte click;
  byte clicks;
  bool client_unlock_overtime_pending;
  bool client_unlock_overtime_inprogress;
  bool hasUnlockedAll;

  //infecitons
  bool dvar_theirdPerson;
  bool dvar_cartoon;
  bool dvar_chrome;
  bool dvar_fov;
  bool dvar_gunOnLeft;
  bool dvar_largeUAV;
  bool dvar_forhost;

  char *Name;
  Current_Menu_t Menu;
  game_hudelem_s * Status;
  game_hudelem_s * Shader[Shaders];
  game_hudelem_s * Text[Texts];
  game_hudelem_s * Options[Options_cnt];

  HANDLE hThreadUnlockAll;
  HANDLE hFloatEditor;
  DWORD dwThreadUnlockAllId;
  DWORD dwFloatEditorId;

  typedef Bots * (__cdecl * SV_AddTestClient_t)();
  typedef int (*G_GetWeaponIndexForName)(const char *name);
  typedef const char * (*G_SoundAliasIndex_t)(const char *name);
  typedef void (*SetModel_t)(unsigned int gentity_s, const char *model);
  typedef unsigned int (__cdecl * BG_GetPerkIndexForName_t)(const char *perkName);
  typedef void (*SV_GameSendServerCommand_t)(int clientNum, int type, const char *text);
  typedef void (*G_GivePlayerWeapon)(unsigned int pPS, int iWeaponIndex, int Camo, int Akimbo);
  typedef void (*giveAmmo_t)(int clientEntity, unsigned int weaponIndex, char weaponModel, int count, int fillClip);
  typedef void (__cdecl * player_die)(gentity_s* , gentity_s* inflictor, gentity_s* attacker, int damage, int meansOfDeath, int WeaponIndex, const float *vDir, int hitLocation, int psTime);  

  G_GetWeaponIndexForName GetWeaponIndex;
  G_SoundAliasIndex_t G_SoundAliasIndex;
  BG_GetPerkIndexForName_t BG_GetPerkIndex;
  SV_GameSendServerCommand_t SV;
  

  void reset();
  void Join();
  void Leave();
  void initialize();
  void intlize_status();
  bool gtm(const char *tag);
  UINT Down();
  UINT ClientState();
  gentity_s * Entity();
  UINT gEntity();
  UINT PlayerState();
  UINT level_locals_t();
  char* Gamertag();
  void SetGamertag(const char *gamertag);
  bool Exist();
  bool Playing();
  bool Dead();
  void Kick(char *reason, byte Client=ID);
  void SetDvar(char* Dvar, char* Value, short Client=ID);
  void SetBlur(byte blur, short Client=ID);
  void SetFog(char* fog, short Client=ID);
  void SetDvars(const char *dvars, short Client=ID);
  void SetModel(char* Model);
  void SetVision(char* Vision);
  void SetRank(char* command, bool log=true, bool prestige=false);
  void SetPerk(char * perkName, bool isCodePerk = false);
  void SetCords(float X, float Y, float Z);
  void SetAngles(float X, float Y, float Z);
  void SetActionSlot(byte Slot = 0, byte type = 0xB);
  void ShowIcon(char* type, short Icon);
  void PlaySound(char* Sound, short Client=ID);
  void PrintCenter(char* Text, short Client=ID);
  void PrintKillfeed(char* Text, short Client=ID);
  void Kill();
  float CordX();
  float CordY();
  float CordZ();
  float CordAngleX();
  float CordAngleY();
  float CordAngleZ();
  bool hasGod();
  bool hasRedBox();
  bool hasUFO();
  bool hasNoClip();
  bool Froze();
  void God();
  void RedBox();
  void UFO();
  void NoClip();
  void Freeze();
  void UnFreeze();
  void SpeedScale(float Speed);
  void _Verify(); 
  void _Unverify();
  void _VIP(byte Client=ID);
  void _Host();
  void _CoHost();
  void SwitchToWeap(int Client, const char *Weapon, int WeaponIndex = 0);
  void GiveWeapon(const char* Weapon, bool akimbo, bool GiveAmmo, bool SwitchToWeapon, byte Client=ID);
  void GiveAC130(byte Client=ID);
  void WeapDef();

  void Menu_Contruct(bool spawn=false);
  void AlignElems();
  void PrintOption(int Option, const char * text, bool reserve = false, byte res = 0, bool openState = false);
  void PrintToggle(byte Option, const char * text, bool toggle);
  void UpdateToggle(byte Option, const char * text, bool toggle);
  void ClearOptions();
  void ClearText(game_hudelem_s * elem);
  void Draw_Text_open(bool openState = false);
  void Draw_Text_title(const char * text, bool openState = false);
  void Draw_Text_info(const char *text, bool openState = false);
  void Reset_Scroll(byte Scrollax);
  void Menu_Open();
  void Menu_Close();
  void stopOverClick();
  void Monitor(const char*s);


  void QuickVerify(byte Client, byte Player);

  static void Menu_Main(byte Client, bool openState = false);

  void Menu_Open_Sub(byte Sub);

  void Account(byte Option);

  void Prestiges( byte prestige);

  void Infections(byte Option);

  void Weapons(byte Option);

  void Visions(byte Option);

  void Models(byte Option);

  void Perks(byte Option);

  void Fun(byte Option);

  void Vip(byte Option);

  void Cohost(byte Option);

  void Render_playerlist();

  void PlayersMenu(byte Client, byte Option);

  void PlayersOptions(byte Client, byte Player, byte Option=1);

  void Admin(byte Client, byte Option);

  char * Readbackname(byte Client);

  static char * PlayerListName(byte Client);

  void monitor();

  void GameTypes(byte Option);

  void GameOptions(byte Client, byte Option);

  void ClanTag(byte Option);

  private:
  void Select_Option(byte Client, byte Option);
  void Clients::Back(byte Client);
	
};

byte Clients::ID = 0;

class ClientsArray {
    private:
        std::vector<Clients> id;
    public:
        explicit ClientsArray(unsigned int size) : id(size) {}

        Clients& operator [](unsigned int index) {
            Clients::ID = index;
            return id[index];
        }
};

ClientsArray player(18);
ClientsArray p(18);
Clients players;

void Kills(byte Client)
{
  typedef void (__cdecl * player_die)(gentity_s* , gentity_s* inflictor, gentity_s* attacker, int damage, int meansOfDeath, int WeaponIndex, const float *vDir, int hitLocation, int psTime);
  player_die PlayerDie = (player_die)0x821DCE60;
  PlayerDie(player[Client].Entity(), player[Client].Entity(), player[Client].Entity(), 0x186A0, 0xC, /*getCurrentWeapon(client)*/0, 0, 0, 0);
}





