[HELP]CMD
#1

how to create anti dialog for cmd when player is in dialog to not have a right to write cmd. ?
EROR:You are in Dialog,and you can't write commands',just close the dialog.
Reply
#2

You use IsPlayerInRangeOfPoint
Reply
#3

pawn Код:
new InDialog[MAX_PLAYERS]; //At the top of your script

public OnPlayerConnect(playerid)
{
    InDialog[playerid] = 0; //Player is not in dialog, therefore false/0
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[]) //Player tries to type a command
{
    if(InDialog[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are in a dialog, and cannot use commands until you close it."); //if the player is in a dialog, send message

    if(strcmp(cmdtext, "/openmydialog", true) == 0)
    {
        ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Example of a dialog", "This is your dialog", "Select", "Close");
        InDialog[playerid] = 1; //Player is now in dialog
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dialogid)
    {
        if(response) //if they selected something in the dialog
        {
            //InDialog[playerid] = 0; //If you do not have another ShowPlayerDialog function in here, uncomment this line, because the dialog will close whether they select something or not.
            return 1;
        }
        else return InDialog[playerid] = 0; //Otherwise, they closed the dialog
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)