0 Members and 1 Guest are viewing this topic.
varvariable1: array of boolean;procedure OnActivateServer();var i: byte;begin SetArrayLength(variable1,{Some info loaded in a .ini file(it works)}+1);end;{An action is done (through a procedure) and changes one by one variable1[x] to true }Procedure iWantThemTrue();vari : byte;begin for i := 1 to ArrayHigh(variable1) do begin if variable1[i] = true then begin // HERE IS THE ERROR ** variable1[i] := false; end; end;end;
if variable1[i] = true then begin
if variable1 = true then begin
How could i do something that should check if ALL my variables are true, not only ONE (i tried without the .ini var, did the same thing, my .ini var is alright)
var b: boolean;b := false;for i := 1 to ArrayHigh(variable1) do begin if variable1[i] then begin // HERE IS THE ERROR ** variable1[i] := false; b := true; end; end;if not b then begin // if b is false then all vars are trueend;
var bools: array of boolean;function CheckBoolArray(): boolean;var i: byte;beginresult := true;for i := 0 to getarraylength(bools)-1 do if not bools[i] then begin result := false; break; end;end;
if (some_var = true) then some_var := false;
some_var := false;
except when comparing a variant value, such as those returned by GetPlayerStat for example.(...)although if a is a variant, the second will not work afaik.
if var1[i] then begin // if ALL the var1 booleans (var[1],var[2],var[3],etc.) are true then beginvar[i] := false; // make them false back again
b:= true;for i:= 1 to n do b:= (var[i] and b);if b then for i:= 1 to n do var[i]:= false;
It will work, but some people say it causes access violations and other errors (never happened to me though)
Nothin' given hasn't worked yet..
procedure OnJoinTeam(ID, Team: byte);begin if (Mode.Playing = false) and (Player[ID].speccing = true) then begin Command('/setteam5 ' + IntToStr(ID)); WriteConsole(ID,'There is no player running, you can type !play and run.',Color); end; if (Mode.Playing = true) and (Player[ID].speccing = true) then begin Command('/setteam5 ' + IntToStr(ID)); WriteConsole(ID,'There is a player running, you can type !play and run when he''s done.',Color); Player[ID].Speccing := true; end;end;