01.07.2014, 23:01
Quote:
Tengo una duda con esto, їcomo puedo ir guardando valores enteros y de tipo string del dialog para luego recuperarlos en una funcion?
EJ: pawn Код:
Gracias |
pawn Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Ingrese su clave", "Su clave debe contener letras y numeros.", "Siguiente", "");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
SetPVarString(playerid, "Clave", inputtext); //la almacenamos en Clave
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Ingrese su edad", "Pulsa siguiente.", "Siguiente", "");
}
}
if(dialogid == 2)
{
if(response)
{
SetPVarInt(playerid, "Edad", inputtext);// Se almacena la edad
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Seleccione su genero", "Hombre\nMujer.", "Siguiente", "");
}
}
if(dialogid == 3)
{
switch (listitem)
{
case 0:
{
SetPVarInt(playerid, "Genero", 0); //Nombramos a la variable Genero, y le damos el valor 0, equivalente a hombre
GuardarDatos(playerid);
}
case 1:
{
SetPVarInt(playerid, "Genero", 1); //Nombramos a la variable de la misma forma, y le damos valor 1, equivalente a mujer
GuardarDatos(playerid);
}
}
}
return 1;
}
stock GuardarDatos(playerid)
{
new clave[25]; //si consideramos que la contraseсa no va a contener mбs de 24 caracteres
//guardarlos a MySQL
}
pawn Код:
GetPVarString(playerid, "Clave", clave, 25); //cogemos el valor de la variable Clave y lo llevamos a la otra, para procesarlo posteriormente.
/* GetPVarString(playerid, "Nombrevariable", variableguardado, longitudvariableguardado); */
GetPVarInt(playerid, "Edad");
GetPVarInt(playerid, "Genero");