Help with /admins
#1

Hello!
I am using ladmin script , in that anyone type /admins it wont show any admin name (Only show the count).It should show name of the admin.Anyone help me?
Thank you..
Reply
#2

An example of an /admins command ( with IsPlayerAdmin check, change with your own. )

pawn Код:
CMD:admins( playerid, params[ ] )
{
    new
        iCounts,
        tempString[ 128 ],
        admName[ 24 ]
    ;

    SendClientMessage( playerid, -1, "Current online administrators:" );

    foreach (Player, i)
    {
        if ( IsPlayerAdmin( i ) )
        {
            counts ++;

            GetPlayerName( i, admName, sizeof admName );

            format( tempString, sizeof ( tempString ), "%s ( %d )", admName, i );

            // format( tempString, sizeof ( tempString ), "%s ( %d ) : Level : %d.", admName, i, pInfo[ playerid ][ pLevel ] );

            SendClientMessage( playerid, tempString );
        }
    }

    if ( !counts )
        SendClientMessage( playerid, "No administrators online." );

    return 1;
}
That should helps.
Reply
#3

it shows these errors
pawn Код:
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12949) : error 017: undefined symbol "foreach"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12951) : error 017: undefined symbol "i"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12953) : error 017: undefined symbol "counts"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12953) : warning 215: expression has no effect
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12955) : error 017: undefined symbol "i"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12957) : error 017: undefined symbol "i"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12961) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12965) : error 017: undefined symbol "counts"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12966) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(12942) : warning 203: symbol is never used: "iCounts"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(19001) : error 017: undefined symbol "foreach"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(19002) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Ironboy\Desktop\0.3c package\SATDM v13 Latest\gamemodes\SATDM.pwn(19004) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.
Reply
#4

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/admins"true) == 0)
    {
        new 
bool:foundstr[30];
        for(new 
0MAX_PLAYERS++)
        {
            if(
IsPlayerAdmin(i))
            {
                
GetPlayerName(istr24);
                
format(strsizeof str"  » %s"str);
                
SendClientMessage(playerid0xFFFF00FFstr);
                
found true;
            }
        }
        if(!
found) { SendClientMessageplayerid"No administrators online." ); }
        return 
1;
    }
    return 
0;

Reply
#5

ok ty
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)