0 Members and 1 Guest are viewing this topic.
function StringOccurs(needle, haystack: string): integer;begin Result := 0; while strpos(needle,haystack) <> 0 do begin Result := Result + 1; haystack := copy(haystack,strpos(needle,haystack)+1,length(haystack)); end;end;
function RandomPlayer: byte;var all: string; i: integer;begin for i := 1 to 32 do all := all + iif(GetPlayerStat(i,'active')=true,inttostr(i)+' ',''); Result := strtoint(iif(Length(all) > 0,GetPiece(all,' ',Random(0,StringOccurs(' ',all))),'0'))end;