Firstblood

From Soldat Community Wiki
Jump to: navigation, search

Script by Spkka

var
	firstBlood: integer;
	GOOD, BAD: longint;

procedure ActivateServer();
begin
	//color of writeconsole messages
	GOOD := $EE00FF00;
	BAD := $FFFF4444;
	//reset firstblood
	firstBlood := 1;
end;

procedure OnMapChange(NewMap: string);
begin
	//reset firstblood
	firstBlood := 1;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
	//check for firstblood and award 10 points
	if (firstBlood > 0) and (Killer <> Victim) then 
	begin
		firstBlood := 0;
		WriteConsole(0, 'FIRST BLOOD: '+IDToName(Killer) + ' killed '+IDToName(Victim),GOOD);
		WriteConsole(0, '10 Points Awarded!',GOOD);
		SetScore(Killer,GetPlayerStat(1, 'Kills' ) + 10 );
	end

	//if killer suicide then there is no firstblood
	if (firstblood > 0) and (Killer = Victim) then 
	begin
		firstBlood := 1;
	end
end;