Does not change the time
#1

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;
}
Reply
#2

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;

Reply
#3

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
Reply
#4

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

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
Reply
#6

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

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"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)