Problem with Dialog car spawn.
#1

Hey,
i've made a little car spawner with Dialog.

But i can open the Dialog, but i cant spawn the car after choose.
See my code:
pawn Код:
#define Sportwagen 0
There i Open the Dialog
pawn Код:
if (PRESSED(KEY_ANALOG_LEFT))
    {
    ShowPlayerDialog(playerid, Sportwagen, DIALOG_STYLE_LIST, "Such dir einen Wagen heraus", "Infernus\nBullet\nTurismo", "Auswдhlen", "SchlieЯen");
  print("Open dialog");
    }
And now the list:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == Sportwagen)
    {
        if(response)
            {
                if(listitem == 0)
                    {
                    new Float:X,Float:Y,Float:Z,Float:Angle, carid;
                GetPlayerPos(playerid,X,Y,Z);
                GetPlayerFacingAngle(playerid,Angle);
                carid = CreateVehicle(541,X,Y,Z,Angle,-1,-1,600);
                PutPlayerInVehicle(playerid,carid,0);
                    TogglePlayerControllable(playerid, 1);
                SendClientMessage(playerid, 0x0ffffff, "Auto [Bullet] wurde erfolgreich gespawnt!");
          print("spawn?");
                }
                if(listitem == 0)
                {
                    new Float:X,Float:Y,Float:Z,Float:Angle, carid;
                    GetPlayerPos(playerid,X,Y,Z);
                    GetPlayerFacingAngle(playerid,Angle);
                    carid = CreateVehicle(411,X,Y,Z,Angle,-1,-1,600);
                    PutPlayerInVehicle(playerid,carid,0);
                    TogglePlayerControllable(playerid, 1);
                    SendClientMessage(playerid, 0x0ffff, "Auto [Infernus] wurde erfolgreich gespawnt!");
          print("1");
                }
                if(listitem == 0)
                {
                    new Float:X,Float:Y,Float:Z,Float:Angle, carid;
                    GetPlayerPos(playerid,X,Y,Z);
                    GetPlayerFacingAngle(playerid,Angle);
                    carid = CreateVehicle(411,X,Y,Z,Angle,-1,-1,600);
                    PutPlayerInVehicle(playerid,carid,0);
                    TogglePlayerControllable(playerid, 1);
                    SendClientMessage(playerid, 0x0ffff, "Auto [Infernus] wurde erfolgreich gespawnt!");
          print("1");
                 }
            }
        }
return 1;
}
And when i chose some of the list, its not print.
Its print on the GameMode start and when i open the Dialog.

Pls help me :>
Reply
#2

Whats this?

pawn Код:
if (PRESSED(KEY_ANALOG_LEFT))
Reply
#3

When i Press NumPad 4 its open the Dialog.

OnPlayerKeyStateChange.. whatever :>
Reply
#4

Check your listitem statements.
Reply
#5

Quote:
Originally Posted by _soad_
When i Press NumPad 4 its open the Dialog.

OnPlayerKeyStateChange.. whatever :>
And is PRESSED defined or something in your script?
Reply
#6

Its open the Dialog when i press num 4 yes.
But when i choose a car, its wont spawn.

Sry for sucks english experience :>

//Edit

pawn Код:
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
there is it defined :>
Reply
#7

pawn Код:
if(listitem == 0)
{

if(listitem == 0)
{

if(listitem == 0)
{
Hmm, I wonder what's wrong in here.

pawn Код:
if(listitem == 0)
{

if(listitem == 1)
{

if(listitem == 2)
{
That's more like it.
Reply
#8

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == Sportwagen)
	{
		if(response)
			{
				if(listitem == 0)
					{
					new Float:X,Float:Y,Float:Z,Float:Angle, carid;
			  	GetPlayerPos(playerid,X,Y,Z);
			  	GetPlayerFacingAngle(playerid,Angle);
			  	carid = CreateVehicle(541,X,Y,Z,Angle,-1,-1,600);
			  	PutPlayerInVehicle(playerid,carid,0);
			  		TogglePlayerControllable(playerid, 1);
			  	SendClientMessage(playerid, 0x0ffffff, "Auto [Bullet] wurde erfolgreich gespawnt!");
                print("spawn?");
				}
				if(listitem == 1)
		 		{
				 	new Float:X,Float:Y,Float:Z,Float:Angle, carid;
				 	GetPlayerPos(playerid,X,Y,Z);
				  	GetPlayerFacingAngle(playerid,Angle);
				  	carid = CreateVehicle(411,X,Y,Z,Angle,-1,-1,600);
				  	PutPlayerInVehicle(playerid,carid,0);
					TogglePlayerControllable(playerid, 1);
				 	SendClientMessage(playerid, 0x0ffff, "Auto [Infernus] wurde erfolgreich gespawnt!");
                    print("1");
				}
				if(listitem == 2)
		 		{
				 	new Float:X,Float:Y,Float:Z,Float:Angle, carid;
				 	GetPlayerPos(playerid,X,Y,Z);
				  	GetPlayerFacingAngle(playerid,Angle);
				  	carid = CreateVehicle(411,X,Y,Z,Angle,-1,-1,600);
				  	PutPlayerInVehicle(playerid,carid,0);
					TogglePlayerControllable(playerid, 1);
				 	SendClientMessage(playerid, 0x0ffff, "Auto [Infernus] wurde erfolgreich gespawnt!");
                    print("1");
				 }
			}
		}
return 1;
}
you didn't change the numbers in the listitem statements
Код:
if(listitem == 0) {
//Do something
}
if(listitem == 1) {
//Do something
}
if(listitem == 2) {
//Do something
}
yours was

Код:
if(listitem == 0) {
//Do something
}
if(listitem == 0) {
//Do something
}
if(listitem == 0) {
//Do something
}
so all of the same code was being executed when you selected the first item in the list.
Reply
#9

i tryed before too.
But its not worked ..
Reply
#10

also tried other dialog ids?

Код:
#define Sportwagen 123456
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)