Send message to admins when a player uses a CMD
#1

^^^^^^^^
Reply
#2

Need a little more info, what do you mean by "admins"? RCON Admins? Or do you have like a login/register system with admin levels assigned to users? If you are just using RCON Admins, then I would do the following,
pawn Код:
stock SendClientMessageToAdmins(color, message[128])
{
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(IsPlayerAdmin(i)){
            SendClientMessage(i, color, message);
        }
    }
}
And whereever you are doing your command... this example is using ZCMD
pawn Код:
CMD:mycommand(playerid, params[])
{
    //whatever the command does

    //send message to admins
    SendClientMessageToAdmins(-1, "A user used a command, blah blah...");
    return 1;
}
Haven't tested it out, should work though.
Reply
#3

^^^^^^^^
Reply
#4

^^^^^^^^
Reply
#5

Please someone correct me if im wrong! but if you have admin levels this is what i THINK you should do, change the stock from this
pawn Код:
stock SendClientMessageToAdmins(color, message[128])
{
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(IsPlayerAdmin(i)){
            SendClientMessage(i, color, message);
        }
    }
}
to this
pawn Код:
stock SendClientMessageToAdmins(color, message[128])
{
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(PlayerInfo[i][pAdmin] >= 1){
            SendClientMessage(i, color, message);
        }
    }
}
but like i said i can be wrong
Reply
#6

^^^^^^^^
Reply
#7

Have you tried to be on rcon admin?
Reply
#8

^^^^^^^^
Reply
#9

Should it really be
pawn Код:
SendClientMessageToAdmins(-1, string);
??shouldnt it only be
pawn Код:
SendClientMessageToAdmins(1, string);
Reply
#10

Try this :
pawn Код:
stock SendMessageToAdmins(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][Admin] >= 1) // You can edit this line depends on your admin system.
        SendClientMessage(i, color, string);
    }
    return 1;
}
Then you can use like this

pawn Код:
CMD:mycommand(playerid, params[])
{
       SendMessageToAdmins(-1, "My command Successful"); // -1 is your "Color" and "My command Successful" is your string.
       return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)