FlacoBey

Untitled

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