¿Cómo se hace este tipo de dialogos?
#1

Buenas, me pareció interesante elaborar un tutorial así en vez de usar Textdraws, ¿Cómo se hacen estos dialogos así para el tutorial? que se actualice los 15s que se pueda pasar el dialogo y cuando llega a 0 sale "Seguir" y si le das enter antes no te deje, me pareció muy buena la idea... me podrían dar un ejemplo de como se hace?





Reply
#2

https://sampforum.blast.hk/showthread.php?tid=151303
Reply
#3

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
El se refiere a los numeros, osea para esconder el dialogo, debes esperar hasta que llegue a 0.

Utiliza un timer, y cada segundo, muestrale al jugador el dialog con el tiempo en el boton modificado.
Reply
#4

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
El se refiere a los numeros, osea para esconder el dialogo, debes esperar hasta que llegue a 0.

Utiliza un timer, y cada segundo, muestrale al jugador el dialog con el tiempo en el boton modificado.
No entendí bien.
Reply
#5

Quote:
Originally Posted by Fagrinht
Посмотреть сообщение
No entendн bien.
Haz un timer que se repita cada segundo, cada vez que se ejecuta el timer le mostaras al jugador el dialogo con el tiempo modificado.
Reply
#6

Код:
forward timerDialogo(playerid);
new segundosDialogo[MAX_PLAYERS];
new _timerDialogo[MAX_PLAYERS];

[...]
segundosDialogo[playerid] = 10;
_timerDialogo[playerid] = SetTimerEx("timerDialogo", 1000, true, "i", playerid);
[...]

public timerDialogo(playerid)
{
     if(segundosDialogo[playerid] > 0)
     {
          new b1[3];
          format(b1, sizeof(b1), "%d", segundosDialogo[playerid]);
          ShowPlayerDialog(playerid, DIALOGO_ID, DIALOG_STYLE_MSGBOX, "Titulo", "Cuerpo", b1, "");
          segundosDialogo[playerid] --;
     }
     else
     {
          ShowPlayerDialog(playerid, DIALOGO_ID, DIALOG_STYLE_MSGBOX, "Titulo", "Cuerpo", "Aceptar", "");
          KillTimer(_timerDialogo[playerid]);
     }
}

public OnDialogResponse(playerid, dialogid, listitem, inputtext[])
{
     switch(dialogid)
     {
            case DIALOGO_ID:
            {
                   if(segundosDialogo[playerid] > 0)
                   {
                            new b1[3];
                            format(b1, sizeof(b1), "%d", segundosDialogo[playerid]);
                            ShowPlayerDialog(playerid, DIALOGO_ID, DIALOG_STYLE_MSGBOX, "Titulo", "Cuerpo", b1, "");         
                   }
                   else
                   {
                          [...]
                          // Lo que tengas que hacer al apretar el dialogo despues de los 10 segundos
                          [...]
                   }
            }
     }
}
Reply
#7

Una manera optimizada para esto sin temporizador harнa con la funciуn gettime.

Код:
new Espertar[MAX_PLAYERS];

new Esperar[playerid] = 15 + gettime();

if(Esperar[playerid] > gettime()) return 0;
Reply
#8

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Una manera optimizada para esto sin temporizador harнa con la funciуn gettime.

Код:
new Espertar[MAX_PLAYERS];

new Esperar[playerid] = 15 + gettime();

if(Esperar[playerid] > gettime()) return 0;
Eso no es una forma mas optimizada.
Reply
#9

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Una manera optimizada para esto sin temporizador harнa con la funciуn gettime.

Код:
new Espertar[MAX_PLAYERS];

new Esperar[playerid] = 15 + gettime();

if(Esperar[playerid] > gettime()) return 0;
No se puede hacer sin temporizador. Si la parte del dialogo," si tiempoactual-tiempoinicio < 15 volver a mostrar. si no continuar"

Pero si queres que se actualize la cantidad de segundos en el boton, necesitas un timer de un segundo que haga la resta entre tiempoinicial y gettime, y envie el dialogo actualizado. tambien necesitas almacenar el tiempo inicial cuando la cuenta regresiva empieza, que seria lo mismo que almacenar 15 y ir restandole.

podrias no usar temporizador usando gettime en la callback onplayerupdate, pero eso es todo lo contrario a optimizacion.

No hay diferencia alguna.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)