[Ajuda] Comando bugado - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Comando bugado (
/showthread.php?tid=557778)
Comando bugado -
Hiuship - 15.01.2015
PHP код:
if (strcmp(cmd, "/pedidosajuda", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new DialogoAjudas[512] = "Digite o ID do player a baixo\n";
new ContarPlayers;
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(PediuAjuda[i] == 1)
{
format(string, sizeof(string), "%s ID:%d\n", PlayerName(i),i);
strcat(DialogoAjudas, string);
ContarPlayers ++;
}
}
if(ContarPlayers == 0)
{
format(string, sizeof(string), "Nenhum player precisa de ajuda!");
ShowPlayerDialog(playerid, 1492, DIALOG_STYLE_INPUT,"Sistema de Ajuda",string,"Ajudar","Fechar");
return 1;
}
ShowPlayerDialog(playerid, 1492, DIALOG_STYLE_INPUT,"Sistema de Ajuda",DialogoAjudas,"Ajudar","Fechar");
}
else
{
SendClientMessage(playerid, COLOR_GREY,"{930000} - Comando para adm nivel{FFBF00} 1 {930000}ou superior!");
}
return 1;
}
Fiz debug no comando e o erro ocorre porque o comando nгo sai do loop.. ele realiza o loop por completo e para..
Agradeзo quem poder me ajudar!
Re: Comando bugado -
WLSF - 15.01.2015
Mostre a definiзгo da variбvel PediuAjuda, imagino que ela esteja como
pawn Код:
new PediuAjuda[MAX_PLAYERS];
E se for o caso, esse seu loop nгo deveria rodar atй MAX_PLAYERS, mas sim atй MAX_PLAYERS - 1
pawn Код:
for (new i = 0; i < MAX_PLAYERS; ++i)
Re: Comando bugado -
Hiuship - 15.01.2015
Obrigado Luigi.. nunca imaginei que um "=" ia fazer toda essa diferenзa.. й tentando programar e aprendendo :P
+Rep