SA-MP Forums Archive
SendClientMessage To 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendClientMessage To Admins Only (/showthread.php?tid=93211)



SendClientMessage To Admins Only - jeff223 - 23.08.2009

I need someone to give me the code of a "SendClientMessage" to ALL admins


Re: SendClientMessage To Admins Only - James_Alex - 23.08.2009

pawn Код:
stock SendMessageToAdmins(color, message[])
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i, color, message);
}
}
}
}
now if an admin is logged with RCON he got the msg


Re: SendClientMessage To Admins Only - jeff223 - 23.08.2009

Could you make it like if(PlayerAdminLevel[playerid] == 1337)? Or it has to be rcon?


Re: SendClientMessage To Admins Only - _Vortex - 23.08.2009

Quote:
Originally Posted by jeff223
Could you make it like if(PlayerAdminLevel[playerid] == 1337)? Or it has to be rcon?
replace "if(IsPlayerConnected(playerid))"
with "if(PlayerAdminLevel[playerid] == 1337)"


Re: SendClientMessage To Admins Only - jeff223 - 23.08.2009

Okay, so I have this right now and it doesn't work. What do I need to do to fix it? (It's just a test ATM):

Код:
#include <a_samp>
SetTimer("SendMessageToAdmins",1000,1);
stock SendMessageToAdmins(color, message[])
{
	for(new i = 0; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(playerid))
		{
   	 if(GetPlayerMoney(i) == 5000)
		  {
			if(GetPlayerName(i) == "Lol")
			{
			SendClientMessage(i, 0xFF0000AA, "Hmm");
}
	}
		}
		}
			}



Re: SendClientMessage To Admins Only - Outbreak - 23.08.2009

Where you have IsPlayerConnected(playerid)

Replace playerid with i

if(IsPlayerConnected(i))

Since playerid isn't defined in that piece of code.


Re: SendClientMessage To Admins Only - jeff223 - 23.08.2009

Код:
C:\Users\Gamer\Desktop\Stuff\Messagetoaadmintest.pwn(2) : error 021: symbol already defined: "SetTimer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: SendClientMessage To Admins Only - James_Alex - 23.08.2009

Quote:
Originally Posted by jeff223
Okay, so I have this right now and it doesn't work. What do I need to do to fix it? (It's just a test ATM):

Код:
#include <a_samp>
SetTimer("SendMessageToAdmins",1000,1);
stock SendMessageToAdmins(color, message[])
{
	for(new i = 0; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(playerid))
		{
  	 if(GetPlayerMoney(i) == 5000)
		  {
			if(GetPlayerName(i) == "Lol")
			{
			SendClientMessage(i, 0xFF0000AA, "Hmm");
}
	}
		}
		}
			}
no why settimer ?
juste try
pawn Код:
stock SendMessageToAdmins(color, message[], level)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[i][pAdmin] >= level)
{
SendClientMessage(i, color, message);
}
}
}
}
nw you have to use
"SendMessageToAdmins(COLOR_YELLOW, "i admins", 1337)" this no send a message "hi guys" for the admins who has an admin level more or = 1337
you can change 1337 by the minimum admin level to get the message


Re: SendClientMessage To Admins Only - Outbreak - 24.08.2009

pawn Код:
stock SendMessageToAdmins(color, message[], level)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[i][pAdmin] >= level)
{
SendClientMessage(i, color, message);
}
}
}
}
Can i ask why you guys insist on giving him this wrong piece of code?

Where is "playerid" defined in that code?

replace playerid with i so your code should be like this


pawn Код:
stock SendMessageToAdmins(color, message[], level)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
   if(IsPlayerConnected(i))
   {
      if(PlayerInfo[i][pAdmin] >= level)
      {
         SendClientMessage(i, color, message);
      }
   }
}
return 1;
}



Re: SendClientMessage To Admins Only - Programie - 24.08.2009

I think the function must be public and forwarded if you want to use a timer.