Author Topic: Survival round end  (Read 929 times)

0 Members and 1 Guest are viewing this topic.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Survival round end
« on: April 08, 2014, 11:31:19 am »
Hey I have a problem I would like to detect the round ended and perform the action, but it does not work I do not know why. There are no errors in the console. It seems to me that the timer does not work o0
Code: [Select]
AppOn..
...
...
if survival then begin
if (score < (AlphaScore+BravoScore+iif(GameStyle = 2,CharlieScore,0)+iif(GameStyle = 2,DeltaScore,0))) then survival_timer:=12;
score := (AlphaScore+BravoScore+iif(GameStyle = 2,CharlieScore,0)+iif(GameStyle = 2,DeltaScore,0));
if (survival_timer>0) then begin
survival_timer:=survival_timer-1;
if (survival_timer=0) then begin
for i:=1 to MAXPLAYER do begin
if (GetPlayerStat(i,'Team')=1) then begin
if (PrevAlphaS < AlphaScore) then begin
PrevAlphaS := AlphaScore +1;
SWinA[i] := SWinA[i] +1;
if (SWinA[i] = 1) then begin
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SWinA[i] = 0) then begin
SWinA[i] := 0;
end;
end;
end else
begin
SLoseA[i] := SLoseA[i] +1;
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SLoseA[i] = 0) then begin
SLoseA[i] := 0;
end;
end;
end;
if (GetPlayerStat(i,'Team')=2) then begin
if (PrevBravoS < BravoScore) then begin
PrevBravoS := BravoScore +1;
SWinB[i] := SWinB[i] +1;
if (SWinB[i] = 1) then begin
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SWinB[i] = 0) then begin
SWinB[i] := 0;
end;
end;
end else
begin
SLoseB[i] := SLoseB[i] +1;
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SLoseB[i] = 0) then begin
SLoseB[i] := 0;
end;
end;
end;
if (GetPlayerStat(i,'Team')=4) then begin
if (PrevDeltaS < DeltaScore) then begin
PrevDeltaS := DeltaScore +1;
SWinD[i] := SWinD[i] +1;
if (SWinD[i] = 1) then begin
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SWinD[i] = 0) then begin
SWinD[i] := 0;
end;
end;
end else
begin
SLoseD[i] := SLoseD[i] +1;
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SLoseD[i] = 0) then begin
SLoseD[i] := 0;
end;
end;
end;
if (GetPlayerStat(i,'Team')=3) then begin
if (PrevCharlieS < CharlieScore) then begin
PrevCharlieS := PrevCharlieS +1;
SWinC[i] := SWinC[i] +1;
if (SWinC[i] = 1) then begin
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SWinC[i] = 0) then begin
SWinC[i] := 0;
end;
end;
end else
begin
SLoseC[i] := SLoseC[i] +1;
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SLoseC[i] = 0) then begin
SLoseC[i] := 0;
end;
end;
end;
end;
end;
end;
end;
...
...
end;

...
...
procedure ActivateServ...
if ReadINI('soldat.ini','GAME','Survival_Mode','0') = '1' then survival:=true else survival:=false;
end;
In full script: line 3005.
« Last Edit: April 08, 2014, 11:35:55 am by dominikkk26 »

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Survival round end
« Reply #1 on: April 08, 2014, 01:35:57 pm »
Of course, timer doesn't work, survival_timer should be global variable.
Classic banana

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: Survival round end
« Reply #2 on: April 08, 2014, 02:13:08 pm »
Yhhh, please explain to me why global? By the way thanks for your help :)

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Survival round end
« Reply #3 on: April 08, 2014, 02:30:35 pm »
survival_timer is initialized each time when AppOnIddle procedure is called. I dont know how could I explain this in another way. I am surprised that you didnt know about this, its really "easy stuff". Or maybe u just dont know about what I am talking right now.

EDIT:
small cherry on cake (watch comment)

Code: [Select]
if (SWinA[i] = 1) then begin
UpdateNickname(GetPlayerStat(i,'name'),i);
if not (SWinA[i] = 0) then begin //why do u check this condition? its always true xD
SWinA[i] := 0;
end;
end;
« Last Edit: April 08, 2014, 02:53:50 pm by kicikici »
Classic banana