Official Soldat Forums
Server Talk => Scripting Releases => Topic started 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
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;
-
SetScore(Killer,GetPlayerStat(1,'KILLS')+5);
change the 1 to Killer.
-
Sorry :)
Fixed.
-
Could really make people smile! Good job.
-
Fixed 2.6.1 version:
http://web0.res0.45188.vs.webtropia.com/soldatnet/?cat=7
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;
-
lame warlord :P
and WHY ffs is FirstBlood a string?
-
now it's a bool :D
-
"type mismatch" line 110
:x
-
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:
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;
-
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...
-
You should make it so a TK doesn't count as first blood - otherwise you gain 5 points from the get-go
-
Apparently it did not work, rewrite to new script core for SoNNy:
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.