Recheck On My Script
#1

Hey guys,

I'm new to zcmd, if you guys can just check over my code for changing the time of day, because I don't think it's functioning properly Thanks!

pawn Код:
command(tod, playerid, params[])
{
    new hour;
    if(PlayerStatistics[playerid][pAdminLevel] >= 5) return 1;
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /tod [timeofday] (0-23)");
    if(!IsPlayerConnectedEx(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to login first before you can use this command!");
    SetWorldTime(hour);
    format(string, sizeof(string), "The weather has been set by Administrator %s.", hour);
    SendClientMessageToAll(COLOR_DORANGE, string);
    return 1;
}
Reply
#2

I think you need to add a line or two
pawn Код:
hour = strval(params);
if(hour < 0 || hour > 23) return SendClientMessage(playerid,COLOR_GREY,"Invalid hour ( 0 - 23 )");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)