FlacoBey

Untitled

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