FlacoBey

Untitled

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