SentMessageToAdmins
#1

ok i have a function called "SentMessageToAdmins" the problem is
i want when i type ex.

i'm Dr.432Oc i have type /fakechat. it will sent to everyone

"Admin Dr.432Oc has use /fakechat" this will sent to all admins now
i can see it now i want to disable this for the admin who use the command
and only other admins can see this.

pawn Код:
stock SentMessageToAdmins(color, const string[])
{
    new file[256];
    format(file, sizeof(file), "RAdmin/Config/Config.ini");
    if(dini_Int(file, "AdminCmdSpec") == 1)
    {
       for(new i = 0; i < MAX_PLAYERS; i++)
       {
           if(IsPlayerConnected(i) == 1)
           if(PlayerInfo[i][pAdmin] > 1)
           SendClientMessage(i, color, string);
       }
    }
    return 1;
}
Reply
#2

Not sure. But I imagine if you used an if statement after looping through all the players, you could probably compare the index the loop's on with your playerid (ex: if ( i == playerid )) and go from there.
Reply
#3

pawn Код:
stock SentMessageToAdmins(color, const string[])
{
    new file[256];
    format(file, sizeof(file), "RAdmin/Config/Config.ini");
    if(dini_Int(file, "AdminCmdSpec") == 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) == 1)
            if(PlayerInfo[i][pAdmin] > 1)
            if( i != playerid ) // <---
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}
By adding the line if( i != playerid ), it checks if i doesnt equal to your playerid, if it doesnt equal to your playerid it will send the message to all the admins, beside you.
Reply
#4

one error

Код:
error 017: undefined symbol "playerid"
so when i type /fakechat i cannot see "Admin Reklez07 has use /fakechat" only other admins?
Reply
#5

Oh ofcourse, stupid mistake

stock SentMessageToAdmins(playerid, color, const string[])

Make sure to pass the playerid parameter from the command!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)