Hi again guys, lol.
I work badly in a script, and an error has just popped in my face and it seems like i can't fix it.
I'm not so good explaining so i'm just gonna show you the pieces of script.
Huuh... an exemple :
var
Random : byte;
SomeoneGotId : boolean;
procedure OnPlayerSpeak(ID: Byte; Text: string)
begin
if Text = '!getid' then begin
Random := ID;
SomeoneGotId := true;
end;
if Text = '!giveid' then begin
Random := 0;
SomeoneGotId := false;
end;
end;
procedure OnLeaveGame(ID, Team: byte;Kicked: boolean);
begin
if (SomeoneGotId = true) and (Random = ID) then begin
Random := 0;
SomeoneGotId := false;
end;
end;
function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
// Test to see who got the Random id
if Text = '/whogotid' then begin
WriteConsole(ID, 'Random = ' + IDToName(Random),$FFFF0000);
end;
end;
Here is the problem. In the other procedures than OnPlayerSpeak, the Random variable is 255 and it displays : Random = Server Admin.
What is the problem ?
Thanks for solving it.
EDIT: FIXED AN ERROR IN THE EXEMPLE