Ayuda Dialog - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (
https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Ayuda Dialog (
/showthread.php?tid=328455)
Ayuda Dialog -
Fede.Zink - 24.03.2012
Bueno estoy creando un sistema de registro. para mi server bueno en el dialog la primera opcion es masculino
y la segunda femenino cuando pongo masculino funciona pero en femenino no que hago mal
aca el codigo del dialog:
pawn Код:
if(dialogid == 1245)
{
if(response == 1)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Masculino");
return 1;
}
else if(response == 0)
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Femenino");
return 1;
}
}
Respuesta: Ayuda Dialog -
ValenRatti - 24.03.2012
No pongas else if, pone otro if.
pawn Код:
if(dialogid == 1245)
{
if(response == 0)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Masculino");
return 1;
}
if(response == 1)
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Femenino");
return 1;
}
return 1;
}
Re: Ayuda Dialog -
Fede.Zink - 24.03.2012
Sige igual no me funciona la opcion dos osea Femenino
Respuesta: Ayuda Dialog -
TiNcH010 - 25.03.2012
pawn Код:
if(dialogid == 1245)
{
if(response) // Aceptar u utro.
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Masculino");
return 1;
}
if(!response) // Cancelar u otro.
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Femenino");
return 1;
}
}
EDIT: No te arriesgues con el return 1; sino te va asн intenta sin el return 1;
Respuesta: Ayuda Dialog -
Jovanny - 25.03.2012
Quote:
Originally Posted by ValenRatti
No pongas else if, pone otro if.
pawn Код:
if(dialogid == 1245) { if(response == 0) { PlayerInfo[playerid][pSex] = 1; SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Masculino"); return 1; } if(response == 1) { PlayerInfo[playerid][pSex] = 2; SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Femenino"); return 1; } return 1; }
|
Es mejor else if, con else if se podrнa aplicar el dicho que dice " Si no es chana es juana", pero con 2 if es como " es chana ? y es juana tambien ?"
La mejor forma es con switch, que este no comprueba uno x uno, si no que se va directo a la correcta
pawn Код:
if(dialogid == 1245)
{
switch(response)
{
case 0:
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Masculino");
return 1;
}
case 1:
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, COLOR_GREY, " Has Elegido Sexo Femenino");
return 1;
}
}
return 1;
}