14.01.2012, 12:58
pawn Код:
#define DIALOG_TRUNK 8464 // defines the dialogid so you don't confuse it later
pawn Код:
CMD:trunk(playerid, params[]) {
ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Trunk", "Take M4\nTake MP5", "Take", "Exit"); // shows the dialog
return 1;
}
pawn Код:
if(!strcmp(cmdtext, "/trunk", true, 6)) {
ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Trunk", "Take M4\nTake MP5", "Take", "Exit"); // shows the dialog
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(dialogid == DIALOG_TRUNK) {
if(response) { // if you responded to the dialog
switch(listitem) {
case 0: GivePlayerWeapon(playerid, 31, 1000); // Gives player an M4.
case 1: GivePlayerWeapon(playerid, 29, 1000); // Gives player an MP5.
}
}
}
return 0;
}