Any idea whats wrong with this (list dialog)(solved)
#1

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
Reply
#2

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?
Reply
#3

should be zero i think i put lke this,
Code:
new carlist;
should it hold the amount of listitems as a value?
thanks for reply
Reply
#4

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;
}
Reply
#5

thank you m8
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)