SA-MP Forums Archive
Trouble with /tod - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Trouble with /tod (/showthread.php?tid=417588)



Trouble with /tod - MikeRep - 21.02.2013

Basically, whenever I try to set the server time, it quickly changes and doesn't save. It will change for a second and instantly go back. Iv'e tried multiple times to fix the issue but cant seem to come up with it. If anyone can help me please comment below, if you could help any other way , my skype is : tom.repalone
Код:
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;
}



Re: Trouble with /tod - Jay_ - 21.02.2013

There is nothing causing the issue you described in that code. You need to research your other scripts, including filterscripts and includes, and look for other circumstances where the time is set. Also make sure you don't have the per-player clocks enabled, which display above the HUD.


Re: Trouble with /tod - MikeRep - 21.02.2013

Quote:
Originally Posted by Jay_
Посмотреть сообщение
There is nothing causing the issue you described in that code. You need to research your other scripts, including filterscripts and includes, and look for other circumstances where the time is set. Also make sure you don't have the per-player clocks enabled, which display above the HUD.
I tried removing evey case of setworldtime and it didn't work, there is no FS. I must be missing something, can anyone help?


Re: Trouble with /tod - Krakuski - 21.02.2013

Try this, Untested.

pawn Код:
CMD:tod(playerid, params[])
{
    new string[128], input;
    if (PlayerInfo[playerid][pAdmin] >= 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "d", time)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");
    if(input > 23) return SendClientMessage(playerid, COLOR_GREY, "Hours are between 0 and 23.");
    gettime(thour, tmin, tsec);
    thour = input;
    SetWorldTime(input);
    format(string, sizeof(string), "AdmWarn: You have set the time to whatever you desired");
    SendClientMessage(0xFFFFFFFF, 1, string);
    return 1;
}