[HELP][+REP]Pawno errors
#1

Код:
(72031) : warning 219: local variable "fX" shadows a variable at a preceding level
(72031) : warning 219: local variable "fY" shadows a variable at a preceding level
(72031) : warning 219: local variable "fZ" shadows a variable at a preceding level
(72283) : warning 219: local variable "i" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) // The first three warnings
{
if(hittype == 2)
{
    if(!IsAnOccupiedVehicle(hitid))
    {
        new Float:hp;
        GetVehicleHealth(hitid, Float:hp);
        if(weaponid == 24) { SetVehicleHealth(hitid, hp-DEAGLE_DAMAGE); }
        if(weaponid == 25) { SetVehicleHealth(hitid, hp-SHOTGUN_DAMAGE); }
        if(weaponid == 27) { SetVehicleHealth(hitid, hp-COMBATSHOTGUN_DAMAGE); }
        if(weaponid == 29) { SetVehicleHealth(hitid, hp-MP5_DAMAGE); }
        if(weaponid == 30) { SetVehicleHealth(hitid, hp-AK47_DAMAGE); }
        if(weaponid == 31) { SetVehicleHealth(hitid, hp-M4_DAMAGE); }
        if(weaponid == 33) { SetVehicleHealth(hitid, hp-RIFLE_DAMAGE); }
        if(weaponid == 34) { SetVehicleHealth(hitid, hp-SNIPER_DAMAGE); }
        if(weaponid == 38) { SetVehicleHealth(hitid, hp-MINIGUN_DAMAGE); }
    }
}
return 1;
}
pawn Код:
stock LoadCameras()
{
new file[64];
for(new i = 0;i<CAMERA_LIMIT;i++)
{//72283
    format(file,sizeof file,"/SpeedCameras/%i.ini",i);
    if(fexist(file))
    {
        INI_ParseFile(file,"LoadCam",.bExtra = true,.extra = i);
        #if STREAMER_ENABLED == true
        SpeedCameras[i][_objectid] = STREAMER_ADD(18880,SpeedCameras[i][_x],SpeedCameras[i][_y],SpeedCameras[i][_z],0,0,SpeedCameras[i][_rot]);
        #else
            SpeedCameras[i][_objectid] = CreateObject(18880,SpeedCameras[i][_x],SpeedCameras[i][_y],SpeedCameras[i][_z],0,0,SpeedCameras[i][_rot]);
        #endif
        SpeedCameras[i][_active] = true;
        if(SpeedCameras[i][_activelabel] == true)
        {
            SpeedCameras[i][_label] = AttachLabelToCamera(i,SpeedCameras[i][_labeltxt]);
        }
        loaded_cameras++;
    }
}
}
Help

also i have YSI v 3.09 if i update to 3.1 compiler crashes thanks
Reply
#2

Try changing the names of your other variables. There's clearly duplicate variables somewhere in your script.
Reply
#3

the first three warnings still show up :3

can you help me with it
Reply
#4

Quote:
Originally Posted by ShinichiKudou
Посмотреть сообщение
the first three warnings still show up :3

can you help me with it
Find the others variables 'fX', 'fY', and 'fZ' in your script (Not the ones in the OnPlayerWeaponShot callback), and change them.
Reply
#5

this is all

pawn Код:
enum flInfo
{
    fCreated,
    Float:fX,
    Float:fY,
    Float:fZ,
    fObject,
};
pawn Код:
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
    new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
    GetPlayerCameraPos(playerid, cx, cy, cz);
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);
    return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}
pawn Код:
new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
GetPlayerCameraPos(playerid, cx, cy, cz);
GetPlayerCameraFrontVector(playerid, fx, fy, fz);
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == 2)
{
    if(!IsAnOccupiedVehicle(hitid))
    {
        new Float:hp;
        GetVehicleHealth(hitid, Float:hp);
        if(weaponid == 24) { SetVehicleHealth(hitid, hp-DEAGLE_DAMAGE); }
        if(weaponid == 25) { SetVehicleHealth(hitid, hp-SHOTGUN_DAMAGE); }
        if(weaponid == 27) { SetVehicleHealth(hitid, hp-COMBATSHOTGUN_DAMAGE); }
        if(weaponid == 29) { SetVehicleHealth(hitid, hp-MP5_DAMAGE); }
        if(weaponid == 30) { SetVehicleHealth(hitid, hp-AK47_DAMAGE); }
        if(weaponid == 31) { SetVehicleHealth(hitid, hp-M4_DAMAGE); }
        if(weaponid == 33) { SetVehicleHealth(hitid, hp-RIFLE_DAMAGE); }
        if(weaponid == 34) { SetVehicleHealth(hitid, hp-SNIPER_DAMAGE); }
        if(weaponid == 38) { SetVehicleHealth(hitid, hp-MINIGUN_DAMAGE); }
    }
}
return 1;
}
Reply
#6

Change all of the fX, fY, and fZ variables, except for the ones in the OnPlayerWeaponShot callback.
Reply
#7

just gave me a shitload of errors
Reply
#8

bump
Reply
#9

Wait twenty-four hours before bumping a topic.
announcement.php?f=74

The 'local variable shadows a variable at a preceding level' warning is caused by duplicate variables. You're creating variables that another callback needs, in this case OnPlayerWeaponShot. All you need to do is adjust your variables accordingly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)