27.10.2011, 00:58
How do I make it so when a player hits "cancel" on a dialog it'll send them to a specified dialog?
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;
}
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;
}
if(dialogid == 1)
{
if(response)
{
SendClientMessage(playerid,-1,"You Accepted horray !!!!!!");
}
else if(!response)
{
SendClientMessage(playerid,-1,"Boooooo! :)!!!!!!!!");
}
}
// not tested ...
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! :)!!!!!!!!");
}
}
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;
}
[LAPTOP] Josh: Hello, I'm Josh.