SA-MP Forums Archive
[Math]AFK In Minutes - 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: [Math]AFK In Minutes (/showthread.php?tid=598354)



[Math]AFK In Minutes - SupperRobin6394 - 11.01.2016

Hey hey,

I got one simple problem, I can't convert the time from milliseconds to minutes...

PHP код:
public OnPlayerResume(playeridtime)
{
    new 
string[180], pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(stringsizeof(string), "%s is back from AFK, he was AFK for %d miliseconds."pnametime);
    
SendClientMessageToAll(COLOR_MESstring);

Anyone?


Re: [Math]AFK In Minutes - Sk1lleD - 11.01.2016

1 minute = 60 seconds
1 second = 1000 ms
then 1 minute = 60000 ms

So time/60000 gives you time in minutes


Re: [Math]AFK In Minutes - yvoms - 11.01.2016

Код:
public OnPlayerResume(playerid, time) 
{ 
    new string[180], pname[MAX_PLAYER_NAME]; 
    GetPlayerName(playerid, pname, sizeof(pname)); 
    format(string, sizeof(string), "%s is back from AFK, he was AFK for %d miliseconds.", pname, time /= 60000); 
    SendClientMessageToAll(COLOR_MES, string); 
}
I think this works, im not completely sure tho.