SA-MP Forums Archive
[Ajuda] error 001: expected token: ";", but found "]" - 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] error 001: expected token: ";", but found "]" (/showthread.php?tid=655639)



error 001: expected token: ";", but found "]" - Canema - 25.06.2018

boa noite galera, alguйm me ajuda com esses erros?

Код:
public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    TempoAFK[playerid] = gettime();
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        for(new i = 0; i < sizeof(SpikeInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
            {
                if(SpikeInfo[i][sCreated] == 1)
                {
                    new panels, doors, lights, tires;
                    new carid = GetPlayerVehicleID(playerid);
                    GetVehicleDamageStatus(carid, panels, doors, lights, tires);
                    tires = encode_tires(1, 1, 1, 1);
                    UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
                    return 0;
                }
            }
        }
    }

    return 1;
}
ERRO NESTA LINHA: if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))

error 028: invalid subscript (not an array or too many subscripts): "SpikeInfo"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

dб todos esses erros


Re: error 001: expected token: ";", but found "]" - GuiKommander - 25.06.2018

Como estб sendo desenvolvido a variбvel SpikeInfo?


Re: error 001: expected token: ";", but found "]" - Canema - 25.06.2018

Quote:
Originally Posted by GuiKommander
Посмотреть сообщение
Como estб sendo desenvolvido a variбvel SpikeInfo?
new SpikeInfo;


Re: error 001: expected token: ";", but found "]" - FerrariL - 25.06.2018

Meu caro, SpikeInfo deve estar declarado como matriz de tipo Float.


Re: error 001: expected token: ";", but found "]" - Canema - 25.06.2018

Quote:
Originally Posted by FerrariL
Посмотреть сообщение
Meu caro, SpikeInfo deve estar declarado como matriz de tipo Float.
pode me explicar melhor por favor?


Re: error 001: expected token: ";", but found "]" - GuiKommander - 25.06.2018

PHP код:
new Float:SpikeInfo
Isso ae.


Re: error 001: expected token: ";", but found "]" - Canema - 25.06.2018

Quote:
Originally Posted by GuiKommander
Посмотреть сообщение
PHP код:
new Float:SpikeInfo
Isso ae.
compilei e continua os mesmos erros, nгo entendo


Re: error 001: expected token: ";", but found "]" - GuiKommander - 25.06.2018

Код:
EDIT:

Lembrei agora como fazer, faзa em uma Enum.
PHP код:
enum InfoSpike
{
    
Float:sX,
    
Float:sY,
    
Float:sZ
}
new 
SpikeInfo[MAX_PLAYERS][InfoSpike]; 
Coloque isso no comeзo do seu GM.


Re: error 001: expected token: ";", but found "]" - Canema - 25.06.2018

Quote:
Originally Posted by GuiKommander
Посмотреть сообщение
Olha lesk, acho que SpikeInfo seria uma variбvel global, tipo:
PHP код:
MAX_PLAYERS 
Agora, o resto que vocк estб utilizando teria que criar lб no comeзo:

PHP код:
new Float:sX;
new 
Float:sY;
new 
Float:sZ
Mais depende doque vocк estб tentando fazer.
pior que continua mesma coisa ;/


Re: error 001: expected token: ";", but found "]" - Canema - 25.06.2018

Quote:
Originally Posted by GuiKommander
Посмотреть сообщение
Код:
EDIT:

Lembrei agora como fazer, faзa em uma Enum.
PHP код:
enum InfoSpike
{
    
Float:sX,
    
Float:sY,
    
Float:sZ
}
new 
SpikeInfo[MAX_PLAYERS][InfoSpike]; 
Coloque isso no comeзo do seu GM.
ai nгo precisa mais da new?