I didn't check if this compile, treat it as pseudo-code.
type
tPlayer = record
Health, MaxhHalth: single;
ScriptHandleHealth: boolean;
end;
var
Player: array [1..32] of tPlayer;
MaxHealth: byte;
procedure SetSpecialHealth(ID: byte; maxhealth: single); //maxhealth = 100 is "Normal Health"
begin
Player[ID].ScriptHandleHealth := true;
Player[ID].maxhealth := maxhealth;
end;
procedure SampleChangeHealth(ID: byte; health: single);
begin
Player[ID].health := health;
DoDamage(ID, 1); //apply changes
end;
procedure SampleIncreaseHealth(ID: byte; health: single); //health can be negative
begin
Player[ID].health := Player[ID].health + health;
DoDamage(ID, 1); //apply changes
end;
procedure ActivateServer();
begin
if Command('/realistic') then MaxHealth := 65
else MaxHealth := 150;
end;
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
Result := Damage;
if Player[Victim].ScriptHandleHealth then begin
Player[Victim].Health := Player[Victim].Health - Damage*100/MaxHealth;
Result := round(GetPlayerStat(Victim, 'health') - Player[Victim].Health*MaxHealth/Player[Victim].MaxHealth);
end;
end;
procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);
begin
Player[Victim].ScripHandleHealth := false;
Player[Victim].MaxHealth := 100;
end;
about this "Apply changes": if you won't do this, nothing special happen, script will still work properly. They just cause that your changes that your changes are sent to soldat so players can see them