Ayuda con un error.
#1

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
Reply
#2

cual es el error, cual es esa linea?
Reply
#3

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
Reply
#4

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++)
Reply
#5

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);
        }
    }
Reply
#6

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.
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)