SA-MP Forums Archive
Ayuda con un error. - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Ayuda con un error. (/showthread.php?tid=562101)



Ayuda con un error. - TheMatius - 06.02.2015

Hey gente tengo error con este bucle que estoy creando.

pawn Код:
for(new i=0; i > new id[MAX_PLAYERS]; i++) //error aquн (238)
    {
        TextDrawShowForPlayer(id, pTexto);
        TextDrawShowForPlayer(id, pBarra);
       
        if(IsPlayerConnected(id))
        {
            for(new k=10; k > 100; k++)
            {
                switch(k)
                {
                    case 10:
                    {
                        TextDrawShowForPlayer(id, sBarra1);
                        if(segundo == 5)
                        {
                            k++;
                        }
                        }
                    case 20:
                    {
                        TextDrawDestroy(sBarra1);
                        TextDrawShowForPlayer(id, sBarra2);
                        if(segundo == 5)
                        {
                            k++;
                        }
                    }
                    case 30:
                    {
                        TextDrawDestroy(sBarra2);
                        TextDrawShowForPlayer(id, sBarra3);
                        if(segundo == 5)
                        {
                            k++;
                        }
                    }
                }
            }

            TextDrawDestroy(pTexto);
            TextDrawDestroy(pBarra);
        }
    }
ERROR:
Код:
C:\Users\TheMatius\Desktop\MoltenSan Player Roleplay\gamemodes\Gamemode.pwn(238) : error 029: invalid expression, assumed zero
C:\Users\TheMatius\Desktop\MoltenSan Player Roleplay\gamemodes\Gamemode.pwn(238) : warning 215: expression has no effect
C:\Users\TheMatius\Desktop\MoltenSan Player Roleplay\gamemodes\Gamemode.pwn(238) : error 001: expected token: ";", but found "]"
C:\Users\TheMatius\Desktop\MoltenSan Player Roleplay\gamemodes\Gamemode.pwn(238) : error 029: invalid expression, assumed zero
C:\Users\TheMatius\Desktop\MoltenSan Player Roleplay\gamemodes\Gamemode.pwn(238) : fatal error 107: too many error messages on one line



Respuesta: Ayuda con un error. - jotajeda - 06.02.2015

cual es el error, cual es esa linea?


Respuesta: Ayuda con un error. - Zume - 06.02.2015

Eso no se puede hacer, defines fuera del bucle la variable y sуlo aсades MAX_PLAYERS en donde has puesto el new del error


Respuesta: Ayuda con un error. - TheMatius - 06.02.2015

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
cual es el error, cual es esa linea?
Lee al principio ahн coloque que linea era.

Quote:
Originally Posted by _Zume
Посмотреть сообщение
Eso no se puede hacer, defines fuera del bucle la variable y sуlo aсades MAX_PLAYERS en donde has puesto el new del error
їAsi?:

Код:
new id[MAX_PLAYERS];
for(new i=0; i > id; i++)



Respuesta: Ayuda con un error. - jotajeda - 06.02.2015

pawn Код:
for(new id=0; id <= MAX_PLAYERS; id++)
    {
if(IsPlayerConnected(id))
        {
        TextDrawShowForPlayer(id, pTexto);
        TextDrawShowForPlayer(id, pBarra);
       
       
            for(new k=10; k <= 100; k++)
            {
                switch(k)
                {
                    case 10:
                    {
                        TextDrawShowForPlayer(id, sBarra1);
                        if(segundo == 5)
                        {
                            k++;
                        }
                        }
                    case 20:
                    {
                        TextDrawDestroy(sBarra1);
                        TextDrawShowForPlayer(id, sBarra2);
                        if(segundo == 5)
                        {
                            k++;
                        }
                    }
                    case 30:
                    {
                        TextDrawDestroy(sBarra2);
                        TextDrawShowForPlayer(id, sBarra3);
                        if(segundo == 5)
                        {
                            k++;
                        }
                    }
                }
            }

            TextDrawDestroy(pTexto);
            TextDrawDestroy(pBarra);
        }
    }



Respuesta: Ayuda con un error. - TheMatius - 06.02.2015

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
pawn Код:
for(new id=0; id <= MAX_PLAYERS; id++)
    {
if(IsPlayerConnected(id))
        {
        TextDrawShowForPlayer(id, pTexto);
        TextDrawShowForPlayer(id, pBarra);
       
       
            for(new k=10; k <= 100; k++)
            {
                switch(k)
                {
                    case 10:
                    {
                        TextDrawShowForPlayer(id, sBarra1);
                        if(segundo == 5)
                        {
                            k++;
                        }
                        }
                    case 20:
                    {
                        TextDrawDestroy(sBarra1);
                        TextDrawShowForPlayer(id, sBarra2);
                        if(segundo == 5)
                        {
                            k++;
                        }
                    }
                    case 30:
                    {
                        TextDrawDestroy(sBarra2);
                        TextDrawShowForPlayer(id, sBarra3);
                        if(segundo == 5)
                        {
                            k++;
                        }
                    }
                }
            }

            TextDrawDestroy(pTexto);
            TextDrawDestroy(pBarra);
        }
    }
Ahhh!, xd, y es mayor o igual o menor o igual? es que siempre me confundo en ese bucle.


Respuesta: Ayuda con un error. - jotajeda - 06.02.2015

si le pones que la variable 'i' es menor o igual que max_players y le das en i++, quiere decir que ese bucle terminarб cuando 'i' tenga el mismo valor que max_players