Set Time
#1

When I write /tod [time] will change it for three seconds, then change it back how do I fix this?

Код:
CMD:tod(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new string[128], time;
		if (!strlen(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");

		time = strval(params);

		if (time < 0 || time > 23) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");

		SetWorldTime(time);
		FixHour(time);
		shifthour = time;
		ghour = time;
		wtime = 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;
Reply
#2

There is probably a timer in your script, which sets the world time every x seconds.
Try searching for SetWorldTime in your script, and comment it if you find the timed one.
Reply
#3

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
There is probably a timer in your script, which sets the world time every x seconds.
Try searching for SetWorldTime in your script, and comment it if you find the timed one.
if(!realtime)
{
SetWorldTime(wtime);
gTime = wtime;
}
__________________________________________________ __

if (realtime)
{
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
SetWorldTime(tmphour);
gTime = tmphour;
}
__________________________________________________ __

format(string, sizeof(string), "The time is now %d:00.",tmphour);
BroadCast(COLOR_WHITE,string);
ghour = tmphour;
TotalUptime += 1;
PayDay();
if (realtime)
{
SetWorldTime(tmphour);
gTime = tmphour;
}
__________________________________________________ __

SetWorldTime(time);
FixHour(time);
shifthour = time;
ghour = time;
wtime = time;
gTime = time;
format(string, sizeof(string), "Time set to %d:00.", time);
BroadCast(COLOR_GRAD1, string);
Reply
#4

I think it has something to do with the 'realtime' thing..
Check if there is a timer set for that, if so, delete the timer or comment it.
Reply
#5

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
I think it has something to do with the 'realtime' thing..
Check if there is a timer set for that, if so, delete the timer or comment it.
Код:
new realtime = 1;
Reply
#6

Not sure if that will do it, but try setting realtime to 0.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)