Nesesito ayuda con estй comando
#1

Necesito saber como le pongo minutos a la carcel, ya que cuando meto 5 minutos a alguien a la carcйl, no sale como yo quiero que serнa asн:

Tiempo de carcel: 5 minutos 0 segundos
y que vaya bajando
Tiempo de carcel: 4 minutos 34 segundos


Y asi me sale como lo tengo ahora:
Tiempo de carcel: 470 segundos

їMe pueden echar una mano?

pawn Код:
zcmd(tiempo, playerid, params[]){
        new mtext[20], year, month,day, string[128];
        getdate(year, month, day);
        switch(month){
            case 1:     mtext = "Enero";
            case 2:     mtext = "Febrero";
            case 3:     mtext = "Marzo";
            case 4:     mtext = "Abril";
            case 5:     mtext = "Mayo";
            case 6:     mtext = "Junio";
            case 7:     mtext = "Julio";
            case 8:     mtext = "Agosto";
            case 9:     mtext = "Septiembre";
            case 10:    mtext = "Octubre";
            case 11:    mtext = "Noviembre";
            case 12:    mtext = "Diciembre";
        }
        new hour,minuite,second;
        gettime(hour,minuite,second);
        FixHour(hour);
        hour = shifthour;
        if (minuite < 10)
        {
            if (Info[playerid][pJailTime] > 0)
            {
                format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Tiempo de Carcel: %d sec", day, mtext, hour, minuite, Info[playerid][pJailTime]-10);
            }
            else
            {
                format(string, sizeof(string), "~y~%d %s~n~~b~|~w~%d:0%d~b~|", day, mtext, hour, minuite);
            }
        }
        else
        {
            if (Info[playerid][pJailTime] > 0)
            {
                format(string, sizeof(string), "~y~%d %s~n~~b~|~w~%d:%d~b~|~n~~w~Tiempo de Carcel: %d sec", day, mtext, hour, minuite, Info[playerid][pJailTime]-10);
            }
            else
            {
                format(string, sizeof(string), "~y~%d %s~n~~b~|~w~%d:%d~b~|", day, mtext, hour, minuite);
            }
        }
        GameTextForPlayer(playerid, string, 5000, 1);
        return 1;
    }
Reply
#2

Asi deberнa funcionar si no me comi algun { }
pawn Код:
zcmd(tiempo, playerid, params[]){
        new mtext[20], year, month,day, string[128];
        getdate(year, month, day);
        switch(month){
            case 1:     mtext = "Enero";
            case 2:     mtext = "Febrero";
            case 3:     mtext = "Marzo";
            case 4:     mtext = "Abril";
            case 5:     mtext = "Mayo";
            case 6:     mtext = "Junio";
            case 7:     mtext = "Julio";
            case 8:     mtext = "Agosto";
            case 9:     mtext = "Septiembre";
            case 10:    mtext = "Octubre";
            case 11:    mtext = "Noviembre";
            case 12:    mtext = "Diciembre";
        }
        new hour,minuite,second;
        gettime(hour,minuite,second);
        FixHour(hour);
        hour = shifthour;
        if (minuite < 10)
        {
            if (Info[playerid][pJailTime] > 0)
            {

if( Info[playerid][pJailTime] > 60 )
{
new minuto = Info[playerid][pJailTime] / 60;
new segundo = Info[playerid][pJailTime] - (minuto*60);
 format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Tiempo de Carcel: %d min %d sec", day, mtext, hour, minuite, minuto, segundo);
}
else
{
                format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Tiempo de Carcel: %d sec", day, mtext, hour, minuite, Info[playerid][pJailTime]-10);
}
           

 }
            else
            {
                format(string, sizeof(string), "~y~%d %s~n~~b~|~w~%d:0%d~b~|", day, mtext, hour, minuite);
            }
        }
        else
        {
            if (Info[playerid][pJailTime] > 0)
            {
if( Info[playerid][pJailTime] > 60 )
{
new minuto = Info[playerid][pJailTime] / 60;
new segundo = Info[playerid][pJailTime] - (minuto*60);
 format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Tiempo de Carcel: %d min %d sec", day, mtext, hour, minuite, minuto, segundo);
}
else
{

                format(string, sizeof(string), "~y~%d %s~n~~b~|~w~%d:%d~b~|~n~~w~Tiempo de Carcel: %d sec", day, mtext, hour, minuite, Info[playerid][pJailTime]-10);
            }
}
            else
            {
                format(string, sizeof(string), "~y~%d %s~n~~b~|~w~%d:%d~b~|", day, mtext, hour, minuite);
            }
        }
        GameTextForPlayer(playerid, string, 5000, 1);
        return 1;
    }
Para explicar un poco:
pawn Код:
new minuto = Info[playerid][pJailTime] / 60; // dividimos los segundos por 60 para obtener los minutos
new segundo = Info[playerid][pJailTime] - (minuto*60); // restamos a los segundos la diferencia para obtener los segundos restantes
Es la formula mбs sencilla para lo que usted pide, saludos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)