SA-MP Forums Archive
Many Errors - 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: Many Errors (/showthread.php?tid=585389)



Many Errors - andreistalker - 13.08.2015

On this code i get a lot of errors
PHP код:
stock GasesteID()
{
    new 
i;
    for(
1<= masinii++)
    {
//HERE   if(cInfo[i][cID] = -2)
        
{
            return 
i;
        }
    }
    return 
0;

Errors
PHP код:
C:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : error 028invalid subscript (not an array or too many subscripts): "cInfo"
C:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : warning 215expression has no effect
C
:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : error 001expected token";"but found "]"
C:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : error 029invalid expressionassumed zero
C
:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : fatal error 107too many error messages on one line 



Re: Many Errors - LetsOWN[PL] - 13.08.2015

Quote:
Originally Posted by andreistalker
Посмотреть сообщение
On this code i get a lot of errors
PHP код:
stock GasesteID()
{
    new 
i;
    for(
1<= masinii++)
    {
//HERE   if(cInfo[i][cID] = -2)
        
{
            return 
i;
        }
    }
    return 
0;

Errors
PHP код:
C:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : error 028invalid subscript (not an array or too many subscripts): "cInfo"
C:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : warning 215expression has no effect
C
:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : error 001expected token";"but found "]"
C:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : error 029invalid expressionassumed zero
C
:\Users\andrei.andrei-PC\Desktop\semp\gamemodes\WiD.pwn(4569) : fatal error 107too many error messages on one line 
Instead of <= try <. What's the definition for cInfo?

Greetings.



Re: Many Errors - andreistalker - 13.08.2015

I modified from cInfo to CarData, cInfo was my enum, now i have this:
PHP код:
warning 211possibly unintended assignment 



Re: Many Errors - andreistalker - 13.08.2015

Resolved all


Re: Many Errors - mamorunl - 13.08.2015

For people who come here after searching: the solution for warning 211: possibly unintended assignment is that you are assigning a value inside an IF-statement.

Код:
/**
will 99.9% of times default to TRUE because the value can be assigned
**/
if($value = 1) {
}

/**
This is the correct code. A value is not assigned, but checked for (notice the double equals sign (=) for the single equals sign in the top code
**/
if($value == 1) {
}