Author Topic: GetPlayerStat(ID, 'Flagger') on JoinTeam  (Read 1083 times)

0 Members and 1 Guest are viewing this topic.

Offline Bloo

  • Soldier
  • **
  • Posts: 105
  • Yellow
    • BlueMutiny.com
GetPlayerStat(ID, 'Flagger') on JoinTeam
« on: September 15, 2009, 06:19:52 am »
Is there a way to get GetPlayerStat(ID, 'Flagger'); to work the second OnJoinTeam is called? There seems to be some lag between the change of teams and the script picking up that the player has a flag.

I'm trying to make an anti-flagbug script since Enesce won't fix it. I tried GetPlayerXY but it returns -2,0 (so does GetPlayerStat(ID, 'X');, so that's not exactly helpful either.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: GetPlayerStat(ID, 'Flagger') on JoinTeam
« Reply #1 on: September 15, 2009, 07:05:20 am »
Just check who's flagger every second. Or with more details:
1. Check who's flagger and save his ID.
2. After(you can use AppOnIdle to delay) some1 joined game check again.
3. If he's not flagger but is still alive do w/e you want to do when that bug occurs.

Didn't test but should work.
« Last Edit: September 15, 2009, 07:08:24 am by Gizd »

Offline Bloo

  • Soldier
  • **
  • Posts: 105
  • Yellow
    • BlueMutiny.com
Re: GetPlayerStat(ID, 'Flagger') on JoinTeam
« Reply #2 on: September 15, 2009, 07:07:59 am »
huh?

Offline Silnikos

  • Soldier
  • **
  • Posts: 129
Re: GetPlayerStat(ID, 'Flagger') on JoinTeam
« Reply #3 on: September 15, 2009, 08:45:09 am »
Code: [Select]
var
delay: Array [1..32] of shortint;
i: byte;

procedure OnJoinTeam(ID, Team: byte);
begin
delay[ID] := 2;
end;

procedure AppOnIdle(Ticks: integer);
begin
for i := 1 to 32 do begin
  if (delay[i] > 0) then
  delay[i] := delay[i] - 1;
  if (delay[i] = 1) then begin
if GetPlayerStat(i,'Flagger') then
Command('/kill ' +inttostr(i));
  end
  end
end;

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: GetPlayerStat(ID, 'Flagger') on JoinTeam
« Reply #4 on: September 15, 2009, 10:42:34 am »
Code: [Select]
var
delay: Array [1..32] of shortint;
i: byte;

procedure OnJoinTeam(ID, Team: byte);
begin
delay[ID] := 2;
end;

procedure AppOnIdle(Ticks: integer);
begin
for i := 1 to 32 do begin
  if (delay[i] > 0) then
  delay[i] := delay[i] - 1;
  if (delay[i] = 1) then begin
if GetPlayerStat(i,'Flagger') then
Command('/kill ' +inttostr(i));
  end
  end
end;

No, this isn't what he asked for.
Eh...
Code: [Select]
var
  Chex: boolean;
  Flagzor: array[1..2] of byte;

procedure OMGBUG();
begin
  // what to do when bug occurs
end;
 
procedure OnJoinTeam(ID, Team: byte);  // change to Game if you want...
begin
  Chex:= true;
end;

procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
  if Chex then begin
    for i:= 1 to 2 do if Flagzor[i] <> 0 then if GetPlayerStat(Flagzor[i], 'Flagger') = false then if GetPlayerStat(Flagzor[i], 'Alive') = true then begin
      OMGBUG();
      break;
    end;
    Chex:= false;
  end;

  for i:= 1 to 32 do if GetPlayerStat(i,'Flagger') = true then Flagzor[StrToInt(IntToStr(GetPlayerStat(i,'Team')))]:= i;
end;

Offline Bloo

  • Soldier
  • **
  • Posts: 105
  • Yellow
    • BlueMutiny.com
Re: GetPlayerStat(ID, 'Flagger') on JoinTeam
« Reply #5 on: October 04, 2009, 02:34:09 pm »
I like the theory, Gizd, but unfortunately it doesn't seem to work.