Input Dialog Help
#1

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?
Reply
#2

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;

Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)