Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <cstrike>
- bool OnHeal[64];
- bool OnRespawn[64];
- public Plugin myinfo =
- {
- name = "New Plugin",
- author = "Unknown",
- description = "<- Description ->",
- version = "1.0",
- url = "<- URL ->"
- }
- public void OnMapStart()
- {
- for(int i = 0; i <= 63; i++)
- {
- OnHeal[i] = false;
- OnRespawn[i] = false;
- }
- }
- public void OnGameFrame()
- {
- for(int i = 1; i <= MaxClients; i++)
- {
- if(IsValidClient(i))
- {
- if(IsPlayerAlive(i))
- {
- if(!OnHeal[i])
- {
- OnHeal[i] = true;
- CreateTimer(1.0, RegenHP, GetClientUserId(i));
- }
- }
- }
- }
- }
- public Action RegenHP(Handle timer, userid)
- {
- int client = GetClientOfUserId(userid);
- OnHeal[client] = false;
- if(IsValidClient(client) && IsPlayerAlive(client))
- {
- SetEntityHealth(client, GetClientHealth(client)+10);
- if(GetClientHealth(client) > GetEntProp(client, Prop_Data, "m_iMaxHealth")) SetEntityHealth(client, GetEntProp(client, Prop_Data, "m_iMaxHealth"));
- }
- }
- bool IsValidClient(int client)
- {
- return 0 < client <= MaxClients && IsClientInGame(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement