Command that sends message to admins online
#1

I want to create a command that sends a message to all admins online.
I want it to be like: /helpme How can I startup a vehicle?
and that the admin sees ((Playername Asks: How can I startup a vehicle?))
and I want that they are only able to send a helpme message again after the other one is already handled.
This is what I have so far.
pawn Код:
CMD:helpme(playerid, params[])
{
    new
        staff[MAX_PLAYER_NAME],
        message[128]
    ;
    if (sscanf(params, "s[128]", message)) return SendClientMessage(playerid, COL_GREY, "USAGE: /helpme [Question].");
    format(message, 128, "((%s asks: %s))", GetName(playerid), message);
    SendClientMessage(staff, COL_YELLOW, message);
    return 1;
}
Reply
#2

Make a stock to Send Message To Admins.

pawn Код:
stock SendMessageToAdmin(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(YourAdminVariable >= 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
}
Command:

pawn Код:
CMD:helpme(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    if(isnull(params)) return SendClientMessage(playerid, COL_GREY, "USAGE: /helpme [Question].");
    if(!strlen(params)) return SendClientMessage(playerid, COL_GREY, "ERROR: You didn't writed anything.");
    format(string, sizeof(string), "((%s asks: %s))", name, params);
    SendMessageToAdmins(-1, string);
    return 1;
}
Please, replace:

pawn Код:
if(YourAdminVariable >= 1)
From SendMessageToAdmin stock with your Admin variable. For example:

pawn Код:
if(PlayerInfo[i][pAdmin] >= 1)
Don't put in your variable "playerid", put "i".
Reply
#3

Thank you, that worked.
How can I make like a command that answers this questions?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)