Advertisement
DeathChaos25

[L4D2] Tank AI test

Aug 14th, 2015
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. #pragma semicolon 1
  2. #define PLUGIN_VERSION "0.00"
  3.  
  4. #include <sourcemod>
  5. #include <sdktools>
  6. #include <l4d2_aidetours>
  7.  
  8. public Plugin:myinfo =
  9. {
  10.     name = "[L4D2] Tank AI Tester",
  11.     author = "DeathChaos25",
  12.     description = "Forcing tanks to prioritize incaps",
  13.     version = PLUGIN_VERSION,
  14.     url = "https://forums.alliedmods.net/showthread.php?t=261566"
  15. };
  16.  
  17. public Action:L4D2_OnTankAttackUpdate(tank, &victim)
  18. {
  19.     if (IsInfected(tank) && IsTank(tank) && IsPlayerAlive(tank))
  20.     {
  21.         for (new target = 1; target <= MaxClients; target++)
  22.         {
  23.             if (IsSurvivor(target) && IsPlayerAlive(target) && IsIncaped(target))
  24.             {
  25.                 PrintToChatAll("Tank (%i, %N) has changed targets to Survivor %N! (id:%i)", tank, tank, target, target);
  26.                 victim = GetEntData(target, L4D2_RefEntityHandle());
  27.                 return Plugin_Changed;
  28.             }
  29.         }
  30.     }
  31.     return Plugin_Continue;
  32. }
  33.  
  34. stock bool:IsTank(client)
  35. {
  36.     return GetEntProp(client, Prop_Send, "m_zombieClass") == 8;
  37. }
  38.  
  39. stock bool:IsSurvivor(client)
  40. {
  41.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2;
  42. }
  43.  
  44. stock bool:IsInfected(client)
  45. {
  46.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 3;
  47. }
  48.  
  49. stock bool:IsIncaped(client)
  50. {
  51.     return bool:GetEntProp(client, Prop_Send, "m_isIncapacitated", 1);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement