Line (302/591) : warning 219: local variable "Time" shadows a variable at a preceding level -
Dovahkiin96 - 04.09.2012
Hi community. I've downloaded the MountChilliad Race filterscript this
https://sampforum.blast.hk/showthread.php?tid=60783
When i try to compile it, it send me 2 indetical warning message, one in line 302, and one in line 591:
Код:
(302) : warning 219: local variable "Time" shadows a variable at a preceding level
(591) : warning 219: local variable "Time" shadows a variable at a preceding level
Here the code near line 302:
Код:
WinnerRace(playerid)
{
new Time = GetTickCount()-StartTickcount; <---------THERE THE WARNING MESSAGE
new Float:Health;
GetVehicleHealth(Racecar, Health);
Health = (Health/10);
new Min, Sec, Mil;
ConvertTime(Time, Min, Sec, Mil);
new Reward = (floatround(Min_Reward + (Health*Reward_Per_Health_Percent)) - ((Min*60+Sec)*Reward_Discount_Per_Second));
GivePlayerMoney(playerid, Reward);
new rName[MAX_PLAYER_NAME], str[128];
GetPlayerName(CurrentRacer, rName, sizeof(rName));
if(Time < highscoretimes[1])
{
format(str, 128, "{FCFA7E}%s {FFFFFF}has {B2FC7E}finished {FFFFFF}the {B2FC7E}/mcrace. {FFFFFF}He won {B2FC7E}$%d!", rName, Reward);
SendClientMessageToAll(0x7FFF00AA, str);
format(str, 128, "{FCFA7E}%s {FF0000}broke {B2FC7E}a new record: {FFFFFF}%02d:%02d:%03d!", rName, Min, Sec, Mil);
SendClientMessageToAll(0x7FFF00AA, str);
}
else
{
format(str, 128, "{FCFA7E}%s {FFFFFF}has {B2FC7E}finished {FFFFFF}the {B2FC7E}/mcrace in {FFFFFF}%02d:%02d:%03d!. {B2FC7E}He won $%d!", rName, Min, Sec, Mil, Reward);
SendClientMessageToAll(0x7FFF00AA, str);
}
GameTextForPlayer(CurrentRacer, "~y~Winner!", 3500, 3);
TogglePlayerControllable(playerid, 0);
SetScoreInHighscoreTable(playerid, Time);
DisablePlayerRaceCheckpoint(CurrentRacer);
KillTimer(InfoTimer);
}
Here the code of 591 line:
Код:
forward UpdateInfoBox();
public UpdateInfoBox()
{
new Reward, Float:Health;
GetVehicleHealth(Racecar, Health);
Health = (Health/10);
new Time = GetTickCount()-StartTickcount; <-------------- THERE THE WARNING MESSAGE
new Min, Sec, Mil;
ConvertTime(Time, Min, Sec, Mil);
Reward = (floatround(Min_Reward + (Health*Reward_Per_Health_Percent)) - (Min*60+Sec*Reward_Discount_Per_Second));
format(InfoBoxString, 128, "~r~Checkpoint: ~y~%d/24~n~~r~Time Elapsed: ~y~%01d:%02d:%02d~n~~r~CarHealth: ~y~%.1f~n~~r~Estimated Reward: ~y~$%d", CC, Min, Sec, Mil, Health, Reward);
TextDrawHideForPlayer(CurrentRacer, InfoBox);
TextDrawSetString(InfoBox, InfoBoxString);
TextDrawShowForPlayer(CurrentRacer, InfoBox);
if(Min == max_minutes-1 && Sec == 0)
{
GameTextForPlayer(CurrentRacer, "~r~1 minute left!", 2000, 3);
}
if(Min == max_minutes-1 && Sec == 50)
{
GameTextForPlayer(CurrentRacer, "~r~10 seconds left!", 1500, 3);
}
if(Min == max_minutes)
{
FailedRace();
}
}
It don't do problem in server, but these warnings bother me...
Re: Line (302/591) : warning 219: local variable "Time" shadows a variable at a preceding level -
Rudy_ - 04.09.2012
Name the 2nd Time (change it to) Time2 or any other name
Re: Line (302/591) : warning 219: local variable "Time" shadows a variable at a preceding level -
Dovahkiin96 - 04.09.2012
LoL, thank you resolved