Shadows Variable at a preceding level
#1

PHP код:
function drop_player_weapons(playeridtype)
{
    new 
FloatPos[3], string[128], gunname[32], sweaponsammoiddresult// LINE 8155
    
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
    for(new 
012i++)
    {
        
GetPlayerWeaponData(playeridisweaponsammo);
        if(
sweapon != 0)
        {
            
result++;
            
idd CheckIDEmpty();
            
DropInfo[idd][ID] = CreatePickup(WeaponObject(sweapon), 23Pos[0]+resultPos[1]+2Pos[2], -1);
            
DropInfo[idd][Type] =  0;
            
DropInfo[idd][Weapon] = sweapon;
            
DropInfo[idd][Ammo] = sammo;
            
GetWeaponName(sweapongunnamesizeof(gunname));
            
format(stringsizeof(string), "{90F037}%s{FFFFFF} (%d)"gunnamesammo);
            
DropInfo[idd][Label] = Create3DTextLabel(string, -1Pos[0]+resultPos[1]+2Pos[2], 10.000);
        }
    }
    if(
activeHeal == && type == 0)
    {
        
result++;
        
idd CheckIDEmpty();
        
DropInfo[idd][ID] = CreatePickup(124023Pos[0]+resultPos[1]+2Pos[2], -1);
        
DropInfo[idd][Type] = 1;
        
DropInfo[idd][Weapon] = 0;
        
DropInfo[idd][Ammo] = 0;
        
DropInfo[idd][Label] = Create3DTextLabel("{DE1212}Medkit (1)", -1Pos[0]+resultPos[1]+2Pos[2], 10.000);
    }
    
ResetPlayerWeapons(playerid);
    return 
1;

Код:
(8155) : warning 219: local variable "Pos" shadows a variable at a preceding level
Reply
#2

Means where you have 'Pos', it's already been defined higher in the script.

Rename the new variable (The one on the line shown) and all mentions of it in the command, to something else, but look as well at why you've defined it earlier on in the script, most likely up top.


Whilst you can simply remove the new Pos (The one on the line shown) from the command, it's possible this could conflict with something if you have another command or function that's using it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)