new worldtime; //we will use this to set and increase worldtime with the help of our timer
new timelapseTimer; //timer
public OnGameModeInit()
{
worldtime = 6; // giving the value of the variable -> the starting time to be set
SetWorldTime(worldtime); // will set the in-game time to the previously given value ^
timelapseTimer = SetTimer("Timelapse", 1000 * 900, 1); // a 15-minute (900 sec) timer, repeating true (1) to continue and provide later timelapse. A higher interval will slow down, a lower one will fasten timelapse.
return 1;
}
forward Timelapse();
public Timelapse()
{
worldtime++; // after 15 minutes, our variable's value is increased by 1
if(worldtime == 24) worldtime = 0; // we have to reset worldtime, because the SA:MP world time ranges from 0 to 23
SetWorldTime(worldtime); // success! with 15 minutes spent in real life, in game we already spent 1 hour.
SendClientMessageToAll(0xFFFFFFAA, "One hour has passed.");
return 1; // return 1, to continue
}
public OnGameModeExit()
{
KillTimer(timelapseTimer);
return 1;
}
#include <a_samp>
new worldtime;
new timelapseTimer;
forward Timelapse();
public Timelapse()
{
worldtime++;
if(worldtime == 24) worldtime = 0;
SetWorldTime(worldtime);
SendClientMessageToAll(0xFFFFFFAA, "One hour has passed.");
return 1;
}
public OnGameModeInit()
{
worldtime = 6;
SetWorldTime(worldtime);
timelapseTimer = SetTimer("Timelapse", 1000 * 900, 1);
return 1;
}
public OnGameModeExit()
{
KillTimer(timelapseTimer);
return 1;
}
public OnGameModeExit()
{
KillTimer(timelapseTimer)
return 1;
}
PHP Code:
|