SA-MP Forums Archive
Little Help [+rep] - 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)
+--- Thread: Little Help [+rep] (/showthread.php?tid=330780)



Little Help [+rep] - James Coral - 02.04.2012

This Code dont work:
pawn Код:
#define DIALOG_SPAWNCHOICE 1
//Other is here:
public OnPlayerSpawn(playerid)
{
 ShowPlayerDialog(playerid, DIALOG_SPAWNCHOICE,DIALOG_STYLE_MSGBOX, "Try Do Spawn", "Spawn Info", "Home", "Random");
    return 1;
}
//Response:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
        {
        case DIALOG_SPAWNCHOICE:
            {
            if(response)
                {
                SetPlayerPos(playerid, -536.3784,2592.6067,53.4141);//Cordinates are not real!
                }
            else
                {
                SetPlayerPos(playerid, -536.3784,2592.6067,53.4141);//For Test
                }
        }
    }
    return 1;
}
Problem is this dont teleport me there what i need


Re: Little Help [+rep] - blank. - 02.04.2012

You can only have two buttons, use DIALOG_STYLE_LIST if you want more than two select-able items.


Re: Little Help [+rep] - James Coral - 02.04.2012

Give me right ShowPlayerDialog Code Then
Please..


Re: Little Help [+rep] - blank. - 02.04.2012

Код:
#define DIALOG_SPAWNCHOICE 1
//Other is here:
public OnPlayerSpawn(playerid)
{
 ShowPlayerDialog(playerid, DIALOG_SPAWNCHOICE,DIALOG_STYLE_LIST, "Try Do Spawn", "Spawn Info\r\nHome\r\nRandom","Spawn","Cancel");
    return 1;
}
//Response:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
        {
        case DIALOG_SPAWNCHOICE:
            {
            if(response)
                {
				switch(listitem)
					{
					case 0:
						{
						// Player chose Spawn Info
						}
					case 1:
						{
						// Player chose Home
						}
					case 2:
						{
						// Player chose Random
						}
					}
                }
        }
    }
    return 1;
}



Re: Little Help [+rep] - James Coral - 02.04.2012

Quote:
Originally Posted by blank.
Посмотреть сообщение
Код:
#define DIALOG_SPAWNCHOICE 1
//Other is here:
public OnPlayerSpawn(playerid)
{
 ShowPlayerDialog(playerid, DIALOG_SPAWNCHOICE,DIALOG_STYLE_LIST, "Try Do Spawn", "Spawn Info\r\nHome\r\nRandom","Spawn","Cancel");
    return 1;
}
//Response:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
        {
        case DIALOG_SPAWNCHOICE:
            {
            if(response)
                {
				switch(listitem)
					{
					case 0:
						{
						// Player chose Spawn Info
						}
					case 1:
						{
						// Player chose Home
						}
					case 2:
						{
						// Player chose Random
						}
					}
                }
        }
    }
    return 1;
}
Dont Work!
Tryed );


Re: Little Help [+rep] - blank. - 02.04.2012

Could you elaborate?


Re: Little Help [+rep] - newbienoob - 02.04.2012

if you want to use DIALOG_STYLE_MESSAGEBOX (under OnDialogResponse)
pawn Код:
if(dialogid == DIALOG_SPAWNCHOICE)
     {
            if(response)
                {
                SetPlayerPos(playerid, blablabla);
                }
                else
                {
                SetPlayerPos(playerid, blablabla);
                }
    }
return 1;



Re: Little Help [+rep] - James Coral - 02.04.2012

Sorry I got Fixxed it , Thanks For Help


Re: Little Help [+rep] - Scripter12345 - 02.04.2012

Код:
#define DIALOG_SPAWNCHOICE 1
//Other is here:
public OnPlayerSpawn(playerid)
{
 ShowPlayerDialog(playerid, DIALOG_SPAWNCHOICE,DIALOG_STYLE_MSGBOX, "Try Do Spawn", "Place 1 \n Place 2", "Go", "Cancel");
    return 1;
}
//Response:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
        {
        case DIALOG_SPAWNCHOICE:
            {
            if(response)
                {
if(listitem == 0)
{
                SetPlayerPos(playerid, -536.3784,2592.6067,53.4141);//Cordinates are not real!
                }
            else
                {
                SetPlayerPos(playerid, -536.3784,2592.6067,53.4141);//For Test
                }
        }
    }
    return 1;
}