SA-MP Forums Archive
Does not change the time - 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: Does not change the time (/showthread.php?tid=426335)



Does not change the time - raamiix - 28.03.2013

Every time I try to change the time so changed it for a few seconds then resets it. Have tried many different things but it refuses to work

Код:
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);
		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;
}



Re: Does not change the time - Pawnie - 28.03.2013

Try something like this

PHP код:
CMD:tod(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command!");
    new 
string[128], time;
    if(
sscanf(params"d"time)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /tod [time] (0-23)");
    
SetWorldTime(time);
    
format(stringsizeof(string), "Time set to %d:00."time);
    
BroadCast(COLOR_GRAD1string);
    return 
1;

or even shorter version and more simpler to use
PHP код:
COMMAND:settime(playeridparams[])
{
    new 
time;
    if(
sscanf(params"i"time)) return SendClientMessage(playerid, -1"Usage: /settime [time]");
    if(
time 24 || time 0) return SendClientMessage(playerid, -1"Error: Invalid time!");
    
SetWorldTime(time);
    return 
1;




Re: Does not change the time - raamiix - 28.03.2013

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
Try something like this

PHP код:
CMD:tod(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command!");
    new 
string[128], time;
    if(
sscanf(params"d"time)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /tod [time] (0-23)");
    
SetWorldTime(time);
    
format(stringsizeof(string), "Time set to %d:00."time);
    
BroadCast(COLOR_GRAD1string);
    return 
1;

or even shorter version and more simpler to use
PHP код:
COMMAND:settime(playeridparams[])
{
    new 
time;
    if(
sscanf(params"i"time)) return SendClientMessage(playerid, -1"Usage: /settime [time]");
    if(
time 24 || time 0) return SendClientMessage(playerid, -1"Error: Invalid time!");
    
SetWorldTime(time);
    return 
1;

No, not working


Re: Does not change the time - Pawnie - 28.03.2013

Do you get any like error messages or even on the cmd used for example
"Unknown command" or such?


Re: Does not change the time - raamiix - 28.03.2013

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
Do you get any like error messages or even on the cmd used for example
"Unknown command" or such?
No warnings. No errors. Command working but it's not chaining the time


Re: Does not change the time - Konstantinos - 28.03.2013

Can you show us the custom function "FixHour"?
By the way, make sure you're not using "TogglePlayerClock" and it changes the time.


Re: Does not change the time - raamiix - 29.03.2013

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Can you show us the custom function "FixHour"?
By the way, make sure you're not using "TogglePlayerClock" and it changes the time.
I got many "TogglePlayerClock" and "FixHour"