SA-MP Forums Archive
Send message to admins when a player uses a CMD - 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: Send message to admins when a player uses a CMD (/showthread.php?tid=423228)



Send message to admins when a player uses a CMD - Ananisiki - 17.03.2013

^^^^^^^^


Re: Send message to admins when a player uses a CMD - Nathan_Taylor - 17.03.2013

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.


Re: Send message to admins when a player uses a CMD - Ananisiki - 17.03.2013

^^^^^^^^


Re: Send message to admins when a player uses a CMD - Ananisiki - 17.03.2013

^^^^^^^^


Re: Send message to admins when a player uses a CMD - Don_Cage - 17.03.2013

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


Re: Send message to admins when a player uses a CMD - Ananisiki - 17.03.2013

^^^^^^^^


Re: Send message to admins when a player uses a CMD - Don_Cage - 17.03.2013

Have you tried to be on rcon admin?


Re: Send message to admins when a player uses a CMD - Ananisiki - 17.03.2013

^^^^^^^^


Re: Send message to admins when a player uses a CMD - Don_Cage - 17.03.2013

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



Re: Send message to admins when a player uses a CMD - Zex Tan - 17.03.2013

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