SendMessageToAdmins Sending to all players - 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: SendMessageToAdmins Sending to all players (
/showthread.php?tid=367281)
SendMessageToAdmins Sending to all players -
tyler12 - 09.08.2012
pawn Код:
stock SendMessageToAdmins(msg[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][Adminlevel] >= 1)
{
SendClientMessage(i,-1,msg);
}
}
}
It sends a message to all players instead of just admins.
Re: SendMessageToAdmins Sending to all players -
fiki574 - 09.08.2012
pawn Код:
stock SendMessageToAdmins(const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) == 1) if(pInfo[i][Adminlevel] > 0) SendClientMessage(i, -1, string);
return 1;
}
Re: SendMessageToAdmins Sending to all players -
IceMeteor - 09.08.2012
pawn Код:
stock SendMessageToAdmins(msg[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][Adminlevel] >= 1)
{
SendClientMessage(playerid,-1,msg); // dont loop this
}
}
}
I think it will be work
Re: SendMessageToAdmins Sending to all players -
[MM]RoXoR[FS] - 09.08.2012
Your code is correct. There must be error somewhere else.
Re: SendMessageToAdmins Sending to all players -
oliverrud - 09.08.2012
There's probably a problem with the adminlevel variable.
Re: SendMessageToAdmins Sending to all players -
XStormiest - 09.08.2012
hmm try using foreach
pawn Код:
stock SendMessageToAdmins(msg[])
{
foreach(Player,i)
{
if(IsPlayerConnected(i) == 1)
if(pInfo[i][Adminlevel] > 0)
SendClientMessage(i,-1,msg);
}
}
Re: SendMessageToAdmins Sending to all players -
lamarr007 - 09.08.2012
No,no.. Try change
>=1 to
>=2. You have probably Adminlevel variable set defaultly to 1 for all players.