ShowPlayerDialog(playerid, **DIALOGID**, **DIALOGSTYLE**, "**DIALOGTITLE**", "**DIALOGBODYCONTENT**", "**LEFTBUTTONTEXT**", "**RIGHTBUTTONTEXT**");
enum
{
DIALOG_UNUSED
};
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Messagebox Title 1", "This is Information inside the first Messagebox", "Ok", ""); ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Messagebox Title 2", "This is Information inside the second Messagebox", "Okay", "");
enum
{
DIALOG_UNUSED
};
enum
{
DIALOG_UNUSED,
DIALOG_HELP,
DIALOG_HELP2
};
CMD:help(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_HELP, DIALOG_STYLE_MSGBOX, "Help Page 1", "This is Page 1 of the Help Messagebox", "Page 2", "Exit");
return 1;
}
OnDialogResponse
"Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback. It is always called first in filterscripts so returning 1 there blocks other filterscripts from seeing it." |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_UNUSED: return 1; //This is the Empty Dialog that isn't used as I previously mentioned.
case DIALOG_HELP://This is our Help Dialog called from CMD:help
{
if(!response) return 1;//This is the Exit Button we made, the right side Button
else if(response)//This is the Page 2 Button we made, the left side Button
{
//We want to show the Page 2 Dialog now that they have pressed the Help Page 2 Button
ShowPlayerDialog(playerid, DIALOG_HELP2, DIALOG_STYLE_MSGBOX, "Help Page 2", "This is Page 2 of the Help Messagebox", "Page 1", "Exit");
return 1;
}
}
case DIALOG_HELP2://This is our Page 2 Dialog Response, called from DIALOG_HELP Button
{
if(!response) return 1;//This is the Exit Button we made, the right side Button
else if(response)//This is the Page 1 Button we made, the left side Button, to take us back to the Page 1 Dialog
{
//We want to show the Page 1 Dialog now that they have pressed the Help Page 1 Button
ShowPlayerDialog(playerid, DIALOG_HELP, DIALOG_STYLE_MSGBOX, "Help Page 1", "This is Page 1 of the Help Messagebox", "Page 2", "Exit");
return 1;
}
}
}
return 1;
}
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Line Testing", "This is Line 1\nThis is Line 2\nThis is Line 3", "Ok", "");
enum
{
DIALOG_CHANGENAME
};
CMD:changename(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Change Name","Enter your new desired Name you wish to use:","Change","Exit");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_UNUSED: return 1; //This is the Empty Dialog that isn't used as I previously mentioned.
case DIALOG_CHANGENAME://This is our Changename Dialog called from CMD:changename
{
if(!response) return 1;//This is the Exit Button we made, the right side Button
else if(response)//This is the Change Button we made, the left side Button
{
if(!strlen(inputtext) || strlen(inputtext) > 24) return SendClientMessage(playerid, -1, "Name Changing requires the name to be of a length between 1-24");//This checks if they typed nothing or too much.
//We want to Change the Players Username based on what they typed in the Box earlier since we now know its between 1-24, so we use "inputtext" for that again.
SetPlayerName(playerid, inputtext);//This will change the players name based on what they wrote in the Input Dialog.
SendClientMessage(playerid, -1, "You have successfully changed your name, enjoy!");
return 1;
}
}
}
return 1;
}
enum
{
DIALOG_UNUSED,
DIALOG_TELEPORTS
};
CMD:teleport(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TELEPORTS, DIALOG_STYLE_LIST, "Teleport","Los Santos\nSan Fierro\nLas Venturas","Teleport","Exit");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_UNUSED: return 1; //This is the Empty Dialog that isn't used as I previously mentioned.
case DIALOG_TELEPORTS://This is our Teleports Dialog called from CMD:teleport
{
if(!response) return 1;//This is the Exit Button we made, the right side Button
else if(response)//This is the Teleport Button we made, the left side Button
{
switch(listitem)//This is switching ListItems, self explanatory BUT this is smart, them "\n" we added play the role on determining how many List Items we have.
{
//We always start with "0" which is essentially the First List Item from the top.
case 0://Los Santos Teleport
{
SetPlayerPos(playerid, 1532.0996,-1675.6741,13.3828);
SendClientMessage(playerid, -1, "You've teleported to Los Santos");
return 1;
}
case 1://San Fierro Teleport
{
SetPlayerPos(playerid, -2649.0630,21.0362,6.1328,357.6369); // San Fierro
SendClientMessage(playerid, -1, "You've teleported to San Fierro");
return 1;
}
case 2://Las Venturas Teleport
{
SetPlayerPos(playerid, 1687.0597,1446.8789,10.7688,275.8561); // Las Venturas
SendClientMessage(playerid, -1, "You've teleported to Las Venturas");
return 1;
}
}
}
}
}
return 1;
}
ShowPlayerDialog(playerid, PUTDIALOGIDHERE, DIALOG_STYLE_PASSWORD, "Password","Things you type here will be shown as a password:","Ok","");
OnDialogResponse
"Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback. It is always called first in filterscripts so returning 1 there blocks other filterscripts from seeing it." |