Time Help
#1

hi I got this
PHP код:
        if (jailedtime[i] != 0)
        {
            new 
str[256];
            
format(strsizeof(str), "~n~~n~~n~~n~~w~-Unjailed in: %d secs"jailedtime[i]);
            
GameTextForPlayer(istr10003);
            
jailedtime[i] --;
            if (
jailedtime[i] == 0){
                
GetPlayerName(istring1MAX_PLAYER_NAME);
                
dini_Unset(AddDirFile(dir_userfilesstring1), "jailtime");
                
dini_Unset(AddDirFile(dir_userfilesstring1), "jailloc");
                
SetPlayerInterior(i0);
                
SetPlayerVirtualWorld2(i0);
                
SetPlayerPos(iwspawns[dspawn[i]][0], wspawns[dspawn[i]][1], wspawns[dspawn[i]][2] + 1.0);
                
SetPlayerFacingAngle(iwspawns[dspawn[i]][3]);
                
SetCameraBehindPlayer(i);
                
TogglePlayerControllable(i1);
                new 
string2[128];
                
format(string2128"%s has been unjailed after serving their time inside."string1);
                
SendClientMessageToAll2(COLOR_WHITEstring2);
            }
        } 
this show me time in seconds can I make it to be in mins and secs like 2:02
can anyone help?
Reply
#2

http://forum.sa-mp.com/showpost.php?...81&postcount=3
Reply
#3

Just add these lines
Quote:

int minutes = jailedtime[i] / 60;//Converts seconds to minutes

int seconds = jailedtime[i] % 60;//Grabs the remaining seconds from the minutes.

//Newly modified code line
new str[256];
if(jailedtime[i] < 60)
format(str, sizeof(str), "~n~~n~~n~~n~~w~-Unjailed in: %d secs",jailedtime[i]);
else
format(str, sizeof(str), "~n~~n~~n~~n~~w~-Unjailed in: %d mins %d secs",minutes,seconds);

Reply
#4

THANKS BOTH HELPED +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)