Advertisement
Zonas

Untitled

Jun 29th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #define DEBUG
  4.  
  5. #define PLUGIN_AUTHOR ""
  6. #define PLUGIN_VERSION "0.00"
  7.  
  8. #include <sourcemod>
  9. #include <sdktools>
  10. #include <morecolors>
  11.  
  12. #pragma newdecls required
  13.  
  14. bool Enabled;
  15.  
  16. public Plugin myinfo =
  17. {
  18. name = "xXSoulXx",
  19. author = PLUGIN_AUTHOR,
  20. description = "I don't know'",
  21. version = PLUGIN_VERSION,
  22. url = ""
  23. };
  24.  
  25. public void OnPluginStart()
  26. {
  27. RegAdminCmd("sm_test", Command_Test, ADMFLAG_GENERIC, "Spawns a bot");
  28. }
  29.  
  30. public Action Command_Test(int client, int args)
  31. {
  32. if (Enabled)
  33. {
  34. Enabled = false;
  35. ServerCommand("tf_bot_kick all");
  36. CPrintToChatAll("{fullred}[SVH] {darkgray}Test Bot Disabled");
  37. }
  38.  
  39. else
  40. {
  41. ServerCommand("mp_autoteambalance 0");
  42. ServerCommand("tf_bot_add 1 Pyro blue easy");
  43. ServerCommand("tf_bot_difficulty 0");
  44. ServerCommand("tf_bot_keep_class_after_death 1");
  45. ServerCommand("tf_bot_taunt_victim_chance 0");
  46. ServerCommand("tf_bot_join_after_player 0");
  47. Enabled = true;
  48. CPrintToChatAll("{fullred}[SVH] {darkgray}Test Bot Enabled");
  49. }
  50. return Plugin_Handled;
  51. }
  52.  
  53. public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
  54. {
  55. if (!Enabled || !IsPlayerAlive(client) || !IsClientBot(client)) return Plugin_Continue;
  56. int rocket = INVALID_ENT_REFERENCE;
  57. float fClientEyePosition[3];
  58. GetClientEyePosition(client, fClientEyePosition);
  59. int iWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  60. if (!IsValidEntity(iWeapon))return Plugin_Continue;
  61. while ((rocket = FindEntityByClassname(rocket, "tf_projectile_*")) != INVALID_ENT_REFERENCE)
  62. {
  63. float rocketLocation[3];
  64. GetEntPropVector(rocket, Prop_Data,"m_vecOrigin",rocketLocation);
  65. float pos[3];
  66. GetClientAbsOrigin(client, pos);
  67. float angle[3];
  68. angle[0] = 0.0 - RadToDeg(ArcTangent((rocketLocation[2] - fClientEyePosition[2]) / (FloatAbs(SquareRoot(Pow(fClientEyePosition[0] - rocketLocation[0], 2.0) + Pow(rocketLocation[1] - fClientEyePosition[1], 2.0))))));
  69. angle[1] = GetAngle(fClientEyePosition, rocketLocation);
  70. if (GetVectorDistance(pos, rocketLocation) < 250.0)
  71. {
  72. TeleportEntity(client, NULL_VECTOR, angle, NULL_VECTOR);
  73. ModRateOfFire(iWeapon);
  74. buttons |= IN_ATTACK2;
  75. }
  76. }
  77. for (new i = 1 ; i <= MaxClients ;i++)
  78. {
  79. if (IsClientInGame(i) && IsClientConnected(i) && !IsClientObserver(i) && GetClientTeam(i) != GetClientTeam(client) && IsPlayerAlive(i))
  80. {
  81.  
  82. }
  83. }
  84. return Plugin_Continue;
  85. }
  86.  
  87. stock bool IsClientBot(int client)
  88. {
  89. return client != 0 && IsClientInGame(client) && IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client);
  90. }
  91. stock void ModRateOfFire(int weapon)
  92. {
  93. float m_flNextPrimaryAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
  94. float m_flNextSecondaryAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack");
  95. SetEntPropFloat(weapon, Prop_Send, "m_flPlaybackRate", 10.0);
  96.  
  97. float fGameTime = GetGameTime();
  98. float fPrimaryTime = ((m_flNextPrimaryAttack - fGameTime) - 0.99);
  99. float fSecondaryTime = ((m_flNextSecondaryAttack - fGameTime) - 0.99);
  100.  
  101. SetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack", fPrimaryTime + fGameTime);
  102. SetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack", fSecondaryTime + fGameTime);
  103. }
  104.  
  105. stock float GetAngle(const float coords1[3], const float coords2[3])
  106. {
  107. float angle = RadToDeg(ArcTangent((coords2[1] - coords1[1]) / (coords2[0] - coords1[0])));
  108. if (coords2[0] < coords1[0])
  109. {
  110. if (angle > 0.0) angle -= 180.0;
  111. else angle += 180.0;
  112. }
  113. return angle;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement