Masz 2 do NG, któryś powinien działać.
Kod PHP:const Time = 30; var CurrentPos, OldPos: Array of Integer; Count: Integer; begin OldPos := [Self.X, Self.Y, Self.Z]; CurrentPos := [Self.X, Self.Y, Self.Z]; Count := 0; while not Terminated do begin UpdateWorld; CurrentPos := [Self.X, Self.Y, Self.Z]; Count := Count + 1; if (CurrentPos[0] <> OldPos[0]) or (CurrentPos[1] <> OldPos[1]) or (CurrentPos[2] <> OldPos[2]) then begin Count := 0; OldPos := CurrentPos; end; if Count >= Time then PlaySound('C:\WINDOWS\Media\Notify.wav'); Sleep(1000); end; end;
Kod PHP:Const CheckTime = 30 //How often to check if it is still in the same position. In seconds Alert = 'c:\windows\media\notify.wav' //What sound to play. Must be WAV file while not terminated do begin UpdateWorld; X := Self.X; Y := Self.Y; Z := Self.Z; Sleep(CheckTime*1000); UpdateWorld; if (X = Self.X) and (Y = Self.Y) and (Z = Self.Z) then begin PlaySound (Alert); end; end;