Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CTraitorDetection g_TraitorDetection;
- static const char WantedWeapons[][20] = { "knife", "silencedusp", "newton", "awp", "c4" };
- void CTraitorDetection::Start(int indx)
- {
- if (!cvar.TTT)
- return;
- cl_entity_s* ent = g_Engine.GetEntityByIndex(indx);
- auto index = ent->index;
- if (ent && ent->curstate.weaponmodel)
- {
- model_s* mdl = g_Studio.GetModelByIndex(ent->curstate.weaponmodel);
- if (mdl && mdl->name)
- {
- char* szWeapon = strstr(mdl->name, "/p_");
- if (szWeapon)
- {
- szWeapon = &szWeapon[3];
- g_Utils.StringReplace(szWeapon, ".mdl", "");
- for (int i = 0; i < _countof(WantedWeapons); i++)
- {
- if (lstrcmpA(szWeapon, WantedWeapons[i]) == 0)
- {
- auto name = g_PlayerInfoList[index].name;
- // Check if name is not already in list
- if (std::find(Traitors.begin(), Traitors.end(), name) == Traitors.end())
- {
- g_Player[index].bTraitor = true;
- Traitors.push_back(name);
- g_Engine.Con_Printf("%s added to traitor list \n", name);
- }
- }
- }
- }
- }
- }
- }
- void CTraitorDetection::Draw()
- {
- if (!cvar.TTT)
- return;
- if (Traitors.size() > 0 )
- {
- int newline = 136;
- for (auto v : Traitors)
- {
- g_Drawing.DrawString(ESP, g_Screen.iWidth / 100, (g_Screen.iHeight / 100) + newline, 225, 155, 0, cvar.esp_alpha, FONT_LEFT, "%s", v.c_str());
- newline += 15;
- }
- }
- }
- .h
- Code:
- class CTraitorDetection
- {
- public:
- vector<string> Traitors;
- void Start(int indx);
- void Draw();
- };
- extern CTraitorDetection g_TraitorDetection;
- In usermsg -> int ResetHUD(const char *pszName, int iSize, void *pbuf)
- Code:
- g_TraitorDetection.Traitors.clear();
- PS: you call these 2 functions like
- Code:
- for (int i = 1; i <= g_Engine.GetMaxClients(); i++)
- {
- if (i == g_Local.iIndex)
- continue;
- if (!g_Player[i].bAlive)
- continue;
- g_TraitorDetection.Start(i);
- g_TraitorDetection.Draw();
- }
- ============================================================================
- .h
- ============================================================================
- class CTraitorDetection
- {
- public:
- vector<string> Traitors;
- void Start(int indx);
- void Draw();
- };
- extern CTraitorDetection g_TraitorDetection;
- ============================================================================
- In usermsg -> int ResetHUD(const char *pszName, int iSize, void *pbuf)
- ============================================================================
- g_TraitorDetection.Traitors.clear();
- ============================================================================
- call these 2 functions like
- ============================================================================
- for (int i = 1; i <= g_Engine.GetMaxClients(); i++)
- {
- if (i == g_Local.iIndex)
- continue;
- if (!g_Player[i].bAlive)
- continue;
- g_TraitorDetection.Start(i);
- g_TraitorDetection.Draw();
- }
Advertisement
Add Comment
Please, Sign In to add comment