SA-MP Forums Archive
Event request - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Event request (/showthread.php?tid=562333)



Event request - sirvanec - 08.02.2015

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


Re: Event request - Sascha - 08.02.2015

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;
}



Re: Event request - Sime30 - 08.02.2015

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