Preceding to level
#1

Код:
(44826) : warning 219: local variable "engine" shadows a variable at a preceding level
PHP код:
new engine random(2)+1;
if(
f_vHealth 750)
                                    {
                                        if(
engine == 1)
                                        {
                                            
StopAudioStreamForPlayer(playerid);
                                            
PlayAudioStreamForPlayer(playerid"http://static1.grsites.com/archive/sounds/vehicle/vehicle011.mp3"xyz20.01);
                                            
SendClientMessageEx(playeridCOLOR_WHITE"Vehicle engine starting, please wait...");
                                            
SetTimerEx("SetVehicleEngine"30000"dd",  vehicleidplayerid);
                                            
format(stringsizeof(string), "** %s inserts the key in the ignition."GetPlayerNameEx(playerid));
                                            
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                            
format(stringsizeof(string), "** The engine of the vehicle starts. (( %s ))"GetPlayerNameEx(playerid));
                                            
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                        }
                                        if(
engine && < 3)
                                        {
                                            
StopAudioStreamForPlayer(playerid);
                                            
PlayAudioStreamForPlayer(playerid"http://static1.grsites.com/archive/sounds/vehicle/vehicle011.mp3"xyz20.01);
                                            
SendClientMessageEx(playeridCOLOR_WHITE"Vehicle engine starting, please wait...");
                                            
SetTimerEx("SetVehicleEngineFail"30000"dd",  vehicleidplayerid);
                                            
format(stringsizeof(string), "** %s inserts the key in the ignition."GetPlayerNameEx(playerid));
                                            
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                            
format(stringsizeof(string), "** The engine of the vehicle fails to start. (( %s ))"GetPlayerNameEx(playerid));
                                            
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                        }
                                    }
                                    } 
Reply
#2

It simply tells you that the variable 'engine' already exists somewhere before your second definition
That could be in the function itself on the same level or in any preceding level or it could be a global variable
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)