Admin list Help!!
#5

Harish, first of all, the code won't compile, because Max_PLAYERS is not a default definition. MAX_PLAYERS is. And for the sake of some efficiency, redefining it on top of your script would be handy unless your server actually has 500 slots.
pawn Code:
#undef
#define MAX_PLAYERS 100 // for a server with 100 slots
Continuing, in the IsPlayerConnected check, you pass playerid as the parameter! - That is clearly wrong, you need to pass i instead.

Also, you can effectively combine 2 if-checks like this:
pawn Code:
if(IsPlayerConnected(i))
{
    if(IsPlayerAdmin(i))
    {
    }
}
To this:
pawn Code:
if(IsPlayerConnected(i) && IsPlayerAdmin(i))
Ultimately, since IsPlayerAdmin is a native function of the SA-MP server, it already has an INBUILT connection check, so actually, your whole loop can be simplified to:
pawn Code:
for(new i = 0; i != MAX_PLAYERS; i++)
{
    if(IsPlayerAdmin(i))
    {
        // code
    }
}
Continuing, the maximal possible length of "Admin (%d) : %s was online" is definitely not 256. Start off by reading this post (why not to make your strings 256 cells large).

Also, why do you even bother posting when you see that a suitable solution has already been given? Besides your code does not do what he asked for.
Reply


Messages In This Thread
Admin list Help!! - by Xtreme Brotherz - 31.03.2012, 10:36
Re: Admin list Help!! - by Unte99 - 31.03.2012, 10:40
Re: Admin list Help!! - by AndreT - 31.03.2012, 10:41
Re: Admin list Help!! - by Harish - 31.03.2012, 11:17
Re: Admin list Help!! - by AndreT - 31.03.2012, 12:35
Re: Admin list Help!! - by introzen - 01.04.2012, 12:57
Re: Admin list Help!! - by Godde - 10.02.2015, 13:32
Re: Admin list Help!! - by Lumineux - 10.02.2015, 13:36

Forum Jump:


Users browsing this thread: 2 Guest(s)