Advertisement
FlacoBey

Untitled

May 20th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.35 KB | None | 0 0
  1. #include sdktools
  2.  
  3. #define ZOMBIECLASS_SMOKER  1
  4. #define ZOMBIECLASS_BOOMER  2
  5. #define ZOMBIECLASS_HUNTER  3
  6. #define ZOMBIECLASS_SPITTER 4
  7. #define ZOMBIECLASS_JOCKEY  5
  8. #define ZOMBIECLASS_CHARGER 6
  9. #define ZOMBIECLASS_WITCH   7
  10. #define ZOMBIECLASS_TANK    8
  11.  
  12. public OnPluginStart()
  13. {
  14.     HookEvent("tank_spawn", TankSpawned);
  15.     HookEvent("witch_spawn", Witch);
  16. }
  17.  
  18. public OnEntityCreated(entity, const char[] classname)
  19. {
  20.     if(IsCommonInfected(entity))
  21.     {
  22.         SetEntProp(entity, Prop_Send, "m_iHealth", GetRandomInt(1, 500));
  23.     }
  24. }
  25.  
  26. public Action:Witch(Handle:event, const String:ename[], bool:dontBroadcast)
  27. {
  28.     int iWitch = GetEventInt(event, "witchid");
  29.     if(IsWitch(iWitch))
  30.     {
  31.         SetEntityHealth(iWitch, GetRandomInt(300, 400))
  32.     }
  33. }
  34.  
  35. public Action:TankSpawned(Handle:event, const String:ename[], bool:dontBroadcast)
  36. {
  37.     int iTank = GetClientOfUserId(GetEventInt(event, "userid"));
  38.     if(IsValidInfected(iTank))
  39.     {
  40.         CreateTimer(0.1, timer, iTank, TIMER_FLAG_NO_MAPCHANGE);
  41.     }
  42. }
  43.  
  44. public Action:timer(Handle timer, any client)
  45. {
  46.     if(IsValidInfected(client))
  47.     {
  48.         SetEntityHealth(client, GetRandomInt(29030, 32256));
  49.     }
  50. }
  51.  
  52. public OnClientPutInServer(client)
  53. {
  54.     CreateTimer(0.1, TimerD, client, TIMER_FLAG_NO_MAPCHANGE);
  55. }
  56.  
  57. public Action:TimerD(Handle timer, any client)
  58. {
  59.     if (IsInGame(client))
  60.     {
  61.         if(GetClientTeam(client) == 3)
  62.         {
  63.             new class = GetEntProp(client, Prop_Send, "m_zombieClass");
  64.             if(class == ZOMBIECLASS_SMOKER)
  65.             {
  66.                 SetEntityHealth(client, GetRandomInt(309, 441))
  67.             }
  68.             else if(class == ZOMBIECLASS_BOOMER)
  69.             {
  70.                 SetEntityHealth(client, GetRandomInt(28, 70))
  71.             }
  72.             else if(class == ZOMBIECLASS_HUNTER)
  73.             {
  74.                 SetEntityHealth(client, GetRandomInt(176, 252))
  75.             }
  76.             else if(class == ZOMBIECLASS_SPITTER)
  77.             {
  78.                 SetEntityHealth(client, GetRandomInt(220, 315))
  79.             }
  80.             else if(class == ZOMBIECLASS_JOCKEY)
  81.             {
  82.                 SetEntityHealth(client, GetRandomInt(141, 202))
  83.             }
  84.             else if(class == ZOMBIECLASS_CHARGER)
  85.             {
  86.                 SetEntityHealth(client, GetRandomInt(1613, 2016))
  87.             }
  88.         }
  89.     }
  90. }
  91.  
  92. stock bool:IsValidInfected( client )
  93. {
  94.     if ( client < 1 || client > MaxClients ) return false;
  95.     if ( !IsClientConnected( client )) return false;
  96.     if ( !IsClientInGame( client )) return false;
  97.     if ( GetClientTeam( client ) != 3 ) return false;
  98.     return true;
  99. }
  100.  
  101. stock bool IsWitch(int entity)
  102. {
  103.     if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
  104.     {
  105.         char entType[64];
  106.         GetEdictClassname(entity, entType, sizeof(entType));
  107.         return StrEqual(entType, "witch");
  108.     }
  109.     return false;
  110. }
  111.  
  112. stock bool IsCommonInfected(int entity)
  113. {
  114.     if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
  115.     {
  116.         char entType[64];
  117.         GetEdictClassname(entity, entType, sizeof(entType));
  118.         return StrEqual(entType, "infected");
  119.     }
  120.     return false;
  121. }
  122.  
  123. stock bool:IsInGame( client )
  124. {
  125.     if ( client < 1 || client > MaxClients ) return false;
  126.     if ( !IsClientConnected( client )) return false;
  127.     if ( !IsClientInGame( client )) return false;
  128.     return true;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement