Author Topic: FirstBlood Script  (Read 9630 times)

0 Members and 1 Guest are viewing this topic.

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
FirstBlood Script
« 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;
« Last Edit: May 19, 2007, 02:36:26 am by xmRipper »
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline iftach

  • Major(1)
  • Posts: 16
Re: FirstBlood Script
« Reply #1 on: May 19, 2007, 02:17:36 am »
Code: [Select]
SetScore(Killer,GetPlayerStat(1,'KILLS')+5);change the 1 to Killer.

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: FirstBlood Script
« Reply #2 on: May 19, 2007, 02:37:09 am »
Sorry :)
Fixed.
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: FirstBlood Script
« Reply #3 on: May 21, 2007, 09:45:37 pm »
Could really make people smile! Good job.

Offline ManSoft|Warlord

  • Major
  • *
  • Posts: 70
  • Soldat.IDE Creator
Re: FirstBlood Script
« Reply #4 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;
« Last Edit: June 06, 2007, 06:29:27 am by ManSoft|Warlord »

Offline KeYDoN

  • Major
  • *
  • Posts: 60
Re: FirstBlood Script
« Reply #5 on: June 06, 2007, 06:22:38 am »
lame warlord :P
and WHY ffs is FirstBlood a string?
« Last Edit: June 06, 2007, 06:24:13 am by KeYDoN »

Offline ManSoft|Warlord

  • Major
  • *
  • Posts: 70
  • Soldat.IDE Creator
Re: FirstBlood Script
« Reply #6 on: June 06, 2007, 06:28:32 am »
now it's a bool :D

hunterz

  • Guest
Re: FirstBlood Script
« Reply #7 on: June 06, 2007, 09:08:50 pm »
"type mismatch" line 110
:x

Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Re: FirstBlood Script
« Reply #8 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;

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!

Offline ManSoft|Warlord

  • Major
  • *
  • Posts: 70
  • Soldat.IDE Creator
Re: FirstBlood Script
« Reply #9 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...

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: FirstBlood Script
« Reply #10 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
Can't think of anything original to put here...

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: FirstBlood Script
« Reply #11 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.