Server Unknown Command
#1

Код:
CMD:teszt(playerid, params[]) {
	SendClientMessage(playerid, COLOR_ADMINMSG, "wtf");
	MessageToAdmins(playerid, COLOR_DEATHRED, "asd");
	return 1;
}
Код:
pub:MessageToAdmins(playerid, color, str[])
{
	for(new i=0; i<=MAX_PLAYERS; i++) {
		if(Player[i][admin] > 0) SendClientMessage(i, color, str);
	}
	return 1;
}
When I write /teszt output is:
wtf
asd
SERVER: Unknown command

How to delete "SERVER: Unknown command" ? Sorry bad english skill.
Reply
#2

Quote:
Originally Posted by Develerux
Посмотреть сообщение
Код:
CMD:teszt(playerid, params[]) {
	SendClientMessage(playerid, COLOR_ADMINMSG, "wtf");
	MessageToAdmins(playerid, COLOR_DEATHRED, "asd");
	return 1;
}
Код:
pub:MessageToAdmins(playerid, color, str[])
{
	for(new i=0; i<=MAX_PLAYERS; i++) { //Error is prolly i <= MAX_PLAYERS
		if(Player[i][admin] > 0) SendClientMessage(i, color, str);
	}
	return 1;
}
If you did Player[MAX_PLAYERS][enum];
The loop is trying to access the 200th value which doesnt exist..
So it becomes 'Array out of bound'..
Change it to
PHP код:
    for(new i=0MAX_PLAYERSi++) { 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)