Admins Only - 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: Admins Only (
/showthread.php?tid=609336)
Admins Only -
Digii - 11.06.2016
Hi Sa-Mp, I want to ask you how do you make a Admin Broadcast only for a certain admin level.
For example I want the command /slap to be shown only to admin 2+.
Thank you.
Re: Admins Only -
Alpay0098 - 11.06.2016
Its simple. first forward AdminBroadCast(color, const string[], level);
PHP код:
public AdminBroadCast(color, const string[], level)
{
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(PInfo[i][pAdminLevel] >= level)
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
Example for /slap :
PHP код:
format(string, sizeof(string), "[Warning] Admin %s //... blah blah blah
AdminBroadCast(COLOR_WHITE, string, 2);
Re: Admins Only -
Stinged - 11.06.2016
Quote:
Originally Posted by Alpay0098
Its simple. first forward AdminBroadCast(color, const string[], level);
PHP код:
public AdminBroadCast(color, const string[], level)
{
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(PInfo[i][pAdminLevel] >= level)
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
|
You don't have to check if the player is online when you use foreach.
Re: Admins Only -
Digii - 11.06.2016
Thank you very much, but I would like to show only for a certain admin level
I would like to show only for Admin level 6
so the command used by another admin will be shown only to admins with level 6+
This is what I meant, thank you.