Warning: for(new i = 0; i <MAX_PLAYERS; i++)
#1

PHP код:
warning 219local variable "i" shadows a variable at a preceding level 
LINE = 18874:

PHP код:
        }
            [
this is the line 18874]:for(new 0<MAX_PLAYERSi++)
            {
            if(
IsPlayerNPC(i)) return 1;
            }
            if (
IsABus(vehicleid) && GetPlayerState(i) == && PlayerInfo[i][pJob] != 14)
            {
                
RemovePlayerFromVehicle(i);
            } 
How can I fix this?
Reply
#2

You are performing a loop under another loop with the same variables.
pawn Код:
// WRONG:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    for(new i = 0; i < MAX_PLAYERS; i++)

// RIGHT:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    for(new i2 = 0; i2 < MAX_PLAYERS; i2++)
Reply
#3

Oh mah god, you saved my time, thank you a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)