SA-MP Forums Archive
/admins - Something wrong here? - 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: /admins - Something wrong here? (/showthread.php?tid=190201)



/admins - Something wrong here? - spyr0x - 14.11.2010

I have just started scripting again after a looong break..
I'm kinda confused about how to fix things again.

Is there something wrong with this command? I haven't tested it 100% yet, all I know is that it is working, but anyways saying unknown command at the end.

Код:
COMMAND:admins(playerid, params[])
{
	new string[256];
	new pname[MAX_PLAYER_NAME];
	SendClientMessage(playerid, grey, "Admins Online:");
	for(new i=0;i<=MAX_PLAYERS;i++) {
	if(adminlevel[i] >= 1) {
	GetPlayerName(i, pname, sizeof(pname));
	format(string,sizeof(string),"AdminLevel %d:  %s[%d] ", adminlevel[i], pname, GetPlayerID(pname));
	SendClientMessage(playerid, grey, string);
	}
	}
	return 1;
}



Re: /admins - Something wrong here? - Jeffry - 14.11.2010

pawn Код:
COMMAND:admins(playerid, params[])
{
    new string[256];
    new pname[MAX_PLAYER_NAME];
    SendClientMessage(playerid, grey, "Admins Online:");
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(adminlevel[i] >= 1)
        {
            GetPlayerName(i, pname, sizeof(pname));
            format(string,sizeof(string),"AdminLevel %d:  %s[%d] ", adminlevel[i], pname, GetPlayerID(pname));
            SendClientMessage(playerid, grey, string);
        }
    }
    return 1;
}
Should do it. ^^


Re: /admins - Something wrong here? - Gh0sT_ - 14.11.2010

Yes, but this is better:
Quote:

COMMAND:admins(playerid, params[])
{
foreach(Player, ID)
{
if(adminlevel[ ID ] >= 1)
{
new Stringas[ 67 ], pName[ 24 ];
GetPlayerName( ID, pName, 24 );
format( Stringas , 67 , "Admin %s[ID: %i] Level %i.", adminlevel[ ID ], pName, GetPlayerID( pName ));
}
}
return true;
}




Re: /admins - Something wrong here? - spyr0x - 14.11.2010

Thanks Jeffry Problem Solved


Re: /admins - Something wrong here? - Jeffry - 14.11.2010

Quote:
Originally Posted by spyr0x
Посмотреть сообщение
Thanks Jeffry Problem Solved
No problem.
Thanks for the feedback. Have fun.