Server 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: Server Unknown Command (
/showthread.php?tid=628559)
Server Unknown Command -
Develerux - 11.02.2017
Код:
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.
Re: Server Unknown Command -
Mic_H - 11.02.2017
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=0; i < MAX_PLAYERS; i++) {