SA-MP Forums Archive
How to do so when I write... - 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: How to do so when I write... (/showthread.php?tid=253390)



How to do so when I write... - Join7 - 06.05.2011

How to do so when I write /tod 200, appears to me that "You can not set a time before 0 and after 23 hours"? Thanks in advance

Код:
	if(strcmp(cmd, "/tod", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tod [0-23]");
				return 1;
			}
			new hour;
			hour = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 4)
			{
	            SetWorldTime(hour);
				format(string, sizeof(string), "Weather is set to %d hours.", hour);
				SendClientMessageToAll(COLOR_GRAD1, string);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "You are not an admin!");
			}
		}
		return 1;
	}



Re: How to do so when I write... - Vince - 06.05.2011

After
pawn Код:
hour = strval(tmp);
Add:
pawn Код:
if(!(0 <= hour <= 23)) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid Use");
This forum requires that you wait 120 seconds between posts. Please try again in 15 seconds. -.-


Re: How to do so when I write... - Join7 - 06.05.2011

Thank you! ))))