Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <cstrike>
- Handle hTimer;
- public Plugin myinfo =
- {
- name = "New Plugin",
- author = "Unknown",
- description = "<- Description ->",
- version = "1.0",
- url = "<- URL ->"
- }
- public void OnMapStart()
- {
- CloseHandle(hTimer);
- hTimer = CreateTimer(1.0, RegenHP, _, TIMER_REPEAT);
- }
- public void OnMapEnd()
- {
- CloseHandle(hTimer);
- }
- public Action RegenHP(Handle timer)
- {
- for(int i = 1; i <= MaxClients; i++)
- {
- if(IsValidClient(i) && IsPlayerAlive(i))
- {
- SetEntityHealth(i, GetClientHealth(i)+10);
- if(GetClientTeam(i) == 2)
- {
- if(IsVip(i) && GetClientHealth(i) > 250) SetEntityHealth(i, 250);
- else if(GetClientHealth(i) > 100) SetEntityHealth(i, 100);
- }
- if(GetClientTeam(i) == 3)
- {
- if(IsVip(i) && GetClientHealth(i) > 2000) SetEntityHealth(i, 2000);
- else if(GetClientHealth(i) > 999) SetEntityHealth(i, 999);
- }
- }
- }
- }
- bool IsVip(int client)
- {
- return CheckCommandAccess(client, "", ADMFLAG_ROOT) ||
- CheckCommandAccess(client, "", ADMFLAG_CUSTOM6) ||
- GetUserFlagBits(client) & ADMFLAG_ROOT == ADMFLAG_ROOT ||
- GetUserFlagBits(client) & ADMFLAG_CUSTOM6 == ADMFLAG_CUSTOM6;
- }
- bool IsValidClient(int client)
- {
- return 0 < client <= MaxClients && IsClientInGame(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement