Search In
• More options...
Find results that contain...
Find results in...

3. #### Site Suggestions # GTA V Time Lapse advancing to time

## Recommended Posts This is my code, which works perfectly. It time-lapses the in-game time to the given hours and minutes, with the given speed multiplier.

eg. TimeLapseAdvanceToTime(4, 45, 500) means, it will time-lapse the time to 4:45 AM, with 500x faster, than the the normal speed of game clock.

It is fool-proof!

```procedure TimeLapseAdvanceToTime(hrs, mins, speed: cint);
var
wait_time: ULONG;
i, j: cint;
begin
{Limit timelapse speed - maximum is 100x multiplier}
if (speed < 1) then
speed := 1
else if (speed > 1000) then
speed := 1000;
{Fix input data - prevent errors}
if (mins > 59) then
while (mins > 59) do
begin
dec(mins, 60);
inc(hrs);
end
else if (mins < 0) then
while (mins < 0) do
begin
inc(mins, 60);
dec(hrs);
end;
if (hrs > 23) then
while (hrs > 23) do
dec(hrs, 24)
else if (hrs < 0) then
while (hrs < 0) do
inc(hrs, 24);
{Everything is OK - Now do the timelapse}
wait_time := 2000 div speed; // In GTA V, one in-game minute is TWO seconds!
i := GET_CLOCK_HOURS;
j := GET_CLOCK_MINUTES;
while (i <> hrs) or (j <> mins) do
begin
if (j > 59) then
begin
j := 0;
inc(i);
end
else
inc(j);
if (i > 23) then
begin
i := 0;
j := 0;
end;
SET_CLOCK_TIME(i, j, 0);
ScriptHookVWait(wait_time);
end;
end;```

It is in Pascal. You can easily convert it into C, (cint -> int, procedure -> void. ScriptHookVWait just calls the ScriptHookV scriptWait function. inc is increase, dec is decrease)

Any opinions? You can use it anywhere you want!

(The ADVANCE_CLOCK_TIME_TO does not do the time-lapse!)

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×