Any idea whats wrong with this (list dialog)(solved) - 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: Any idea whats wrong with this (list dialog)(solved) (
/showthread.php?tid=148119)
Any idea whats wrong with this (list dialog)(solved) -
iggy1 - 15.05.2010
hi so iv made a dialog to spawn cars the dialog shows and everything seems ok but when i make a selection nothing happens here is the code.
Code:
ShowPlayerDialog(playerid,carlist,DIALOG_STYLE_LIST,"Choose A Vehicle","Rancher\nNrg","Buy","No Thanks");//inside a command
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new Float:x, Float:y, Float:z,Float:ang;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
if(dialogid == carlist && response)
{
if(listitem == 0)
{
Pcar[playerid] = CreateVehicle(495,x,y,z,ang,-1,-1,0);
PutPlayerInVehicle(playerid,Pcar[playerid],0);
return 1;
}
else
{
Pcar[playerid] = CreateVehicle(522,x+3.0,y,z,ang,-1,-1,0);
PutPlayerInVehicle(playerid,Pcar[playerid],0);
return 1;
}
}
return 1;
}
i have the ShowPlayerDialog in a command in my scipt

, there are no errors i just dont know y its not working. i also used a switch but that didn't work either. any help much appreciated thanks all
Re: Any idea whats wrong with this (list dialog) -
Backwardsman97 - 15.05.2010
It can be the dialog id. If you make it too large, it will give it something different. What do you have carlist set to?
Re: Any idea whats wrong with this (list dialog) -
iggy1 - 15.05.2010
should be zero i think i put lke this,
should it hold the amount of listitems as a value?
thanks for reply
Re: Any idea whats wrong with this (list dialog) -
Killa_ - 15.05.2010
pawn Code:
#define carlist 20 //At top
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new Float:x, Float:y, Float:z,Float:ang;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
if(dialogid == carlist && response)
{
switch(listitem)
{
case 0:
{
Pcar[playerid] = CreateVehicle(495,x,y,z,ang,-1,-1,0);
PutPlayerInVehicle(playerid,Pcar[playerid],0);
return 1;
}
case 1:
{
Pcar[playerid] = CreateVehicle(522,x+3.0,y,z,ang,-1,-1,0);
PutPlayerInVehicle(playerid,Pcar[playerid],0);
return 1;
}
}
}
return 1;
}
Re: Any idea whats wrong with this (list dialog)(solved) -
iggy1 - 15.05.2010
thank you m8