08.07.2011, 23:13
(
Последний раз редактировалось Steeve_Smith; 08.07.2011 в 23:47.
)
Hey Guys I need some help with dialogs type DIALOG_STYLE_LIST and then I'll be done with them.
I know how to script them and how to show an option and buttons, but I don't know how to make my button doing an action
Example: I have my "Select" button (no need to script it it selects by clicking it) and I have a "Back" button. I know how to script the "Back" button, but I don't know where to put the code to make sure it comes back.
So in which call should I script it? In "public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])"
And where to put it?
By the way, I give the code this call contains: (The "if(!response)" doesn't work)
Thanks guys.
I know how to script them and how to show an option and buttons, but I don't know how to make my button doing an action
Example: I have my "Select" button (no need to script it it selects by clicking it) and I have a "Back" button. I know how to script the "Back" button, but I don't know where to put the code to make sure it comes back.
So in which call should I script it? In "public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])"
And where to put it?
By the way, I give the code this call contains: (The "if(!response)" doesn't work)
Код:
OnPlayerCommandText if(strcmp(cmdtext, "/help", true) == 0) { SendClientMessage(playerid, COLOR_BLUE, "You entered the Help Menu!"); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Help Menu", "Weapon Help\nCar Help\nLaser Help\nOther Commands\nCredits", "Select", "Back"); return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(!response) { SendClientMessage(playerid, COLOR_RED, "Selection Canceled"); } switch (listitem) { case 0: { SendClientMessage(playerid, COLOR_BLUE, "--- Weapon Help ---"); SendClientMessage(playerid, COLOR_GREEN, "Weapons Commands"); SendClientMessage(playerid, COLOR_YELLOW, "$500: /nstick, /bbat, /katana"); SendClientMessage(playerid, COLOR_YELLOW, "$1000: /9mm, /s9mm"); SendClientMessage(playerid, COLOR_YELLOW, "$1500: /eagle"); SendClientMessage(playerid, COLOR_YELLOW, "$2000: /mp5, /microsmg, /tech9"); SendClientMessage(playerid, COLOR_YELLOW, "$2500: /shotgun, /cshotgun"); SendClientMessage(playerid, COLOR_YELLOW, "$3000: /m4, /ak"); } case 1: { SendClientMessage(playerid, COLOR_BLUE, "--- Car Help ---"); SendClientMessage(playerid, COLOR_GREEN, "Need a car? Type Slash (/) and the car's name!"); } case 2: { SendClientMessage(playerid, COLOR_BLUE, "--- Laser Help ---"); SendClientMessage(playerid, COLOR_GREEN, "To turn ON Laser type /laseron"); SendClientMessage(playerid, COLOR_GREEN, "To turn OFF laser type /laseroff"); SendClientMessage(playerid, COLOR_GREEN, "To change the laser's color type /lasercol [color]"); SendClientMessage(playerid, COLOR_YELLOW, "Warning: You must have a weapon to use it!"); } case 3: { SendClientMessage(playerid, COLOR_BLUE, "--- Other Commands ---"); SendClientMessage(playerid, COLOR_GREEN, "/register /login /animlist"); } case 4: { SendClientMessage(playerid, COLOR_GREEN, "To see the Server's credits type /credits!"); } } } return 1; }