SA-MP Forums Archive
Help /admins command unknown command - 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)
+--- Thread: Help /admins command unknown command (/showthread.php?tid=610933)



Help /admins command unknown command - alekschowee - 30.06.2016

Код:
if (strcmp("/admins", cmdtext, true, 10) == 0)
	{
		new admins[1024];
		new ba=0;
		new ta[MAX_PLAYER_NAME+70];
		new an[MAX_PLAYER_NAME];
		for(new i=-1;i<=GetPlayerPoolSize();i++)
		{
		if(IsPlayerConnected(i))
		{
		if(PlayerInfo[i][pAdmin]!=0)
		{
		ba++;
		GetPlayerName(i,an,sizeof(an));
		format(ta,sizeof(ta),"{FFFFFF}Admin %s Level %d\n",an,PlayerInfo[i][pAdmin]);
		strins(ta,admins,sizeof(admins));
		}
		}
		}
		if(ba==0)
		{
		SendClientMessage(playerid,-1,"{FF0000}No Admins Online!");
		}
		else
		{
		ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "Admins online", admins, "OK", "");
		}
		return 1;
	}



Re: Help /admins command unknown command - Konstantinos - 30.06.2016

Array indexes start at 0 and so player IDs. "i" needs to be 0 instead of -1.

And you keep calling GetPlayerPoolSize function, store it to a variable:
pawn Код:
for (new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
The length on strcmp would be 7 but you can remove it completely as well.


Re: Help /admins command unknown command - CodeStyle175 - 30.06.2016

do you even know what the hell are you doing?


Re: Help /admins command unknown command - alekschowee - 30.06.2016

Can all code

Sorry for my bad English


Re: Help /admins command unknown command - Owen007 - 30.06.2016

if all above things didnt worked try removing

#include <zcmd> from your script

good luck


Re: Help /admins command unknown command - alekschowee - 30.06.2016

http://prikachi.com/images.php?images/423/8818423O.jpg


Re: Help /admins command unknown command - alekschowee - 30.06.2016

In my script
#include <a_samp>
#include <YSI\y_ini>
#include <sscanf>


Re: Help /admins command unknown command - alekschowee - 30.06.2016

helpp


Re: Help /admins command unknown command - jlalt - 30.06.2016

Mates you're confusing him, you're starting your loop from id -1 which will crash it and will say unknow command leme fix it for you sir
PHP код:
if (strcmp("/admins"cmdtexttrue10) == 0)
    {
        new 
admins[1024];
        new 
ba=0;
        new 
ta[MAX_PLAYER_NAME+70];
        new 
an[MAX_PLAYER_NAME];
        for(new 
0GetPlayerPoolSize();j;i++)
        {
        if(
IsPlayerConnected(i))
        {
        if(
PlayerInfo[i][pAdmin]!=0)
        {
        
ba++;
        
GetPlayerName(i,an,sizeof(an));
        
format(ta,sizeof(ta),"{FFFFFF}Admin %s Level %d\n",an,PlayerInfo[i][pAdmin]);
        
strins(ta,admins,sizeof(admins));
        }
        }
        }
        if(
ba==0)
        {
        
SendClientMessage(playerid,-1,"{FF0000}No Admins Online!");
        }
        else
        {
        
ShowPlayerDialog(playeridDIALOG_ADMINSDIALOG_STYLE_MSGBOX"Admins online"admins"OK""");
        }
        return 
1;




Re: Help /admins command unknown command - alekschowee - 30.06.2016

http://prikachi.com/images.php?images/489/8818489X.jpg