Unknown command after some cmd's
#1

Hey,

i got a really annoying problem since 2 days -.- and i really can't fix it myself,
even ****** is no use, nothing worked for me :/

i have a command wich lists current teams at server.
When you type it, it shows a list like this:

- Name [ID] members: members

for example:

- CutX [ID 5] members: 7

and after this, next leader of a team currently online under it, as a list, something common not really hard to script.
but it shows "Server: unknown command" after succesfully execution of the command oO
it's the default unknown cmd message.
ya, i ******d and ****** says "dude there's a return missing somewhere!" but i dont get it, i dont know where oO
it looks correct for me...

anyways, im asking you guys, do you know why? (my OnPlayerCommandText callback ends with return message...)

here's the cmd:

Код:
	if(strcmp(cmd,"/teams", true, 10) == 0)
	{
	new str[55],PN[MAX_PLAYER_NAME];
	SendClientMessage(playerid, COLOR_GREEN,"---[Teams]---");
	for(new i, m = GetMaxPlayers(); i<m; i++)
	{
		if(IsTeamLeader[i] == 1)
  		{
		GetPlayerName(i,PN,MAX_PLAYER_NAME);
		format(str,sizeof(str),"- %s {FFFFFF}[ID%d] members: %d",PN,GetPlayerID(PN),TeamCount[i]);
		SendClientMessage(playerid, COLOR_GREEN,str);
		}
	}
	return 1;
	}
its strange..... i got this problem with another cmd wich shows also a list too. i got the GetPlayerName function in it too... maby it has something to do with it? i guess no... but im not sure thaty why im asking u guys


sincerely yours,
CutX
Reply
#2

Try:
pawn Код:
if(strcmp(cmd,"/teams", true, 10) == 6)
    {
    new str[55],PN[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_GREEN,"---[Teams]---");
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsTeamLeader[i] == 1)
        {
        GetPlayerName(i,PN,MAX_PLAYER_NAME);
        format(str,sizeof(str),"- %s {FFFFFF}[ID%d] members: %d",PN,GetPlayerID(PN),TeamCount[i]);
        SendClientMessage(playerid, COLOR_GREEN,str);
        }
    }
    return 1;
    }
Reply
#3

changed nothing but ty anyways
Reply
#4

Hm, what about this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/teams",true))
    {
        new str[55],PN[MAX_PLAYER_NAME];
        SendClientMessage(playerid, COLOR_GREEN,"---[Teams]---");
        for(new i; i<GetMaxPlayers(); i++)==
        if(IsTeamLeader[i] == 1)
        GetPlayerName(i,PN,MAX_PLAYER_NAME);
        format(str,sizeof(str),"- %s {FFFFFF}[ID%d] members: %d",PN,GetPlayerID(PN),TeamCount[i]);
        SendClientMessage(playerid, COLOR_GREEN,str);
        return 1;
    }
    return 0;
}
Reply
#5

Quote:
Originally Posted by Cxnnor
Посмотреть сообщение
Hm, what about this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/teams",true))
    {
        new str[55],PN[MAX_PLAYER_NAME];
        SendClientMessage(playerid, COLOR_GREEN,"---[Teams]---");
        for(new i; i<GetMaxPlayers(); i++)==
        if(IsTeamLeader[i] == 1)
        GetPlayerName(i,PN,MAX_PLAYER_NAME);
        format(str,sizeof(str),"- %s {FFFFFF}[ID%d] members: %d",PN,GetPlayerID(PN),TeamCount[i]);
        SendClientMessage(playerid, COLOR_GREEN,str);
        return 1;
    }
    return 0;
}
nope, this just caused errors and didnt worked

all errors in this line: for(new i; i<GetMaxPlayers(); i++)==

error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "if"
error 017: undefined symbol "i"
fatal error 107: too many error messages on one line
Reply
#6

*PUSH*

does noone know how to fix it? :/


//EDIT: Fixed, a good friend told me to lower the maxplayers rate from 500 to 40
everything worked fine after doing this. I hope this here will help ppl's in future with the same problem
just lower the maxplayers rate and it'll be just fine


Yours faithfully,
CutX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)