27.11.2013, 21:55
Can i make a dialog (list) with one button only?
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 2) { if(response) { if(listitem == 0) { ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper Commands \nStaff Commands ", "Select", "Cancel"); } return 1; } return 1; } if(dialogid == 2) { if(response) { if(listitem == 1) { ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle? \nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister \nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach destinations easily? \nWhy do players have different colors?", "Select", "Close"); } return 1; } return 1; } if(dialogid == 2) { if(response) { if(listitem == 2) { ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management \nPrivate Tents \nVehicles \nFishing \nBase Building", "Select", "Cancel"); } return 1; } return 1; } return 0; }
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/help", cmdtext, true) == 0) { ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Help Menu", "Commands \nFAQs \nTutorials \nCommunity ", "Select", "Cancel"); return 1; } return 0; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2)
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat
Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper
Commands \nStaff Commands ", "Select", "Cancel");
}
else if(listitem == 1)
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle?
\nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister
\nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach
destinations easily? \nWhy do players have different colors?", "Select", "Close");
}
else if(listitem == 2)
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management
\nPrivate Tents \nVehicles \nFishing \nBase Building", "Select", "Cancel");
}
}
return 1;
}
return 0;
}
This is how it should be
pawn Code:
|
The allignment is only important to understand the code better later on. How i alligned the code now(even though its not perfect) is how i usually allign it. Some other people align it differently.
|
if(dialogid == 2)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(response) { SendClientMessage(playerid,0x008000FF, "Please read the game rules to avoid any issues!"); } else { SendClientMessage(playerid, 0xFF0000FF, "You selected 'Quit', therefore you got kicked. "); Kick(playerid); } return 1; } return 1; if(dialogid == 2) { if(response) { if(listitem == 0) { ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat\ Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper\ Commands \nStaff Commands ", "Select", "Cancel"); } else if(listitem == 1) { ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle?\ \nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister\ \nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach\ destinations easily? \nWhy do players have different colors?", "Select", "Close"); } else if(listitem == 2) { ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management\ \nPrivate Tents \nVehicles \nFishing \nBase Building", "Select", "Cancel"); } return 1; } return 1; } return 0; }