Help /admins command unknown command
#1

Код:
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;
	}
Reply
#2

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.
Reply
#3

do you even know what the hell are you doing?
Reply
#4

Can all code

Sorry for my bad English
Reply
#5

if all above things didnt worked try removing

#include <zcmd> from your script

good luck
Reply
#6

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

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

helpp
Reply
#9

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;

Reply
#10

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


Forum Jump:


Users browsing this thread: 4 Guest(s)