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(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
new string[128], time;
if(sscanf(params, "d", time)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");
SetWorldTime(time);
format(string, sizeof(string), "Time set to %d:00.", time);
BroadCast(COLOR_GRAD1, string);
return 1;
}
or even shorter version and more simpler to use
PHP код:
COMMAND:settime(playerid, params[])
{
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(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
new string[128], time;
if(sscanf(params, "d", time)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");
SetWorldTime(time);
format(string, sizeof(string), "Time set to %d:00.", time);
BroadCast(COLOR_GRAD1, string);
return 1;
}
or even shorter version and more simpler to use
PHP код:
COMMAND:settime(playerid, params[])
{
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"