06.08.2011, 09:41
Код:
CALLBACK: OnDialogResponse (playerid, dialogid, response, listitem, inputtext []) { new len = strlen (inputtext); for (new i = 0; i < len; ++i) if (inputtext [i] == '%')//A % can crash your server if you want to use the inputtext in a formatted string. Let's prevent this. inputtext [i] = '#'; if (IsPlayerAdmin (playerid)) { switch (dialogid) { case DIALOG_CMDS: { if (response) CallLocalFunction ("OnPlayerCommandText", "is", playerid, JB::AdminCommands[listitem]); //Sexy command list. return 1; } case DIALOG_CFG: { if (response) { switch (listitem) { case 0: ShowPlayerVarlistDialog (playerid); case 1: { ConfigJunkBuster (); SendClientMessage (playerid, JB_GREEN, "JunkBuster:{FFFF00} Configuration has been loaded from file."); ShowPlayerConfigDialog (playerid); } case 2: { SaveJunkBusterVars (); SendClientMessage (playerid, JB_GREEN, "JunkBuster:{FFFF00} Configuration has been saved to file."); ShowPlayerConfigDialog (playerid); } case 3: { JB::Variables = JB::DefaultVariables; SendClientMessage (playerid, JB_GREEN, "JunkBuster:{FFFF00} Default configuration has been loaded."); JB::Log ("JunkBuster variables have been reset to default values."); ShowPlayerConfigDialog (playerid); } case 4: ShowPlayerReportDialog (playerid); case 5: { new string [1024]; for (new i = 0; i < sizeof (JB::AdminCommands); ++i) format (string, sizeof (string), "%s%s\n", string, JB::AdminCommands [i]); ShowPlayerDialog (playerid, DIALOG_CMDS, DIALOG_STYLE_LIST, "JunkBuster Commands", string, "Perform", "Close"); } } } return 1; }