looping error - 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: looping error (
/showthread.php?tid=605555)
looping error -
TheSimpleGuy - 21.04.2016
Код:
public OnPlayerSpawn(playerid)
{
new string[128] = "";
for(new i = 0; i > MAX_CLASSES; i++)
{
if(!strcmp(string, "")) format(string, sizeof(string), "%s\n%s", string, Classes[i][Name]);
else format(string, sizeof(string), "%s", Classes[i][Name]);
}
ShowPlayerDialog(playerid, d_spawn, DIALOG_STYLE_LIST, "Select Class", string, "Select", "");
return 1;
}
My variables are completely good, the problem is when I place it with my loop, it doesn't show in-game.
Re: looping error -
jlalt - 21.04.2016
Код:
for(new i = 0; i > MAX_CLASSES; i++)
should be
Код:
for(new i = 0; i < MAX_CLASSES; i++)
full code:
PHP код:
new string[128] = "";
for(new i = 0; i < MAX_CLASSES; i++)
{
if(!strcmp(string, "")) format(string, sizeof(string), "%s\n%s", string, Classes[i][Name]);
else format(string, sizeof(string), "%s", Classes[i][Name]);
}
ShowPlayerDialog(playerid, d_spawn, DIALOG_STYLE_LIST, "Select Class", string, "Select", "");
Re: looping error -
TheSimpleGuy - 21.04.2016
Thank you very much! You're a lifesaver. I've been searching this error for hours. Thank youuu!