28.03.2013, 19:59
Try something like this
or even shorter version and more simpler to use
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;
}
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;
}