OnDialogResponse, Whats Wrong? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnDialogResponse, Whats Wrong? (
/showthread.php?tid=255463)
OnDialogResponse, Whats Wrong? -
PureStyle - 15.05.2011
Im trying to make more than one dialog response, but i dont get it, errors:
Код:
C:\Documents and Settings\Jordi\Escritorio\Comando Ayuda\Untitled.pwn(73) : error 002: only a single statement (or expression) can follow each "case"
C:\Documents and Settings\Jordi\Escritorio\Comando Ayuda\Untitled.pwn(73 -- 74) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Jordi\Escritorio\Comando Ayuda\Untitled.pwn(94) : warning 203: symbol is never used: "MostrarDialogComandos"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(1)
{
case 1:
{
if(!response)
{
MostrarDialogCancelar(playerid);
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
}
///
switch(2)
{
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
}
}
// Add the rest of your listitems for dialog 1 here
}
}
// Add the rest of your dialogs here
}
return 0;
}
Re: OnDialogResponse, Whats Wrong? -
xRyder - 15.05.2011
Read
this, maybe you'll understand what switch is for.
Re: OnDialogResponse, Whats Wrong? -
PureStyle - 15.05.2011
Thanks, but i dont understand.
Re: OnDialogResponse, Whats Wrong? -
Hobod - 15.05.2011
this probably isnt the best example but here you go:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)// this is the switch that chooses which dialog the response was from
{
case dialogid: // this is where you put the id of dialog
{
// this is where you put tthe code that happens when the player responds to the dialog
}
}
}
Re: OnDialogResponse, Whats Wrong? -
PureStyle - 15.05.2011
No problem guy, i repaired it myself, here you got a look:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//En caso de llamar dialog Ayuda
switch(1)
{
case 1:
{
if(!response)
{
MostrarDialogCancelar(playerid);
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
MostrarDialogComandos(playerid);
}
case 1:
{
MostrarDialogReglas(playerid);
}
case 2:
{
MostrarDialogInformacion(playerid);
}
case 3:
{
MostrarDialogAdmin(playerid);
}
// Add the rest of your listitems for dialog 1 here
}
}
// Add the rest of your dialogs here
}
//En caso de llamar dialog comandos
switch(3)
{
case 1:
{
if(!response)
{
MostrarDialogCancelar(playerid);
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
//NADA
}
// Add the rest of your listitems for dialog 1 here
}
}
// Add the rest of your dialogs here
}
//En caso de llamar Dialog Ayuda
switch(6)
{
case 1:
{
if(!response)
{
MostrarDialogCancelar(playerid);
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
//NADA
}
// Add the rest of your listitems for dialog 1 here
}
}
// Add the rest of your dialogs here
}
return 0;
}
Re: OnDialogResponse, Whats Wrong? -
Elka_Blazer - 15.05.2011
I guess its cuz you cant put switch in a switch ....
This forum requires that you wait 120 seconds between posts. Please try again in 10 seconds.