Problem with jail time.
#1

Hi all.I need some help with jail time.All is good,but i don't know how to do when player jail player for ex:3600 min.He don't get time like that:

Jail time:3600 min

But he get time like that:

JailTime:01:00:00
00:59:59
00:59:58
00:59:57

How to do that?
Reply
#2

Try this method:

pawn Код:
public OnFilterScriptInit()
{
    new sec = 120; // 120 here is the value of the input seconds
    //Change this into your required value...

    printf("Day(s):  %i ", (sec/(24*60*60))); //Converting second into Day: sec divided by 24*60*60
    printf("Hour(s): %i ", (sec/(60*60))%24); //similar way..
    printf("Minute(s):  %i ", (sec/60)%60); //here too..
    printf("Second(s):  %i ", sec%60); //and here...
   
    return true;
}
a test command::

pawn Код:
CMD:formatseconds(playerid, cmdtext[])
{
    new seconds;
    if (sscanf (cmdtext, "i", seconds) return SendClientMessage(playerid, -1, "Usage: /formatseconds [seconds]");
   
    new string[32];

    format(string, sizeof(string), "Days: %i ", (seconds/(24*60*60)) );
    SendClientMessage(playerid, -1, string);

    format(string, sizeof(string), "Hours: %i ", (sec/(60*60))%24 );
    SendClientMessage(playerid, -1, string);

    format(string, sizeof(string), "Minutes: %i ", (sec/60)%60 );
    SendClientMessage(playerid, -1, string);

    format(string, sizeof(string), "Seconds: %i ", sec%60 );
    SendClientMessage(playerid, -1, string);

    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)