Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4.  
  5. Handle hTimer;
  6.  
  7. public Plugin myinfo =
  8. {
  9. name = "New Plugin",
  10. author = "Unknown",
  11. description = "<- Description ->",
  12. version = "1.0",
  13. url = "<- URL ->"
  14. }
  15.  
  16. public void OnMapStart()
  17. {
  18. CloseHandle(hTimer);
  19. hTimer = CreateTimer(1.0, RegenHP, _, TIMER_REPEAT);
  20. }
  21.  
  22. public void OnMapEnd()
  23. {
  24. CloseHandle(hTimer);
  25. }
  26.  
  27. public Action RegenHP(Handle timer)
  28. {
  29. for(int i = 1; i <= MaxClients; i++)
  30. {
  31. if(IsValidClient(i) && IsPlayerAlive(i))
  32. {
  33. SetEntityHealth(i, GetClientHealth(i)+10);
  34. if(GetClientTeam(i) == 2)
  35. {
  36. if(IsVip(i) && GetClientHealth(i) > 250) SetEntityHealth(i, 250);
  37. else if(GetClientHealth(i) > 100) SetEntityHealth(i, 100);
  38. }
  39. if(GetClientTeam(i) == 3)
  40. {
  41. if(IsVip(i) && GetClientHealth(i) > 2000) SetEntityHealth(i, 2000);
  42. else if(GetClientHealth(i) > 999) SetEntityHealth(i, 999);
  43. }
  44. }
  45. }
  46. }
  47.  
  48.  
  49. bool IsVip(int client)
  50. {
  51. return CheckCommandAccess(client, "", ADMFLAG_ROOT) ||
  52. CheckCommandAccess(client, "", ADMFLAG_CUSTOM6) ||
  53. GetUserFlagBits(client) & ADMFLAG_ROOT == ADMFLAG_ROOT ||
  54. GetUserFlagBits(client) & ADMFLAG_CUSTOM6 == ADMFLAG_CUSTOM6;
  55. }
  56.  
  57.  
  58. bool IsValidClient(int client)
  59. {
  60. return 0 < client <= MaxClients && IsClientInGame(client);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement