Guest User

rape_traitor Source Code

a guest
May 2nd, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. CTraitorDetection g_TraitorDetection;
  2.  
  3. static const char WantedWeapons[][20] = { "knife", "silencedusp", "newton", "awp", "c4" };
  4.  
  5. void CTraitorDetection::Start(int indx)
  6. {
  7. if (!cvar.TTT)
  8. return;
  9.  
  10. cl_entity_s* ent = g_Engine.GetEntityByIndex(indx);
  11.  
  12. auto index = ent->index;
  13.  
  14. if (ent && ent->curstate.weaponmodel)
  15. {
  16. model_s* mdl = g_Studio.GetModelByIndex(ent->curstate.weaponmodel);
  17.  
  18. if (mdl && mdl->name)
  19. {
  20. char* szWeapon = strstr(mdl->name, "/p_");
  21.  
  22. if (szWeapon)
  23. {
  24. szWeapon = &szWeapon[3];
  25.  
  26. g_Utils.StringReplace(szWeapon, ".mdl", "");
  27.  
  28. for (int i = 0; i < _countof(WantedWeapons); i++)
  29. {
  30. if (lstrcmpA(szWeapon, WantedWeapons[i]) == 0)
  31. {
  32. auto name = g_PlayerInfoList[index].name;
  33.  
  34. // Check if name is not already in list
  35. if (std::find(Traitors.begin(), Traitors.end(), name) == Traitors.end())
  36. {
  37. g_Player[index].bTraitor = true;
  38. Traitors.push_back(name);
  39.  
  40. g_Engine.Con_Printf("%s added to traitor list \n", name);
  41. }
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48.  
  49. void CTraitorDetection::Draw()
  50. {
  51. if (!cvar.TTT)
  52. return;
  53.  
  54. if (Traitors.size() > 0 )
  55. {
  56. int newline = 136;
  57.  
  58. for (auto v : Traitors)
  59. {
  60. 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());
  61. newline += 15;
  62. }
  63. }
  64. }
  65.  
  66. .h
  67. Code:
  68. class CTraitorDetection
  69. {
  70. public:
  71. vector<string> Traitors;
  72.  
  73. void Start(int indx);
  74. void Draw();
  75. };
  76. extern CTraitorDetection g_TraitorDetection;
  77.  
  78. In usermsg -> int ResetHUD(const char *pszName, int iSize, void *pbuf)
  79.  
  80. Code:
  81. g_TraitorDetection.Traitors.clear();
  82.  
  83. PS: you call these 2 functions like
  84. Code:
  85. for (int i = 1; i <= g_Engine.GetMaxClients(); i++)
  86. {
  87. if (i == g_Local.iIndex)
  88. continue;
  89.  
  90. if (!g_Player[i].bAlive)
  91. continue;
  92.  
  93. g_TraitorDetection.Start(i);
  94. g_TraitorDetection.Draw();
  95. }
  96.  
  97. ============================================================================
  98. .h
  99. ============================================================================
  100.  
  101. class CTraitorDetection
  102. {
  103. public:
  104. vector<string> Traitors;
  105.  
  106. void Start(int indx);
  107. void Draw();
  108. };
  109. extern CTraitorDetection g_TraitorDetection;
  110.  
  111. ============================================================================
  112. In usermsg -> int ResetHUD(const char *pszName, int iSize, void *pbuf)
  113. ============================================================================
  114.  
  115. g_TraitorDetection.Traitors.clear();
  116.  
  117. ============================================================================
  118. call these 2 functions like
  119. ============================================================================
  120.  
  121. for (int i = 1; i <= g_Engine.GetMaxClients(); i++)
  122. {
  123. if (i == g_Local.iIndex)
  124. continue;
  125.  
  126. if (!g_Player[i].bAlive)
  127. continue;
  128.  
  129. g_TraitorDetection.Start(i);
  130. g_TraitorDetection.Draw();
  131. }
Advertisement
Add Comment
Please, Sign In to add comment