[HELP] Shadows a variable at a preceding level - 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: [HELP] Shadows a variable at a preceding level (
/showthread.php?tid=565470)
[HELP] Shadows a variable at a preceding level -
monster010 - 27.02.2015
I don;t understund why give me these warnings (

)
Код:
warning 219: local variable "engine" shadows a variable at a preceding level
warning 219: local variable "lights" shadows a variable at a preceding level
warning 219: local variable "alarm" shadows a variable at a preceding level
warning 219: local variable "doors" shadows a variable at a preceding level
warning 219: local variable "bonnet" shadows a variable at a preceding level
warning 219: local variable "boot" shadows a variable at a preceding level
warning 219: local variable "objective" shadows a variable at a preceding level
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(newkeys == KEY_LOOK_BEHIND)//if(KeyPressed(KEY_LOOK_BEHIND))
{
SetVehicleParamsEx(vehicleid, !engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine) GameTextForPlayer(playerid, "~w~MOTOR : ~g~PORNIT", 4000, 3);
else GameTextForPlayer(playerid, "~w~MOTOR : ~r~OPRIT", 4000, 3);
}
if(newkeys == KEY_ANALOG_UP)//if(KeyPressed(KEY_NO))
{
SetVehicleParamsEx(vehicleid, engine, !lights, alarm, doors, bonnet, boot, objective);
if(!lights) GameTextForPlayer(playerid, "~w~FARURI : ~g~APRINSE", 3000, 3);
else GameTextForPlayer(playerid, "~w~FARURI : ~r~OPRITE", 3000, 3);
}
}
new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective; - is the line
Re: [HELP] Shadows a variable at a preceding level -
awoo - 27.02.2015
All those variables were created before, just rename.
Re: [HELP] Shadows a variable at a preceding level -
CalvinC - 27.02.2015
That could either mean they're already defined in the command, or you've defined them globally.
Removing them should be fine, otherwise you can just rename them.