"SERVER: Unknown command" wtf?
#1

Hey guys, the server of mine says: Server Unknown command. I don't know why because the code seems to work fine. Here is the code btw:

Код:
	else if(strcmp(cmd, "/reported", true) == 0) {
	new i,Count;
	for(i = 0; i < MAX_PLAYERS; i++) Count++;
	if(PlayerInfo[i][activereport] == 0) SendClientMessage(playerid, COLOR_GREEN, "No active reports available right now");
	else if(PlayerInfo[i][activereport] == 1) {
	new string[256], name[256];
	GetPlayerName(i, name, 256);
	format(string, 256, "%s", name);
	SendClientMessage(playerid, COLOR_GREEN, string);
	}
	return 1;
	}
Help would be hell appreciated.
Reply
#2

1) Don't use elseif in OnPlayerCommandText
2) change return 1 to return 0, and add behind SCM "return 1;"
Reply
#3

Yea Mmartin tell to you :dont use elseif at OnPlayerCommandText :P
Reply
#4

yep, no elseif but else if :P
you can use else if but you have to pay attention that this won't cause wrong results

your code is wrong indeed (for sets i always to MAX_PLAYERS), but i'll try to help you

it could be:
... i see, you use strtok method, so it could be that you forgot do define "cmd"
... else if results a wrong code because of a previous true statement
... i can't see a mistake

xD
Reply
#5

pawn Код:
else if(strcmp(cmd, "/reported", true) == 0)
    {
        new i,Count;
        for(i = 0; i < MAX_PLAYERS; i++)
        { //Missing bracket
            Count++;
            if(PlayerInfo[i][activereport])
            {
                new string[256], name[256];
                GetPlayerName(i, name, 256);
                format(string, 256, "%s", name);
                SendClientMessage(playerid, COLOR_GREEN, string);
            }
        }//Another missing bracket
        if(!Count)SendClientMessage(playerid, COLOR_GREEN, "No active reports available right now");
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)