FlacoBey

Untitled

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