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



warnings - aboa - 03.01.2014

pawn Code:
C:\Users\Mohamad\Desktop\LSS-RP.pwn(26053) : warning 211: possibly unintended assignment
C:\Users\Mohamad\Desktop\LSS-RP.pwn(26057) : warning 211: possibly unintended assignment
C:\Users\Mohamad\Desktop\LSS-RP.pwn(26061) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Warnings.
pawn Code:
for(new h = 0; h < MAX_PLAYERVEHICLES; h++)
    {
        if (CarInfo[playerid][h][tModel] != 0)
        {
            CarSys[h] = AddStaticVehicleEx(CarInfo[playerid][h][tModel],CarInfo[playerid][h][tLocationx],CarInfo[playerid][h][tLocationy],CarInfo[playerid][h][tLocationz],CarInfo[playerid][h][tAngle],CarInfo[playerid][h][tColorOne],CarInfo[playerid][h][tColorTwo],60000);
            if(CarInfo[playerid][h][tPaintjob] != 999)
            {
                ChangeVehiclePaintjob(h, CarInfo[playerid][h][tPaintjob]);
            }
            if(CarInfo[playerid][h][Neon] == 1)
            {
                ObjectSelect[h][0] = CreateDynamicObject(CarInfo[playerid][h][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
                ObjectSelect[h][1] = CreateDynamicObject(CarInfo[playerid][h][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
                AttachObjectToVehicle(ObjectSelect[h][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(ObjectSelect[h][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            }
            if(h = 1)
            {
                PlayerInfo[playerid][pCarKey1] = CarSys[h];
            }
            if(h = 2)
            {
                PlayerInfo[playerid][pCarKey2] = CarSys[h];
            }
            if(h = 3)
            {
                PlayerInfo[playerid][pCarKey3] = CarSys[h];
            }
            new plate[10];
            strmid(plate, CarInfo[playerid][h][tLicensePlate], 0, strlen(CarInfo[playerid][h][tLicensePlate]), 255);
            SetVehicleNumberPlate(h, plate);
        }
    }



Re: warnings - aboa - 03.01.2014

Lines 26053 ,26057 ,26061
pawn Code:
if(h = 1)
if(h = 2)
if(h = 3)



Re : warnings - Flobesst - 03.01.2014

When you use h = 1, you assign the value "1" to the variable "h". When you use h == 1, you are testing if the variable "h" equals value "1". If a "if" statement, you can't assign values to variables, you can just make tests:

pawn Code:
if(h == 1)
if(h == 2)
if(h == 3)



Re: Re : warnings - TheOriginal1337 - 03.01.2014

pawn Code:
if(h == 1)
else if(h == 2)
else if(h == 3)
Also add "else".