[HELP]setmytime
#1

What the error?

dcmd_settime(playerid,params[]) {
if(!strlen(params)) return SendClientMessage(playerid, 0x00FFFFAA, " /setttime [0-24]");

new time;

format(string,sizeof(string),"time has been changed %d:00-", time);
SendClientMessage(playerid,0x00FFFFAA,string);

new var = strval(params))
if(var > 24) return SendClientMessage(playerid, red, "error:Invalid hour");










return SetPlayerTime(playerid, time, 0);

}
Reply
#2

pawn Код:
dcmd_settime(playerid, params[])
{
    new str[128];
    if(!strlen(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /settime [0-24]");
    if(strval(params) < 0 || strval(params) > 24) return SendClientMessage(playerid,  0xFFFFFFAA, "USAGE: /settime [0-24]");
    format(str, 128, "* time changed to %02d:00", strval(params));
    SendClientMessage(playerid, 0xFFFFFFAA, str);
    SetPlayerTime(playerid, strval(params), 0);
    return 1;
}
Try that
Reply
#3

offtopic, but what does the %02d do? (I know that the %d is for integers, however I don't know the 02..)
Reply
#4

It sets the "length" of it or something. Example:
It's 01:00. If you just use '%d:%d' it will give: 1:0. That looks stupid. %02d:%02d just makes it 01:00.
Get it? (I'm not really good in explaining that -.-)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)