Advertisement
Guest User

Untitled

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