How To...?
#7

Quote:
Originally Posted by kingmk
Посмотреть сообщение
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;
}
Next you check for dialog response.

Код:
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;
}
To check if the command it's processed for the first time you need a var. I maked a var CMDUsedFirstTime[COMMAND NUMBER][THE PLAYER ID];
(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.
Thank you for your support kingmk that is what i was looking for you deserve your Reputation Point that for helping me Thank you a million times as soon i finish this method ill post it here in a base script with your credits
Reply


Messages In This Thread
How To...? - by Mobtiesgangsa - 21.02.2018, 21:30
Re: How To...? - by Nizarh - 21.02.2018, 21:34
Re: How To...? - by Mobtiesgangsa - 21.02.2018, 21:48
Re: How To...? - by AstroPoid - 21.02.2018, 23:27
Re: How To...? - by PepsiCola23 - 22.02.2018, 09:30
Re: How To...? - by kingmk - 22.02.2018, 10:50
Re: How To...? - by Mobtiesgangsa - 22.02.2018, 20:27
Re: How To...? - by kingmk - 22.02.2018, 21:19

Forum Jump:


Users browsing this thread: 1 Guest(s)