I tried to write a script which checks var and team of a joining player and then forces him to spectator if he's not joining as spectator already, but something is wrong:
procedure OnJoinGame(ID, Team: byte);
begin
if cw := true then
if GetPlayerStat(ID, 'Team') = 5 then
WriteLn('Spec joined.');
else
begin
Command('/setteam5 '+IntToStr(ID));
WriteConsole(ID,'You were forwarded to a spectator!',RGB(255,0,0));
end;
end;
What's wrong?