if(IsAdminConnected)
#6

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


Messages In This Thread
if(IsAdminConnected) - by Alex_Obando - 28.08.2011, 23:39
Re: if(IsAdminConnected) - by IceCube! - 28.08.2011, 23:46
Respuesta: if(IsAdminConnected) - by Alex_Obando - 28.08.2011, 23:51
Re: if(IsAdminConnected) - by grand.Theft.Otto - 28.08.2011, 23:51
Respuesta: if(IsAdminConnected) - by Alex_Obando - 28.08.2011, 23:58
Re: Respuesta: if(IsAdminConnected) - by JaTochNietDan - 29.08.2011, 00:02
Respuesta: if(IsAdminConnected) - by Alex_Obando - 29.08.2011, 00:04

Forum Jump:


Users browsing this thread: 1 Guest(s)