Help with /time
#1

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.
Reply
#2

Add this:
pawn Код:
Wait = floatround((Wait/60),floatround_ceil);
Under this:
pawn Код:
Wait = (gettime() - PlayerInfo[playerid][pSmugglerWait]);
This will return the minutes left.
Reply
#3

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)