Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: xmRipper on May 18, 2007, 09:15:18 am

Title: FirstBlood Script
Post by: xmRipper on May 18, 2007, 09:15:18 am
Script Name: FirstBlood Script
Script Description: Gives +5 extra points to the person who kills first in map.
Original Author(s): xmRipper
Core Version: 2.6.0

Code: [Select]
var
FirstBlood: string;

procedure OnMapChange(NewMap: string);
begin
FirstBlood := '0';
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if (FirstBlood = '0') then begin
if (Killer <> Victim) then begin
FirstBlood := '1';
WriteConsole(0,'FIRSTBLOOD! '+IDToName(Victim)+' killed by '+IDToName(Killer),RGB(0,255,255));
WriteConsole(0,IDToName(Killer)+' gained +5 extra point !!',RGB(0,255,255));
SetScore(Killer,GetPlayerStat(Killer,'KILLS')+5);
DrawText(0,'FIRST BLOOD !',330,RGB(255,0,0),1.10,20,370);
end;
end;
end;
Title: Re: FirstBlood Script
Post by: iftach on May 19, 2007, 02:17:36 am
Code: [Select]
SetScore(Killer,GetPlayerStat(1,'KILLS')+5);change the 1 to Killer.
Title: Re: FirstBlood Script
Post by: xmRipper on May 19, 2007, 02:37:09 am
Sorry :)
Fixed.
Title: Re: FirstBlood Script
Post by: DorkeyDear on May 21, 2007, 09:45:37 pm
Could really make people smile! Good job.
Title: Re: FirstBlood Script
Post by: ManSoft|Warlord on June 05, 2007, 09:21:38 am
Fixed 2.6.1 version:

http://web0.res0.45188.vs.webtropia.com/soldatnet/?cat=7

Code: [Select]
var
FirstBlood: boolean;

procedure ActivateServer();
begin
  firstblood := true;
end;

procedure OnMapChange(NewMap: string);
begin
FirstBlood := true;
end;

procedure OnPlayerKill(Killer, Victim, Weapon: string);
begin
if FirstBlood then begin
  if (Killer <> Victim) then begin
    FirstBlood := false;
    WriteConsole(0,'FIRSTBLOOD! '+IdToName(StrToInt(Victim))+' killed by '+IdToName(StrToInt(Killer)),RGB(0,255,255));
    WriteConsole(0,IdToName(StrToInt(Killer))+' gained +5 extra point !!',RGB(0,255,255));
    SetScore(StrToInt(Killer),GetPlayerStat(StrToInt(Killer),'Kills')+5);
    DrawText(0,'FIRST BLOOD !',330,RGB(255,0,0),0.8,20,370);
  end;
end;
Title: Re: FirstBlood Script
Post by: KeYDoN on June 06, 2007, 06:22:38 am
lame warlord :P
and WHY ffs is FirstBlood a string?
Title: Re: FirstBlood Script
Post by: ManSoft|Warlord on June 06, 2007, 06:28:32 am
now it's a bool :D
Title: Re: FirstBlood Script
Post by: hunterz on June 06, 2007, 09:08:50 pm
"type mismatch" line 110
:x
Title: Re: FirstBlood Script
Post by: DeMo on June 08, 2007, 11:34:49 am
Your code is wrong Warlord.
procedure OnPlayerKill(Killer, Victim, Weapon: string);

Where did you get this from???
Killer and Victim are the player IDs, not their nicknames.
The correct procedure is as follows:
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);

Correct code would be:
Code: [Select]
var
FirstBlood: boolean;

procedure ActivateServer();
begin
  firstblood := true;
end;

procedure OnMapChange(NewMap: string);
begin
FirstBlood := true;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if FirstBlood then begin
  if (Killer <> Victim) then begin
    FirstBlood := false;
    WriteConsole(0,'FIRSTBLOOD! '+IdToName(Victim)+' killed by '+IdToName(Killer),RGB(0,255,255));
    WriteConsole(0,IdToName(Killer)+' gained +5 extra point !!',RGB(0,255,255));
    SetScore(Killer,GetPlayerStat(Killer,'Kills')+5);
    DrawText(0,'FIRST BLOOD !',330,RGB(255,0,0),0.8,20,370);
  end;
end;
Title: Re: FirstBlood Script
Post by: ManSoft|Warlord on June 08, 2007, 03:47:57 pm
I got it from the soldatserver261.zip... Hm. Maybe it has been updated? I just copy & pasted it from my soldatserver-scripts. and there it worked fine...
Title: Re: FirstBlood Script
Post by: zyxstand on June 15, 2007, 11:18:25 am
You should make it so a TK doesn't count as first blood - otherwise you gain 5 points from the get-go
Title: Re: FirstBlood Script
Post by: soldat-game on July 27, 2018, 06:06:25 am
Apparently it did not work, rewrite to new script core for SoNNy:
Code: [Select]
unit FirstBlood;

interface

implementation
const
AddPoints = 5; //Extra points as fistkill
ColorConsoleText = $DD98FF10; //Console text color
ColorBigText = $FF3300; //Big text color
BigTextPosX = 284; //Positon X
BigTextPosY = 367; //Positon Y
BigTextScale = 0.155; //Text size
BitTextDisplayTime = 330; //Time in ms
BigTextLayer = 77; //If bigtext conflict with other texts on the screen change it

//-------------------------------------------------------------------

var
FirstBlood: boolean;

procedure ChangeAfter(Next: string);
begin
FirstBlood := true;
end;

procedure OnKill(Killer, Victim: TActivePlayer; BulletId: Byte);
begin
if FirstBlood then begin
if (Killer.ID <> Victim.ID) then begin
FirstBlood := false;
Killer.Kills := Killer.Kills+AddPoints;
Players.WriteConsole('FIRSTBLOOD! '+Victim.Name+' killed by '+Killer.Name,ColorConsoleText);
Players.WriteConsole(Killer.Name+' gained +'+inttostr(AddPoints)+' extra point !!',ColorConsoleText);
Players.BigText(BigTextLayer,'FIRST BLOOD !',BitTextDisplayTime,ColorBigText,BigTextScale,BigTextPosX,BigTextPosY);
end;
end;
end;

procedure ScriptDecl();
var i:byte;
begin
for i := 1 to 32 do Players[i].OnKill := @OnKill;
Map.OnAfterMapChange := @ChangeAfter;
firstblood := true;
end;

initialization
begin
ScriptDecl();
end;

finalization;
end.