How To...?
#1

How can i make this type of function possible

when i type command for the first time a dialog will pop for the first time showing a message dialog box
when i click close than the other dialog will pop open with the executed command?
Reply
#2

https://sampwiki.blast.hk/wiki/ShowPlayerDialog ~~ Dialog TextDraw
https://sampwiki.blast.hk/wiki/OnDialogResponse ~~ Execute the selected Response
Reply
#3

Sorry this is not helpfull or maybe i didnt explain it well?
Reply
#4

Use cases of listed items.
Reply
#5

can you explain better what you want and show us what you`ve tried so far?
Reply
#6

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.
Reply
#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
#8

Quote:
Originally Posted by Mobtiesgangsa
Посмотреть сообщение
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
Ty, i appreciate it very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)