Advertisement
FlacoBey

Untitled

Jun 19th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.64 KB | None | 0 0
  1. #pragma semicolon 1
  2. #pragma newdecls required
  3.  
  4. #include <sdktools>
  5.  
  6. public void OnPluginStart()
  7. {
  8.     HookEvent("tank_spawn", TankSpawned);
  9.     HookEvent("witch_spawn", Witch);
  10. }
  11.  
  12. public void OnEntityCreated(int entity, const char[] classname)
  13. {
  14.     CreateTimer(0.1, vSetHealth, entity);
  15. }
  16.  
  17. public Action vSetHealth(Handle timer, int entity)
  18. {
  19.     if(IsValidEntity(entity) && IsValidEdict(entity))
  20.     {
  21.         char sWeaponEx[56];
  22.         GetEntityClassname(entity, sWeaponEx, sizeof(sWeaponEx));
  23.         if(strcmp(sWeaponEx, "prop_door_rotating") == 0)
  24.         {
  25.             SetEntProp(entity, view_as<PropType>(1), "m_iMaxHealth", 63);
  26.             SetEntProp(entity, view_as<PropType>(1), "m_iHealth", GetRandomInt(25, 63), 4);
  27.         }
  28.         else
  29.         {
  30.             SetEntProp(entity, view_as<PropType>(1), "m_iMaxHealth", 63);
  31.             SetEntProp(entity, view_as<PropType>(1), "m_iHealth", GetRandomInt(25, 63), 4);
  32.         }
  33.     }
  34. }
  35.  
  36. public Action Witch(Handle event, const char[] name, bool dontBroadcast)
  37. {
  38.     int iWitch = GetEventInt(event, "witchid");
  39.     if(IsWitch(iWitch))
  40.     {
  41.         int iR = GetRandomInt(95, 126);
  42.         SetEntProp(iWitch, view_as<PropType>(1), "m_iHealth", iR, 4);
  43.     }
  44. }
  45.  
  46. public Action TankSpawned(Handle event, const char[] name, 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(8165, 9072));
  60.     }
  61. }
  62.  
  63. public void OnClientPutInServer(int 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 (IsValidInfected(client))
  71.     {
  72.         if(GetClientTeam(client) == 3)
  73.         {
  74.             int class = GetEntProp(client, Prop_Send, "m_zombieClass");
  75.             switch(class)
  76.             {
  77.                 case 1:
  78.                 {
  79.                     SetEntityHealth(client, GetRandomInt(265, 378));
  80.                 }
  81.                 case 2:
  82.                 {
  83.                     SetEntityHealth(client, GetRandomInt(28, 70));
  84.                 }
  85.                 case 3:
  86.                 {
  87.                     SetEntityHealth(client, GetRandomInt(176, 252));
  88.                 }
  89.                 case 4:
  90.                 {
  91.                     SetEntityHealth(client, GetRandomInt(104, 189));
  92.                 }
  93.                 case 5:
  94.                 {
  95.                     SetEntityHealth(client, GetRandomInt(176, 252));
  96.                 }
  97.                 case 6:
  98.                 {
  99.                     SetEntityHealth(client, GetRandomInt(1210, 1512));
  100.                 }
  101.             }
  102.         }
  103.     }
  104. }
  105.  
  106. stock bool IsValidInfected(int client )
  107. {
  108.     if ( client < 1 || client > MaxClients ) return false;
  109.     if ( !IsClientConnected( client )) return false;
  110.     if ( !IsClientInGame( client )) return false;
  111.     if ( GetClientTeam( client ) != 3 ) return false;
  112.     return true;
  113. }
  114.  
  115. stock bool IsWitch(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, "witch");
  122.     }
  123.     return false;
  124. }
  125.  
  126. stock bool IsCommonInfected(int entity)
  127. {
  128.     if (entity > 0 && IsValidEntity(entity) && IsValidEdict(entity))
  129.     {
  130.         char entType[64];
  131.         GetEdictClassname(entity, entType, sizeof(entType));
  132.         return StrEqual(entType, "infected");
  133.     }
  134.     return false;
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement