Author Topic: First person to get flag gets a vest.  (Read 769 times)

0 Members and 1 Guest are viewing this topic.

Offline miketh2005

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 668
  • What's the URL for www.microsoft.com?
First person to get flag gets a vest.
« on: July 02, 2009, 04:04:15 pm »
Can someone make this for me, please? Thanks.
Quote from: 'Ando.' pid='12999178' dateline='1309046898'
My new password is secure as shit :)
Mate, I am not sure Shit is even secured nowadays.

Offline ~Niko~

  • Rainbow Warrior
  • *****
  • Posts: 2410
Re: First person to get flag gets a vest.
« Reply #1 on: July 02, 2009, 04:43:56 pm »
ok, wait a while, i had something similar to this...

EDIT: Here you go.

Code: [Select]
const
color = $00FF00; //Color of the message displayed.

var
getvest: Boolean;

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

procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);
begin
if getvest = true then begin
GiveBonus(ID, 3);
WriteConsole(ID,'You won a vest by grabbing the flag',color);
getvest := false;
end;
end;

//This will give a vest to the first guy who frags the flag.
//Once another map is loaded, it can be done again.

It should work. At least it compiles.
« Last Edit: July 02, 2009, 04:54:15 pm by ~Niko~ »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: First person to get flag gets a vest.
« Reply #2 on: July 02, 2009, 05:22:48 pm »
I don't believe OnMapChange it called on first time server starts, you may also want
Code: [Select]
procedure ActivateServer();
begin
  if (CurrentMap = '') then // if it isn't caused by a /recompile comman
    OnMapChange(''); // you aren't using the NewMap variable so it doesn't matter
end;
not that this must come sometime after the OnMapChange function.

Offline ~Niko~

  • Rainbow Warrior
  • *****
  • Posts: 2410
Re: First person to get flag gets a vest.
« Reply #3 on: July 02, 2009, 05:26:59 pm »
damn, that's too pro for me.

Offline miketh2005

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 668
  • What's the URL for www.microsoft.com?
Re: First person to get flag gets a vest.
« Reply #4 on: July 02, 2009, 07:10:11 pm »
Thanks alot, guys. So it should be:
Code: [Select]
const
color = $00FF00; //Color of the message displayed.

var
getvest: Boolean;

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

procedure ActivateServer();
begin
  if (CurrentMap = '') then // if it isn't caused by a /recompile comman
    OnMapChange(''); // you aren't using the NewMap variable so it doesn't matter
end;

procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);
begin
   if getvest = true then begin
   GiveBonus(ID, 3);
   WriteConsole(ID,'You won a vest by grabbing the flag',color);
   getvest := false;
   end;
end;

//This will give a vest to the first guy who frags the flag.
//Once another map is loaded, it can be done again.

?
Quote from: 'Ando.' pid='12999178' dateline='1309046898'
My new password is secure as shit :)
Mate, I am not sure Shit is even secured nowadays.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: First person to get flag gets a vest.
« Reply #5 on: July 02, 2009, 10:00:38 pm »
looks right; test it and find out :P