SA-MP Forums Archive
Time Help - 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)
+--- Thread: Time Help (/showthread.php?tid=435524)



Time Help - CurlyPwn - 07.05.2013

i made the timer

Код:
if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		new KillTime = GetTickCount();
    	if((KillTime - Kill[playerid]) > 300000)
    	{
	        SetPlayerHealth(playerid, 0);
	        Kill[playerid] = KillTime;
	        GameTextForPlayer(playerid, "~w~Grim Reaper~n~~r~Has Taken Your Soul!", 4500, 2);
    	}
		return 1;
	}
i just want when ever you write /kill again it shows: You can use /kill again in 0:05 Hours but the 0:05 i want it as a countdown so when ever he writes it, it will keep going down so if i write in in anther minute then it will show 0:04 hours...


Re: Time Help - Jstylezzz - 07.05.2013

Use format() for this.


Re: Time Help - CurlyPwn - 07.05.2013

i wrote it up doesnt come up as minutes shows in mili seconds

Quote:

if (strcmp("/kill", cmdtext, true, 10) == 0)
{
format(string,sizeof(string),"You can not use /kill in %d hours",KillTime);
SendClientMessage(playerid,0xFFFFFFAA,string);
new KillTime = GetTickCount();
new string[64];
if((KillTime - Kill[playerid]) > 300000)
{
SetPlayerHealth(playerid, 0);
Kill[playerid] = KillTime;
GameTextForPlayer(playerid, "~w~Grim Reaper~n~~r~Has Taken Your Soul!", 4500, 2);
}
return 1;
}




Re: Time Help - Jstylezzz - 07.05.2013

Then convert it from milliseconds to seconds Just put the formula there, like KillTime/1000.


Re: Time Help - Pottus - 07.05.2013

pawn Код:
new killtime = Kill[playerid] / 1000;
format(time, sizeof(time), "You can /kill in %i minutes and %i seconds", killtime / 60, killtime - ((killtime / 60) * 60));