04.12.2009, 20:06
put this under OnPlayerCommandText
And
This under OnDialogResponse
Here you have it with dcmd
Top of script
under OnPlayerCommandText
Under OnDialogResponse
UNTESTED
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/menu", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_MSGBOX, "Gate funcion", "You have the rights to open or close the gate.\n\nPress Open for opening the gate\nPress Close the close the gate", "Open", "Close"); return 1; } return 0; }
This under OnDialogResponse
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1234) { if(response) { //where the object should be when open } else { //where the object should be when closed } } return 1; }
Top of script
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(menu, 4, cmdtext); return 1; } dcmd_menu(playerid, params[]) { #pragma unused params ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_MSGBOX, "Gate funcion", "You have the rights to open or close the gate.\n\nPress Open for opening the gate\nPress Close the close the gate", "Open", "Close"); return 0; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1234) { if(response) { //where the object should be when open } else { //where the object should be when closed } } return 1; }