22.02.2018, 20:27
Quote:
Your command:
Код:
#define DIALOG_MESSAGE 1 #define MAX_COMMANDS 100 //How many commands u have. #define MAX_PLAYERS 25 //You don't need to do this, MAX_PLAYERS it's defined by default by 1000, just if u want to don't use so much space. new CMDUsedFirstTime[MAX_COMMANDS][MAX_PLAYERS]; forward CMD_mycommand(playerid); public CMD_mycommand(playerid); { new string[150], name[35]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "This command return the name of the %d playerid -> %s", id, name); SendClientMessage(playerid, -1, string); //Let's say this is the first command in your GM. CMDUsedFirstTime[0][playerid] = 1; if(CMDUsedFirstTime[0][playerid] == 0) CMDUsedFirstTime[0][playerid] = 1; return 1; } CMD:mycommand(playerid, params[]) { new id; if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /mycommand [Username/ID]"); if(CMDUsedFirstTime[0][playerid] == 0) return ShowPlayerDialog(playerid, DIALOG_MESSAGE, DIALOG_STYLE_MSGBOX, "Message", "Your message here.", "Ok", ""); else return CMD_mycommand(playerid); return 1; } Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_MESSAGE) { if(response) // If they clicked 'Ok' or pressed enter { SendClientMessage(playerid, -1, "Thank you for reading the message!"); return CMD_mycommand(playerid); //Your command will be processed. } else // Pressed ESC or clicked cancel { //Do what u want. processed the command or no... } return 1; } return 0; } (COMMAND NUMBER-> a uniq number for a command, THE PLAYER ID -> playerid of the player who execut the command.) Hope u understood it and the code work, i didn't test it. |