Advertisement
FlacoBey

Untitled

Jan 30th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.00 KB | None | 0 0
  1. #define ZOMBIECLASS_SMOKER  1
  2. #define ZOMBIECLASS_BOOMER  2
  3. #define ZOMBIECLASS_HUNTER  3
  4. #define ZOMBIECLASS_SPITTER 4
  5. #define ZOMBIECLASS_JOCKEY  5
  6. #define ZOMBIECLASS_CHARGER 6
  7. #define ZOMBIECLASS_WITCH   7
  8. #define ZOMBIECLASS_TANK    8
  9.  
  10. ConVar Time;
  11. float TimeInt;
  12.  
  13. public OnPluginStart()
  14. {
  15.     Time    = CreateConVar("sm_time_health_for_boss","4.0", "Vremya", FCVAR_NONE);
  16.    
  17.     HookEvent("tank_spawned", TankSpawned);
  18.     AutoExecConfig(true, "RandomHealthBosses");
  19. }
  20.  
  21. public Action:TankSpawned(Handle:event, const String:ename[], bool:dontBroadcast)
  22. {
  23.     int eblan = GetClientOfUserId(GetEventInt(event, "userid"));
  24.     if(IsValidClient(eblan))
  25.     {
  26.         SetEntityHealth(eblan, GetRandomInt(20000, 40000))
  27.     }
  28. }
  29.  
  30. public OnClientPutInServer(client)
  31. {
  32.     CreateTimer(TimeInt, timer, client, TIMER_FLAG_NO_MAPCHANGE);
  33. }
  34.  
  35. public Action:timer(Handle timer, any client)
  36. {
  37.     if (GetClientTeam(client) == 3 && IsValidClient(client))
  38.     {
  39.         new class = GetEntProp(client, Prop_Send, "m_zombieClass");
  40.         if(class == ZOMBIECLASS_SMOKER)
  41.         {
  42.             SetEntityHealth(client, GetRandomInt(50, 9000))
  43.         }
  44.         else if(class == ZOMBIECLASS_BOOMER)
  45.         {
  46.             SetEntityHealth(client, GetRandomInt(60, 90000))
  47.         }
  48.         else if(class == ZOMBIECLASS_HUNTER)
  49.         {
  50.             SetEntityHealth(client, GetRandomInt(80, 2525))
  51.         }
  52.         else if(class == ZOMBIECLASS_SPITTER)
  53.         {
  54.             SetEntityHealth(client, GetRandomInt(9212, 43153))
  55.         }
  56.         else if(class == ZOMBIECLASS_JOCKEY)
  57.         {
  58.             SetEntityHealth(client, GetRandomInt(4126, 5515))
  59.         }
  60.         else if(class == ZOMBIECLASS_CHARGER)
  61.         {
  62.             SetEntityHealth(client, GetRandomInt(1, 999999))
  63.         }
  64.     }
  65. }
  66.  
  67. public OnMapStart()
  68. {
  69.     SetCvars()
  70. }
  71.  
  72. public SetCvars()
  73. {
  74.     TimeInt = GetConVarFloat(Time);
  75. }
  76.  
  77. public IsValidClient(client)
  78. {
  79.     if (client <= 0)
  80.         return false;
  81.        
  82.     if (client > MaxClients)
  83.         return false;
  84.        
  85.     if (!IsClientInGame(client))
  86.         return false;
  87.        
  88.     if (!IsPlayerAlive(client))
  89.         return false;
  90.  
  91.     return true;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement