SA-MP Forums Archive
Getting time left 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: Getting time left help (/showthread.php?tid=566096)



Getting time left help - Nabster - 03.03.2015

I created a mute command now i want to show time left to the player till he can be unmuted,how can i do this,i tried searching but didn't find good results and some of them are confusing for me..

if you could help me,i would be thankful to you


Re: Getting time left help - Abagail - 03.03.2015

You can use unix timestamps.

For example,
pawn Код:
PlayerInfo[playerid][pMutedTime] = gettime()+minutes*60; // Setting the time based on a minute variable
pawn Код:
if(PlayerInfo[playerid][pMuteTime] >= gettime())
{
       PlayerInfo[playerid][pMuted] = 0;
}
But if a user logs off they can manipulate the system so you'd need to store the minutes left somewhere if you use timestamps.


Re: Getting time left help - MikE1990 - 03.03.2015

I would suggest to use gettime as Abagail did and if you mute player for example 5 min and player leave after some mins,you can stop timer and save mins remaining and when player come back online to start timer with remaining mins.