Advertisement
FlacoBey

Untitled

Jan 31st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 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.     PrintToChatAll("Реснулся Танк");
  25.     if(StrEqual(mName, "models/infected/hulk.mdl"))
  26.     {
  27.         if(GetRandomInt(0, 100) > GetConVarInt(ProCent))
  28.         {
  29.             PrintToChatAll("Тобi Пiзда")
  30.             timeing[iTank] = CreateTimer(GetConVarFloat(Time), timer, iTank, TIMER_REPEAT);
  31.         }
  32.         else
  33.         {
  34.             PrintToChatAll("Я обычный(")
  35.         }
  36.     }
  37. }
  38.  
  39. public Action skuka2(Event event, const char[] name, bool dontBroadcast)
  40. {
  41.     int deathTank = GetClientOfUserId(event.GetInt("userid"));
  42.     if(timeing[deathTank])    // Проверяем что таймер активен и уничтожаем
  43.     {
  44.         KillTimer(timeing[deathTank]);    // Уничтожаем таймер
  45.         timeing[deathTank] = null;        // Обнуляем значения дескриптора
  46.     }
  47. }
  48.  
  49. public Action:timer(Handle timer, any iTank)
  50. {
  51.     if (IsInGame(iTank))
  52.     {
  53.         int iHeal = GetClientHealth(iTank);
  54.         SetEntityHealth(iTank, iHeal + GetConVarInt(Health));
  55.         PrintToChatAll("Я полечился сучки!");
  56.     }
  57. }
  58.  
  59. stock bool:IsInGame( client )
  60. {
  61.     if ( client < 1 || client > MaxClients ) return false;
  62.     if ( !IsClientConnected( client )) return false;
  63.     if ( !IsClientInGame( client )) return false;
  64.     return true;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement