Advertisement
FlacoBey

Untitled

Jan 31st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. #include sdktools
  2.  
  3. ConVar ProCent, Health, Time;
  4. Handle timeing[MAXPLAYERS+1];
  5.  
  6.  
  7. public OnPluginStart()
  8. {
  9.     PrecacheModel("models/infected/hulk_dlc3.mdl", true);
  10.     HookEvent("tank_spawn", skuka);
  11.     HookEvent("tank_killed", skuka2);
  12.     ProCent = CreateConVar("sm_tank_health_chance", "50", "Чё надо сцуко?", FCVAR_NONE);
  13.     Health = CreateConVar("sm_tank_health", "1000", "Хехе бой?", FCVAR_NONE);
  14.     Time = CreateConVar("sm_tank_timer", "5.0", "Хехе б12321321ой?", FCVAR_NONE);
  15.     AutoExecConfig(true, "RandomHealthBosses");
  16. }
  17.  
  18. public Action skuka(Event event, const char[] name, bool dontBroadcast)
  19. {
  20.     int iTank = GetClientOfUserId(event.GetInt("userid"));
  21.    
  22.     char mName[56]
  23.     GetClientModel(iTank, mName, sizeof(mName))
  24.     if(StrEqual(mName, "models/infected/hulk.mdl"))
  25.     {
  26.         if(GetRandomInt(0, 100) > GetConVarInt(ProCent))
  27.         {
  28.             timeing[iTank] = CreateTimer(GetConVarFloat(Time), timer, iTank, TIMER_REPEAT);
  29.         }
  30.     }
  31. }
  32.  
  33. public Action skuka2(Event event, const char[] name, bool dontBroadcast)
  34. {
  35.     int deathTank = GetClientOfUserId(event.GetInt("userid"));
  36.     if(timeing[deathTank])    // Проверяем что таймер активен и уничтожаем
  37.     {
  38.         KillTimer(timeing[deathTank]);    // Уничтожаем таймер
  39.         timeing[deathTank] = null;        // Обнуляем значения дескриптора
  40.     }
  41. }
  42.  
  43. public Action:timer(Handle timer, any iTank)
  44. {
  45.     if (IsInGame(iTank))
  46.     {
  47.         int iHeal = GetClientHealth(iTank);
  48.         SetEntityHealth(iTank, iHeal + GetConVarInt(Health));
  49.     }
  50. }
  51.  
  52. stock bool:IsInGame( client )
  53. {
  54.     if ( client < 1 || client > MaxClients ) return false;
  55.     if ( !IsClientConnected( client )) return false;
  56.     if ( !IsClientInGame( client )) return false;
  57.     return true;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement