Probs a very simple question..
#1

How do I make it so when a player hits "cancel" on a dialog it'll send them to a specified dialog?
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button    
    {
   //other code
    }
//you could try using else
else
    {
        //normal code
    switch(listitem)// Checking which item was chosen
            {
                }
    }
    return 1;
}
NOTE: This code won't work out of the box, you will need to make your own. Just giving you an example.
Reply
#3

PHP код:
if(dialogid == DIALOG_LAPTOP)
{
if(
response == 1)
{
     switch(
listitem)
            {
                case 
0:
                {
                      if(
PlayerInfo[playerid][pLaptopon] == 1) return SendClientMessage(playerid,COLOR_GRAY,"Error: Your laptop is already on.");
                    
PlayerInfo[playerid][pLaptopon] ++;
                    
SendClientMessage(playerid,COLOR_YELLOW,"You've turned your laptop on.");
                }
                case 
1:
                {
                    if(
PlayerInfo[playerid][pLaptopon] == 0) return SendClientMessage(playerid,COLOR_GRAY,"Error: Your laptop is already off.");
                      
PlayerInfo[playerid][pLaptopon]--;
                    
SendClientMessage(playerid,COLOR_YELLOW,"You've shut your laptop off.");
                }
                case 
2:
                {
                    if(
response == 2) return ShowPlayerDialog(playerid,DIALOG_LAPTOP
                    ShowPlayerDialog
(playerid,DIALOG_INSTANTMESSAGE,DIALOG_STYLE_INPUT,"Instant Message","Type your Instant Message below.","Send","Return");
                
            }
}
}
return 
1;

Heres some of code, could you add it in (And comment what you added so I can learn from it). thanks.
Reply
#4

pawn Код:
if(dialogid == 1)
    {
        if(response)
        {
            SendClientMessage(playerid,-1,"You Accepted horray !!!!!!");
        }
        else if(!response)
        {
            SendClientMessage(playerid,-1,"Boooooo! :)!!!!!!!!");
        }
    }
// not tested ...
Reply
#5

Look at mine then post it and try to show me with it commented. thanks.
Reply
#6

and how do I make a response to an input dialog? Please keep it simple... repp if help..
Reply
#7

Input dialogs work the same, but the 'inputtext' string will contain the inputted text.

Use

if(response)

to check which button they pressed.
Reply
#8

Could You write down an example of an input response? thanks.
Reply
#9

Quote:
Originally Posted by Azzeto
Посмотреть сообщение
Could You write down an example of an input response? thanks.
look above, its the same thign

once you do your "Okay" response it will lead to somewhere else, if they click canncel it will do something different
pawn Код:
f(dialogid == 1)
    {
        if(response) // When Player Clicks Okay
        {
            SendClientMessage(playerid,-1,"You Accepted horray !!!!!!");
        }
        else if(!response) // When Player Clicks Cancel
        {
            SendClientMessage(playerid,-1,"Boooooo! :)!!!!!!!!");
        }
    }
basically what the other person said
Reply
#10

Omg. I know what he put, this is getting me irritiated, i'm a better learner when I see what I need to do..

PHP код:
CMD:laptop(playerid,params[])
{
    
ShowPlayerDialog(playerid,DIALOG_LAPTOP,DIALOG_STYLE_LIST,"Laptop","Power On\nPower Off\nInstant Message\nPrivate Message\nLaptop Help","Select","Close");
    return 
1;

and I need an input for the Instant Message, so when they type in for example, Hello, i'm Josh. it'd say
PHP код:
[LAPTOPJoshHelloI'm Josh. 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)