[HELP]setmytime - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]setmytime (
/showthread.php?tid=206838)
[HELP]setmytime -
buzifej - 04.01.2011
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);
}
Re: [HELP]setmytime -
Kwarde - 04.01.2011
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
Re: [HELP]setmytime -
Sascha - 04.01.2011
offtopic, but what does the %02d do? (I know that the %d is for integers, however I don't know the 02..)
Re: [HELP]setmytime -
Kwarde - 04.01.2011
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 -.-)