SA-MP Forums Archive
Enable and Disable admin message. Help - 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: Enable and Disable admin message. Help (/showthread.php?tid=501867)



Enable and Disable admin message. Help - iOxide - 20.03.2014

I have this script to send player commands uses msg to admins like "Nick(1) used /tele"

pawn Код:
MessageToAdmins(playerid, command[], text[])
{
    new Name[24], Msg[128];

    for (new i; i < MAX_PLAYERS; i++) {
    if (APlayerData[i][PlayerLevel] >= 3) {
    GetPlayerName(playerid, Name, sizeof(Name));
    format(Msg, 128, "** Player %s(%d) used: %s %s", Name, playerid, command, text);
    SendClientMessage(i, 0x808080FF, Msg); } }
}
I want a command to enable or disable this text for admins with /text /textoff. I even tried with bools but it didn't work, can anyone help? :/


AW: Enable and Disable admin message. Help - CutX - 20.03.2014

simple,
try this

pawn Код:
new bool: spyMsg[MAX_PLAYERS];//global bool var

//make a simplecmd to turn on spying and turn it off again
//example:
YCMD:spy(playerid, params[], help)
{
    if (help) return SendClientMessage(playerid, gray, "/spy Is used to spy on players Commands.");
    if (APlayerData[i][PlayerLevel] >= 3)
    {
        if(!spyMsg[playerid])
        {
            spyMsg[playerid] = true;
            SendClientMessage(playerid, white,"Spying has been enabled!");
        }
        else
        {
            spyMsg[playerid] = false;
            SendClientMessage(playerid, white,"Spying has been disabled!");
        }
    }
    return 1;
}

MessageToAdmins(playerid, command[], text[])
{
    new Name[24], Msg[128];

    for (new i; i < MAX_PLAYERS; i++)
    {
        if (APlayerData[i][PlayerLevel] >= 3)
        {
            if(!spyMsg[playerid]) continue;//if spying isn't true they won't get the msg
            GetPlayerName(playerid, Name, sizeof(Name));
            format(Msg, 128, "** Player %s(%d) used: %s %s", Name, playerid, command, text);
            SendClientMessage(i, 0x808080FF, Msg);
        }
    }
}