Event request
#1

Hi guys,
How can i create a code that player use /eventrequest and then in dialog they write which event they want. And then when they click at send it sends to online admins and eventers
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/eventrequest", cmdtext, true, 13) == 0)
    {
        ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Select the event", "Event 1\nEvent 2\nEvent 3", "Send", "Close");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 0)
    {
        if(response)
        {
            new string[100], name[MAX_PLAYER_NAME], event = listitem+1;
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "%s requested Event %d", name, event);
            //SendMessageToAllAdmins(string);
        }
    }
    return 1;
}
obviously replace the //SendMessageToAllAdmins with your function to send a msg to all admins...
If you want a complete working system, you'd better use the script request section.

example for sending a message to all admins
pawn Код:
stock SendMessageToAllAdmins(text[])
{
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerData[i][AdminLevel] > 0)   //replace this with your definition of admins
            {
                SendClientMessage(i, 0x99999AA, text);
            }
        }
    }
    return 1;
}
Reply
#3

Or you can use DIALOG_STYLE_INPUT and use that input text to send to all admins.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)