if(IsAdminConnected) -
Alex_Obando - 28.08.2011
Im using SendClientMessageToAdmins Strock,
So how I can make a strock which check if the player (ADMIN) is connected)
im using SendClientMessageToAdmins
Re: if(IsAdminConnected) -
IceCube! - 28.08.2011
The only way i cn think of doing this is by doing
pawn Код:
if(IsPlayerConnected)
{
if(IsPlayerAdmin)
{
SendClientMessageToAdmins....
}
}
Because there is no actual fuction to do that
EDIT: Sorry i didnt think you ment that sorry fot the n00b post
Respuesta: if(IsAdminConnected) -
Alex_Obando - 28.08.2011
I think thats wrong
It'll be:
If the player is connected & is rcon send the message to him.....
Re: if(IsAdminConnected) -
grand.Theft.Otto - 28.08.2011
pawn Код:
forward SendClientMessageToAdmins(color,const string[]);
public SendClientMessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
if(PlayerInfo[i][Level] >= 1 || IsPlayerAdmin(i))
{
SendClientMessage(i, COLOR_HERE, string);
}
}
}
return 1;
}
Change PlayerInfo to yours, like Info, pInfo, etc... Unless you don't have one, then just delete it and make the line
if(IsPlayerAdmin(i))
Then when you want a message to be sent to admins, use SendClientMessageToAdmins(color,string);
Respuesta: if(IsAdminConnected) -
Alex_Obando - 28.08.2011
Can it be this:
pawn Код:
stock AdminConnected(playerid)
{
for(new a, g = GetMaxPlayers(); a < g; a++)
if(IsPlayerConnected(a) && IsPlayerAdmin(a))
}
Re: Respuesta: if(IsAdminConnected) -
JaTochNietDan - 29.08.2011
Quote:
Originally Posted by Alex_Obando
Can it be this:
pawn Код:
stock AdminConnected(playerid) { for(new a, g = GetMaxPlayers(); a < g; a++) if(IsPlayerConnected(a) && IsPlayerAdmin(a)) }
|
Yes but you haven't returned a value or done anything so how are you supposed to know?
Simply edit the function to return a value as expected, for example:
pawn Код:
stock AdminConnected()
{
for(new a, g = GetMaxPlayers(); a < g; a++)
if(IsPlayerConnected(a) && IsPlayerAdmin(a)) return 1;
return 0;
}
Now it will return 1 when an administrator is connected and 0 when there are no administrators connected.
Additionally, why do you create two variables in the loop? You only really need one:
pawn Код:
stock AdminConnected()
{
for(new a = 0; a < GetMaxPlayers(); a++)
if(IsPlayerConnected(a) && IsPlayerAdmin(a)) return 1;
return 0;
}
Respuesta: if(IsAdminConnected) -
Alex_Obando - 29.08.2011
Holy cow, an admin replied me xD, Thanks sir...