Probs a very simple question.. -
Azzeto - 27.10.2011
How do I make it so when a player hits "cancel" on a dialog it'll send them to a specified dialog?
Re: Probs a very simple question.. - Guest3598475934857938411 - 27.10.2011
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.
Re: Probs a very simple question.. -
Azzeto - 27.10.2011
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.
Re: Probs a very simple question.. -
Kitten - 27.10.2011
pawn Код:
if(dialogid == 1)
{
if(response)
{
SendClientMessage(playerid,-1,"You Accepted horray !!!!!!");
}
else if(!response)
{
SendClientMessage(playerid,-1,"Boooooo! :)!!!!!!!!");
}
}
// not tested ...
Re: Probs a very simple question.. -
Azzeto - 27.10.2011
Look at mine then post it and try to show me with it commented. thanks.
Re: Probs a very simple question.. -
Azzeto - 27.10.2011
and how do I make a response to an input dialog? Please keep it simple... repp if help..
Re: Probs a very simple question.. -
MP2 - 27.10.2011
Input dialogs work the same, but the 'inputtext' string will contain the inputted text.
Use
if(response)
to check which button they pressed.
Re: Probs a very simple question.. -
Azzeto - 27.10.2011
Could You write down an example of an input response? thanks.
Re: Probs a very simple question.. -
Swyft™ - 27.10.2011
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
Re: Probs a very simple question.. -
Azzeto - 27.10.2011
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 код:
[LAPTOP] Josh: Hello, I'm Josh.