0 Members and 2 Guests are viewing this topic.
constslots=10;varbool: array[1..32] of boolean;i: integer;function OnCommand(ID: Byte; Text: string): boolean;begin if MaskCheck(lowercase(Text),'/swap')=true then begin for i:=1 to slots do bool[i]:=true; for i:=1 to slots do begin if ((getplayerstat(i,'active')=true) and (getplayerstat(i,'team')=1) and (bool[i]=true)) then begin command('/setteam2 '+inttostr(i)); bool[i]:=false; end; if ((getplayerstat(i,'active')=true) and (getplayerstat(i,'team')=2) and (bool[i]=true)) then begin command('/setteam1 '+inttostr(i)); bool[i]:=false; end; end; end;end;
function OnCommand(ID: Byte; Text: string): boolean;var i: Byte;begin // Swap teams if Text = '/swap' then for i := 1 to 32 do if GetPlayerStat(i, 'Active') then if GetPlayerStat(i, 'Team') = 1 then Command('/setteam2 ' + IntToStr(i)) else if GetPlayerStat(i, 'Team') = 2 then Command('/setteam1 ' + IntToStr(i)); end;
if GetPlayerStat(i, 'Active') then
const Teams = 3; //How many teams are playing plus one, (CTF, INF, HTF = 3, TDM = 5)function OnCommand(ID: Byte; Text: string): boolean;var i: Byte;begin // Swap teams if Text = '/swap' then for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) and (GetPlayerStat(i, 'Team') <> 5) then Command('/setteam' + IntToStr(Teams - GetPlayerStat(i, 'Team')) + ' ' + IntToStr(i));end;
Quote if GetPlayerStat(i, 'Active') thenReturn is a variant not a boolean. You need to add " = true".
Quote from: EnEsCe on October 27, 2008, 11:45:30 pmQuote if GetPlayerStat(i, 'Active') thenReturn is a variant not a boolean. You need to add " = true".Would be safer and better practice to cast to a boolean.Eg.lbActive := GetPlayerStat(i, 'Active')if lbActive then beginetc