SA-MP Forums Archive
dcmd_admins help. - 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: dcmd_admins help. (/showthread.php?tid=78289)



dcmd_admins help. - Anwix - 18.05.2009

well, i've currently got this sort of working, but it wont display all the admins, only 1!

Код:
dcmd_admins(playerid, params[])
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		new string[256], name[MAX_PLAYER_NAME];
		SendClientMessage(i, COLOR_GREEN, "Current Admins Online :");
		if (IsPlayerConnected(i))
		{
			if (dini_Int(GetPlayerPath(i), "admin") > 0)
			{
				new level = dini_Int(GetPlayerPath(i), "admin");
				GetPlayerName(i, name, sizeof(name));
				format(string, sizeof(string), "%s - Level %d", name, level);
				SendClientMessage(i, COLOR_WHITE, string);
				return 1;
			}
			else
			{
				SendClientMessage(i, COLOR_WHITE, "Currently No Admins Online.");
				return 1;
			}
		}
	}
	#pragma unused params
	#pragma unused playerid
}
Help is very thankful.


Re: dcmd_admins help. - FUNExtreme - 18.05.2009

pawn Код:
if (dini_Int(GetPlayerPath(i), "admin") > 0)
            {
                new level = dini_Int(GetPlayerPath(i), "admin");
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s - Level %d", name, level);
                SendClientMessage(i, COLOR_WHITE, string);
                return 1;
            }
Remove return 1


Re: dcmd_admins help. - Anwix - 18.05.2009

did nothing, just made it show 2 times.


Re: dcmd_admins help. - pen_theGun - 19.05.2009



pawn Код:
dcmd_admins(playerid, params[])
{
    #pragma unused params
    new string[128], name[MAX_PLAYER_NAME];
    string[0]=0;
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if ( IsPlayerConnected( i ) )
        {
            if ( dini_Int( GetPlayerPath(i), "admin" ) >0 )
            {
                if( string[0] == 0 )
                SendClientMessage( playerid, COLOR_GREEN, "Current Admins Online :" );
               
                new level = dini_Int( GetPlayerPath( i ), "admin" );
                GetPlayerName( i, name, MAX_PLAYER_NAME );
                format( string, sizeof( string ), "%s - Level %d", name, level );
                SendClientMessage( playerid, COLOR_WHITE, string );
            }
        }
    }
    if( string[0] == 0 )
    SendClientMessage( playerid, COLOR_WHITE, "Currently No Admins Online.");
   
    return 1;
}