Im trying to create a script that randomly selects a player from a game and performs some action. Any ideas how to do it ? Is there any random() function that can randomly select player name or ID?
Date Posted: February 24, 2007, 08:43:08 AM
function powerOf(a:integer;b:integer):integer;
var
t,i: integer;
begin
t:=1;
for i:=1 to b do begin
t:=t*a;
end;
result:= t;
end;
function rand(limit: integer):integer;
begin
result:= powerOf(strtoint(formatdate('zz')),3) mod limit;
end;
procedure AppOnIdle(Ticks: integer);
var
playernumber: integer;
ifdelta: integer;
begin
if Ticks mod (3600 * 10) = 0 then
begin
playernumber:=(rand(20) +1);
ifdelta:=(rand(2) +1);
if (ifdelta<2) then
begin
Command('/say delta pick: '+IDToName(playernumber)+'! Good luck');
Command('/setteam4 '+playernumber); // <====== THIS IS 31 LINE
end
else
Command('/say charlie pick: '+IDToName(playernumber)+'! Good luck');
Command('/setteam3 '+playernumber);
end;
end;
end;
[*] (randomize.pas) [Error] (31:49): Type mismatch
[*] Exception raised on SetVariables(Access violation at address 0808A241, accessing address 00000000)
[*] Run-time error (ActivateServer "function powerOf(a:integer;b:integer):integer;"): No Error
I tried like above, but it doesnt want to compile, why?