CMD:tod(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
new string[128], time;
if(sscanf(params, "d", time)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");
SetWorldTime(time);
gTime = time;
format(string, sizeof(string), "Time set to %d:00.", time);
BroadCast(COLOR_GRAD1, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
SetWorldTime(time);
|
What do you mean rolling back like before?
If you are trying to set the world time then use Код:
SetWorldTime(time); |
SetWorldTime(time);
new realtime = 1;
/////this
if(!realtime)
{
wtime = (MPHour + 3) % 24;
SetWorldTime(wtime);
gTime = wtime;
}
/////////////this
if (realtime)
{
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
SetWorldTime(tmphour);
gTime = tmphour;
}
////////////////and this
public SyncTime()
{
new string[128];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
{
WeatherCalling++;
if(WeatherCalling > 3)
{
WeatherCalling = 0;
new rand;
rand = random(20);
switch(rand)
{
case 0:{ SetWeather(11); gWeather = 11; }
case 8:{ SetWeather(12); gWeather = 12; }
case 9:{ SetWeather(5); gWeather = 5; }
case 16:{ SetWeather(4); gWeather = 4; }
case 19:{ SetWeather(20); gWeather = 20; }
default:{ SetWeather(rand); gWeather = rand; }
}
}
format(string, sizeof(string), "Sekarang pukul %d:00.",tmphour);
BroadCast(COLOR_WHITE,string);
ghour = tmphour;
TotalUptime += 1;
PayDay();
if (realtime)
{
SetWorldTime(tmphour);
gTime = tmphour;
}
//////////////
|
if(!realtime) { wtime = (MPHour + 3) % 24; SetWorldTime(wtime); gTime = wtime; } |
By the way, i have this wristwatch commandCMD:wristwatch(playerid, params[])
{
if(PlayerInfo[playerid][pWristwatch] > 0)
{
new string[128];
if(GetPVarInt(playerid, "wristwatchonoff") == 0)
{
SetPVarInt(playerid, "wristwatchonoff", 1);
new hour,minuite,second;
gettime(hour,minuite,second);
FixHour(hour);
hour = shifthour;
if(minuite < 10)
{
format(string, sizeof(string), "%d:0%d", hour, minuite);
}
else
{
format(string, sizeof(string), "%d:%d", hour, minuite);
}
TextDrawShowForPlayer(playerid, WristWatch);
format(string, sizeof(string), "* %s turns on their wristwatch.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
KillTimer(GetPVarInt(playerid, "wristwatchtimer"));
TextDrawHideForPlayer(playerid, WristWatch);
DeletePVar(playerid, "wristwatchonoff");
format(string, sizeof(string), "* %s turns off their wristwatch.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have a wristwatch!");
}
return 1;
}
|
gettime(hour,minuite,second); |