Help with /time - 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: Help with /time (
/showthread.php?tid=435282)
Help with /time -
dominik523 - 06.05.2013
Hey! My command /time won't work right. After completing work, you need to wait 2 minutes. I tried to create /time like this:
Код:
CMD:time(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if((gettime() - PlayerInfo[playerid][pSmugglerWait]) >0)
{
new Wait;
Wait = (gettime() - PlayerInfo[playerid][pSmugglerWait]);
format(string, sizeof(string), "You need to wait %d more minutes to smuggle drugs again.", Wait);
SendClientMessage(playerid, COLOR_WHITE, string);
}
When I type few times /time, time in my string just wents up. I want to create it to display how much minutes and seconds are left so you can do job again but I don't know how to create it from GetTime and one variable where wait time is stored, in this case is pSmuggleWait. Please help me.
Re: Help with /time -
zxc1 - 06.05.2013
Add this:
pawn Код:
Wait = floatround((Wait/60),floatround_ceil);
Under this:
pawn Код:
Wait = (gettime() - PlayerInfo[playerid][pSmugglerWait]);
This will return the minutes left.
Re: Help with /time -
dominik523 - 06.05.2013
nice, thank you so much!

EDIT: when I complete job, and type /time, it only shows that I need to wait 0 minutes, do you know why?