Enable and Disable admin message. Help
#1

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? :/
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)