SA-MP Forums Archive
SentMessageToAdmins - 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: SentMessageToAdmins (/showthread.php?tid=323841)



SentMessageToAdmins - Reklez - 07.03.2012

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



Re: SentMessageToAdmins - xPrezidential - 07.03.2012

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.


Re: SentMessageToAdmins - Wesley221 - 07.03.2012

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.


Re: SentMessageToAdmins - Reklez - 07.03.2012

one error

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


Re: SentMessageToAdmins - Wesley221 - 07.03.2012

Oh ofcourse, stupid mistake

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

Make sure to pass the playerid parameter from the command!