Author Topic: Event on flag score  (Read 2583 times)

0 Members and 4 Guests are viewing this topic.

Offline BurnedKirby

  • Major(1)
  • Posts: 39
Event on flag score
« on: August 25, 2007, 04:10:19 pm »
I'm trying to make a script that kills everyone when someone scores with the flag, but the script I'm trying to make wouldn't work. Any suggestions?

procedure OnFlagScore(ID, TeamFlag: byte)
var
c: byte;
begin
for c:=1 to 32 do if GetPlayerStat(c,'Active') = true then DoDamage(c,4000);
end;

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Event on flag score
« Reply #1 on: August 25, 2007, 04:17:44 pm »
That code is working just fine. Are you sure you've included the proper script?

Offline BurnedKirby

  • Major(1)
  • Posts: 39
Re: Event on flag score
« Reply #2 on: August 25, 2007, 04:32:18 pm »
Yes I have. But when I try running the dedicated server, it crashes on me on start without an error message. The server works fine when I take the folder out with that specific script, and I did implement the "Includes" file correctly.

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Event on flag score
« Reply #3 on: August 25, 2007, 04:36:56 pm »
Edit because I'm a total dumbass:
So no error message is given, at all? What's the complete list of scripts you're trying to load?
« Last Edit: August 25, 2007, 04:40:25 pm by Toumaz »

Offline BurnedKirby

  • Major(1)
  • Posts: 39
Re: Event on flag score
« Reply #4 on: August 25, 2007, 04:40:32 pm »
Like I said before, there is no error message. When I try running the dedicated server with the script, the command screen pops up as normal, but a split second after I open it, it closes by itself. This happens alot when I have an error in the script since it won't happen when I have fixed a script..

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Event on flag score
« Reply #5 on: August 25, 2007, 04:42:58 pm »
Yes I have. But when I try running the dedicated server, it crashes on me on start without an error message. The server works fine when I take the folder out with that specific script, and I did implement the "Includes" file correctly.

Close soldat and retry running dedicated server.
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline BurnedKirby

  • Major(1)
  • Posts: 39
Re: Event on flag score
« Reply #6 on: August 25, 2007, 04:43:16 pm »
Soldat is closed. I never even had soldat on.

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Event on flag score
« Reply #7 on: August 25, 2007, 04:43:38 pm »
Like I said before, there is no error message. When I try running the dedicated server with the script, the command screen pops up as normal, but a split second after I open it, it closes by itself. This happens alot when I have an error in the script since it won't happen when I have fixed a script..

That probably means there's a compilation error. Run the server from a command prompt (Start, Run, cmd, make your way to the Soldatserver directory and then type soldatserver) and paste the output here.

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Event on flag score
« Reply #8 on: August 25, 2007, 04:47:57 pm »
Like I said before, there is no error message. When I try running the dedicated server with the script, the command screen pops up as normal, but a split second after I open it, it closes by itself. This happens alot when I have an error in the script since it won't happen when I have fixed a script..

That probably means there's a compilation error. Run the server from a command prompt (Start, Run, cmd, make your way to the Soldatserver directory and then type soldatserver) and paste the output here.

Or for an easier way just make a new .bat file in the server directory and open it with notepad and put in: soldatserver.exe and then just run that

Also, you should be checking if they are alive not active - if I'm understanding the purpose of the script correctly...
« Last Edit: August 25, 2007, 04:49:30 pm by mikembm »

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: Event on flag score
« Reply #9 on: August 25, 2007, 04:52:10 pm »
Like I said before, there is no error message. When I try running the dedicated server with the script, the command screen pops up as normal, but a split second after I open it, it closes by itself. This happens alot when I have an error in the script since it won't happen when I have fixed a script..

That probably means there's a compilation error. Run the server from a command prompt (Start, Run, cmd, make your way to the Soldatserver directory and then type soldatserver) and paste the output here.

Or for an easier way just make a new .bat file in the server directory and open it with notepad and put in: soldatserver.exe and then just run that

Also, you should be checking if they are alive not active - if I'm understanding the purpose of the script correctly...

Under windows XP, batch files auto-close when they end, so the same thing would happen; you need a two-line batch file with the last line being "pause".

Offline BurnedKirby

  • Major(1)
  • Posts: 39
Re: Event on flag score
« Reply #10 on: August 25, 2007, 04:56:45 pm »
Bear with me here, since I'm not very good with the windows command prompt at all. So I have to make a text file saying soldatserver.exe, re-save it as a bat file, and run it with the command prompt? If thats what I have to do, then I don't know how to do it.

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Event on flag score
« Reply #11 on: August 25, 2007, 04:58:58 pm »
Unzip the contents of this zip file to your soldatserver directory and double click run.bat.

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: Event on flag score
« Reply #12 on: August 25, 2007, 05:01:16 pm »
I need to semi-correct what I said above; the server currently generates a ctrl-c when it shuts down (unless it REALLY crashes) which causes windows to ask if you want to abort the batch file; this was done to workaround a issue with the server hanging on shutdown. But still useful to have, in case it crashes nastily, so you can report it.

Offline BurnedKirby

  • Major(1)
  • Posts: 39
Re: Event on flag score
« Reply #13 on: August 25, 2007, 05:04:03 pm »
Finally figured out my problem.... XD
It turns out, i forgot to include a semi-colon after the "procedure OnFlagScore(ID, TeamFlag: byte)"
I placed the semi colon after it now, and it works.

Sorry for all the trouble.

Offline Tosty

  • Soldier
  • **
  • Posts: 172
  • Ultimate TW Medic
    • Just Click it
Re: Event on flag score
« Reply #14 on: August 25, 2007, 06:56:41 pm »
how would you make it so it only affects the other team



Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Event on flag score
« Reply #15 on: August 25, 2007, 11:49:30 pm »
how would you make it so it only affects the other team

Code: [Select]
for c:=1 to 32 do
     if (GetPlayerStat(c,'Active')=true) and (GetPlayerStat(c,'team')=WhatEverTeamnumberYouWant) then
          DoDamage(c,4000);

Offline Tosty

  • Soldier
  • **
  • Posts: 172
  • Ultimate TW Medic
    • Just Click it
Re: Event on flag score
« Reply #16 on: August 26, 2007, 12:09:44 am »
By the other team i meant if you were on blue and scored it would kill all red and if you were on red it would kill all blue

 not just a chosen team



Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Event on flag score
« Reply #17 on: August 26, 2007, 12:25:29 am »
By the other team i meant if you were on blue and scored it would kill all red and if you were on red it would kill all blue

 not just a chosen team

Code: [Select]
procedure OnFlagScore(ID, TeamFlag: byte);
var i: byte;
begin
for i:=1 to 32 do
if (GetPlayerStat(i,'alive')=true) and (GetPlayerStat(i,'team')=TeamFlag) then
DoDamage(i,4000);
end;

Offline Tosty

  • Soldier
  • **
  • Posts: 172
  • Ultimate TW Medic
    • Just Click it
Re: Event on flag score
« Reply #18 on: August 26, 2007, 12:28:14 am »
ok thx



Offline ghg

  • Camper
  • ***
  • Posts: 411
  • Village Idiot
Re: Event on flag score
« Reply #19 on: August 26, 2007, 03:47:23 am »
Wow thanks. I'd just been re-launching it and trying to catch the message with a Print Screen.
-=Gradius wuz you=-