SA-MP Forums Archive
Input Dialog 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Input Dialog Help (/showthread.php?tid=265036)



Input Dialog Help - Jack_Leslie - 29.06.2011

I'm new to Dialogs, never ever used them, but I wanna start learning to, so can someone please explain to me how I use an input dialog to do an action, so I'd have "/skin" and it'd bring up an input Dialog saying like "Please input a skin ID to change your skin", and they input a skin ID and it does the action?


Re: Input Dialog Help - Shadoww5 - 29.06.2011

PHP код:
public OnPlayerCommandText(playeidcmdtext[])
{
    if(
strcmp(cmdtext"/skin"true) == 0)
    {
        
ShowPlayerDialog(playerid198DIALOG_STYLE_INPUT"SKIN""Please input a skin ID to change your skin:""Send""Close");
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 198)
    {
        if(
response)
        {
            if(!
strlen(inputtext))
                
ShowPlayerDialog(playerid198DIALOG_STYLE_INPUT"SKIN""Please input a skin ID to change your skin:""Send""Close");
            if(
strval(inputtext) < || strval(inputtext) > 299)
                
ShowPlayerDialog(playerid198DIALOG_STYLE_INPUT"SKIN""Invalid Skin ID. Choose another:""Send""Close");
            
SetPlayerSkin(playeridstrval(inputtext));
            new 
str[64];
            
format(str128"New skin: %d"strval(inputtext));
            
SendClientMessage(playerid0xFFFF00FFstr);
        }
    }
    return 
1;




Re: Input Dialog Help - Jack_Leslie - 29.06.2011

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
PHP код:
public OnPlayerCommandText(playeidcmdtext[])
{
    if(
strcmp(cmdtext"/skin"true) == 0)
    {
        
ShowPlayerDialog(playerid198DIALOG_STYLE_INPUT"SKIN""Please input a skin ID to change your skin:""Send""Close");
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 198)
    {
        if(
response)
        {
            if(!
strlen(inputtext))
                
ShowPlayerDialog(playerid198DIALOG_STYLE_INPUT"SKIN""Please input a skin ID to change your skin:""Send""Close");
            if(
strval(inputtext) < || strval(inputtext) > 299)
                
ShowPlayerDialog(playerid198DIALOG_STYLE_INPUT"SKIN""Invalid Skin ID. Choose another:""Send""Close");
            
SetPlayerSkin(playeridstrval(inputtext));
            new 
str[64];
            
format(str128"New skin: %d"strval(inputtext));
            
SendClientMessage(playerid0xFFFF00FFstr);
        }
    }
    return 
1;

EDIT: Fixed a bug in it and it works,
thankyou for the help.