Advertisement
FlacoBey

Untitled

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