Help warning
#1

hello

i have problem , i get warning in this command , i added this define :
Код:
static VehicleID[MAX_PLAYERS];
about crasher, and i get warn in this cmd , /fvr, i don't get warning in this cmd before.


warning
Код:
warning 219: local variable "VehicleID" shadows a variable at a preceding level
Line :
Код:
new VehicleID = GetPlayerVehicleID(playerid);
full code
pawn Код:
CMD:fv(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "You are not in a vehicle");
    {
        if(playerVariables[playerid][pAdminLevel] >= 1)
        {
            new VehicleID = GetPlayerVehicleID(playerid);
            RepairVehicle(VehicleID);
            SendClientMessage(playerid, COLOR_BLUE, "Vehicle repaired succesfull!");
        }
        else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
    }
     return 1;
}
Reply
#2

You declared it globally as an array and then you declare it again (the same variable name) in the command as an integer.

If you do not want to store it anywhere, just use it directly:
pawn Код:
RepairVehicle(GetPlayerVehicleID(playerid));
and remove the rest.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You declared it globally as an array and then you declare it again (the same variable name) in the command as an integer.

If you do not want to store it anywhere, just use it directly:
pawn Код:
RepairVehicle(GetPlayerVehicleID(playerid));
and remove the rest.
Thanks bro for help.
Reply
#4

That warning means that you have twice the same defined VehicleID put one vehicleid and the other VehicleID and it will work

static VehicleID[MAX_PLAYERS]; new VehicleID = GetPlayerVehicleID(playerid); // this you have defined beacuse of that you get warning warning 219: local variable "VehicleID" shadows a variable at a preceding level
Reply
#5

Quote:
Originally Posted by Luca12
Посмотреть сообщение
That warning means that you have twice the same defined VehicleID put one vehicleid and the other VehicleID and it will work

static VehicleID[MAX_PLAYERS]; new VehicleID = GetPlayerVehicleID(playerid); // this you have defined beacuse of that you get warning warning 219: local variable "VehicleID" shadows a variable at a preceding level
Thanks bro for help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)