SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=613094)



Help - Fantje - 24.07.2016

Hey Guys.

I want to make a dialog that you can pick an object that will be attached to your body.

code:

PHP код:
CMD:toys(playeridparams[])
{
    
ShowPlayerDialog(playerid988DIALOG_STYLE_LIST"Weapons""Parrot\nBlack Hat\nBaseball Bat""Option 1""Option 2");
    return 
1;
}
CMD:edit(playeridparams[])
{
    
EditAttachedObject(playerid0);
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 988)
    {
        if(
response// If they clicked 'Select' or double-clicked a weapon
        
{
            
// Give them the toy
            
switch(listitem)
            {
                case 
0:
                {
                    
SetPlayerAttachedObject(playerid013372); //Blackhat
                
}
                case 
1:
                {
                    
SetPlayerAttachedObject(playerid013372); //Blackhat
                
}
                case 
2:
                {
                    
SetPlayerAttachedObject(playerid013372); //Blackhat
                
}
            }
        }
        return 
1// We handled a dialog, so return 1. Just like OnPlayerCommandText.
    
}
    return 
0// You MUST return 0 here! Just like OnPlayerCommandText.

The problem is:

The dialog opens but it will not respond. Even /edit will not work.

What's the problem?


Re: Help - FuNkYTheGreat - 24.07.2016

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 988)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            // Give them the toy
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerAttachedObject(playerid, 0, 1337, 2); //Blackhat
                }
                case 1:
                {
                    SetPlayerAttachedObject(playerid, 0, 1337, 2); //Blackhat
                }
                case 2:
                {
                    SetPlayerAttachedObject(playerid, 0, 1337, 2); //Blackhat
                }
            }
        }
    }

    return 1;
}
Try now i edited it.


Re: Help - Fantje - 24.07.2016

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 988)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            // Give them the toy
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerAttachedObject(playerid, 0, 1337, 2); //Blackhat
                }
                case 1:
                {
                    SetPlayerAttachedObject(playerid, 0, 1337, 2); //Blackhat
                }
                case 2:
                {
                    SetPlayerAttachedObject(playerid, 0, 1337, 2); //Blackhat
                }
            }
        }
    }

    return 1;
doesnt work