Posts: 558
Threads: 112
Joined: May 2014
pawn Код:
wcrp\utils.pwn(1017) : warning 219: local variable "vid" shadows a variable at a preceding level
How to fix this
Here is the line of utils problem (VID):
pawn Код:
forward TPEntireCar(vid,interior,vw);// for setting players vw, and interior.
public TPEntireCar(vid,interior,vw) {
LinkVehicleToInterior(vid,interior);
SetVehicleVirtualWorld(vid,vw);
foreach(Player, i) {
if(IsPlayerConnected(i)) {
if(GetPlayerVehicleID(i)==vid) {
SetPlayerVirtualWorld(i,vw);
SetPlayerInterior(i,interior);
}
}
}
return 1;
}
Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
There's already a variable with the name "vid" defined (probably global).
Actually this is not a problem, and everything will work fine (the global variable will be shadowed, as the warning suggests, and the local one will be used until the function ends). The only consequence is that the global variable is unaccessible in this function.
To resolve the warning, you can change "vid" of the function to something else, or change the global variable (which I would recommend, since "vid" is a too generic name for a global variable).