SA-MP Forums Archive
I need a little help with this one. - 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: I need a little help with this one. (/showthread.php?tid=643442)



I need a little help with this one. - sBlackWood - 20.10.2017

How can i create another dialog to OnDialogResponse, But i don't know how to add another one with out getting errros. Can you help me?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new Float:x,Float:y,Float:z;
	if(dialogid==2 && response==1)
	{
	    switch(listitem)
		{
		    case 0:
		    {
			 GetPlayerPos(playerid,x,y,z);
			 CreateVehicle(522,x+3.0,y,z,0,0,0,0);
		    }
		    case 1:
		    {
			 GetPlayerPos(playerid,x,y,z);
			 CreateVehicle(522,x+3.0,y,z,0,0,0,0);
		    }
		    case 2:
		    {
			 GetPlayerPos(playerid,x,y,z);
			 CreateVehicle(522,x+3.0,y,z,0,0,0,0);
		    }
		}
	}return 1;
}
Please help


Re: I need a little help with this one. - Zeth - 20.10.2017

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
Float:x,Float:y,Float:z;
    if(
dialogid==&& response==1)
    {
        switch(
listitem)
        {
            case 
0:
            {
             
GetPlayerPos(playerid,x,y,z);
             
CreateVehicle(522,x+3.0,y,z,0,0,0,0);
            }
            case 
1:
            {
             
GetPlayerPos(playerid,x,y,z);
             
CreateVehicle(522,x+3.0,y,z,0,0,0,0);
            }
            case 
2:
            {
             
GetPlayerPos(playerid,x,y,z);
             
CreateVehicle(522,x+3.0,y,z,0,0,0,0);
            }
        }
    }
    
//add next one here
    
if(dialogid == put dialog id here)
    {
        
//statements and functions here
    
}
    return 
1;

and for your convenience here are some tips:
*Use easyDialogs for making dialogs as you are getting confused with OnDialogResponse
*Try to intend your codes, it will be easier for you to read them later.


Re: I need a little help with this one. - sBlackWood - 20.10.2017

How can i script the usage of the buttons under the dialog? "Select", "Cancel"


Re: I need a little help with this one. - Escobabe - 20.10.2017

PHP код:
ShowPlayerDialog(playeridDIALOGIDDIALOG_STYLE"Title""Info""Button 1""Button 2"); 
Read more about it here: https://sampwiki.blast.hk/wiki/ShowPlayerDialog


Re: I need a little help with this one. - sBlackWood - 20.10.2017

It does not show how to script the usage of the buttons


Re: I need a little help with this one. - Zeth - 20.10.2017

PHP код:
ShowPlayerDialog(playeriddialogidstyleCaption[], info[], button1[], button2[]) 
here button1 will take the dialog forward which is we can say you are responding to the dialog and second one will be performing the action of not responding to the dialog.
PHP код:
under OnDialogResponse
if(dialogid == 1)
{
    if(
response)
    {
        
SendClientMessage(playerid, -1"You have pressed the first button");
         return 
1;
     }
     else
     {
      
//now whatever you write below will be show on pression first button
         
SendClientMessage(playerid, -1"You have pressed the second button");
     }