Problem with an include
#1

Hello, i need some help with a problem please help my

When i'm trying to compile a gamemode , he said

include\progress.inc(105) : warning 219: local variable "result" shadows a variable at a preceding level


stock Float:pb_percent(Float:x, Float:widthorheight, Float:max, Float:value, direction)
{
new Float:result;
switch(direction)
{
case BAR_DIRECTION_RIGHT:
result = ((x - 3.0) + (((((x - 2.0) + widthorheight) - x) / max) * value));

case BAR_DIRECTION_LEFT:
result = ((x - 1.0) - (((((x + 2.0) - widthorheight) - x) / max) * -value)) - 4.0;

case BAR_DIRECTION_UP:
result = -((((((widthorheight / 10.0) - 0.45) * 1.02) / max) * value) + 0.55);

case BAR_DIRECTION_DOWN:
result = ((((((widthorheight / 10.0) - 0.45) * 1.02) / max) * value) - 0.55);
}
return result;
}
Reply
#2

Its just a warning not error
Reply
#3

Don't create global variables with generic names. Include this thing right after a_samp and it will probably point you in the right direction.

Quote:
Originally Posted by Micklo
Посмотреть сообщение
Its just a warning not error
"My car has its headlight broken, but it can still drive." Not the best analogy but I hope you get the point. All warnings should be taken into account. There are only two warnings which can be (relatively) safely ignored, which are symbol is never used and symbol is assigned a value that is never used. All the rest must be taken seriously because they signify that something is WRONG.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Don't create global variables with generic names. Include this thing right after a_samp and it will probably point you in the right direction.
Thanks a lot man ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)