local veriable shadows a variable at a preceding level
#1

This is my code, I get this error on every public line
Код:
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(90176) : warning 219: local variable "hitid" shadows a variable at a preceding level
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(90187) : warning 219: local variable "hitid" shadows a variable at a preceding level
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(90198) : warning 219: local variable "hitid" shadows a variable at a preceding level
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(90222) : warning 219: local variable "hitid" shadows a variable at a preceding level
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(90252) : warning 219: local variable "hitid" shadows a variable at a preceding level
C:\Users\Namn\Desktop\Server\gamemodes\larp.pwn(90282) : warning 219: local variable "hitid" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Warnings.
pawn Код:
forward SearchCallHome(playerid,hitid);
public SearchCallHome(playerid,hitid) //Here
{
    new string[128];
    new name[24];
    GetPlayerName(hitid, name, sizeof(name));
    format(string, sizeof(string),"I need information about %s's House. Contact me when you find it.", name);
    ProxDetector(20.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
}

forward SearchCallVehicle(playerid,hitid);
public SearchCallVehicle(playerid,hitid)//Here
{
    new string[128];
    new name[24];
    GetPlayerName(hitid, name, sizeof(name));
    format(string, sizeof(string),"I need information about %s's Vehicle. Contact me when you find it.", name);
    ProxDetector(20.0, playerid, string, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
}

forward SearchHome(playerid,hitid);
public SearchHome(playerid,hitid)//Here
{
    new string[128];
    new name[24];
    if(PlayerInfo[hitid][pPhousekey] != 9999)
    {
        GetPlayerName(hitid, name, sizeof(name));
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
        SetPlayerCheckpoint(playerid,HouseInfo[PlayerInfo[hitid][pPhousekey]][hEntrancex], HouseInfo[PlayerInfo[hitid][pPhousekey]][hEntrancey], HouseInfo[PlayerInfo[hitid][pPhousekey]][hEntrancez], 4.0);
        format(string, sizeof(string),"Informer: I located %s house GPS cordinates are in your phone, Follow them!", name);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_HOME;
    }
    else
    {
        GetPlayerName(hitid, name, sizeof(name));
        format(string, sizeof(string),"Informer: I've looked everywhere and I can't find any house that belongs to %s.",name);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
}

forward SearchVehicle(playerid,hitid);
public SearchVehicle(playerid,hitid)//Here
{
    new string[128];
    new name[24];
    if(PlayerInfo[hitid][pPcarkey] != 9999)
    {
        new carid = PlayerInfo[hitid][pPcarkey];
        new Float:X, Float:Y, Float:Z;
        new zone[MAX_ZONE_NAME];
        GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
        GetVehiclePos(carid, X,Y,Z);
        GetPlayerName(hitid, name, sizeof(name));
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
        SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
        format(string, sizeof(string),"Informer: I located %s vehicle at %s GPS cordinates is in your phone, Follow them!",name,zone);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        SendClientMessage(playerid, COLOR_GREY,"((/removecp when you find it))");
        return 1;
    }
    else
    {
        GetPlayerName(hitid, name, sizeof(name));
        format(string, sizeof(string),"Player doesn't have a vehicle in that slot",name);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
}

forward SearchVehicle2(playerid,hitid);
public SearchVehicle2(playerid,hitid)//Here
{
    new string[128];
    new name[24];
    if(PlayerInfo[hitid][pPcarkey2] != 9999)
    {
        new carid = PlayerInfo[hitid][pPcarkey2];
        new Float:X, Float:Y, Float:Z;
        new zone[MAX_ZONE_NAME];
        GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
        GetVehiclePos(carid, X,Y,Z);
        GetPlayerName(hitid, name, sizeof(name));
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
        SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
        format(string, sizeof(string),"Informer: I located %s vehicle at %s GPS cordinates is in your phone, Follow them!",name,zone);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        SendClientMessage(playerid, COLOR_GREY,"((/removecp when you find it))");
        return 1;
    }
    else
    {
        GetPlayerName(hitid, name, sizeof(name));
        format(string, sizeof(string),"Player doesn't have a vehicle in that slot",name);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
}

forward SearchVehicle3(playerid,hitid);
public SearchVehicle3(playerid,hitid)//Here
{
    new string[128];
    new name[24];
    if(PlayerInfo[hitid][pPcarkey3] != 9999)
    {
        new carid = PlayerInfo[hitid][pPcarkey3];
        new Float:X, Float:Y, Float:Z;
        new zone[MAX_ZONE_NAME];
        GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
        GetVehiclePos(carid, X,Y,Z);
        GetPlayerName(hitid, name, sizeof(name));
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
        SetPlayerCheckpoint(playerid, X,Y,Z, 5.0);
        format(string, sizeof(string),"Informer: I located %s vehicle at %s GPS cordinates is in your phone, Follow them!",name,zone);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        SendClientMessage(playerid, COLOR_GREY,"((/removecp when you find it))");
        return 1;
    }
    else
    {
        GetPlayerName(hitid, name, sizeof(name));
        format(string, sizeof(string),"Player doesn't have a vehicle in that slot",name);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
}
How can I fix it?
Reply
#2

Do you have a new hitid variable placed at the top of your gamemode?
Reply
#3

Yes, but I haven't created any other so what does that have to do with it?
Reply
#4

Do you actually need the variable on top of the game mode? If you do, use:

pawn Код:
new hitid;
In every command or function the variable is being used.
Reply
#5

Yes I do, And I use
pawn Код:
new hitid = 999;
Reply
#6

So I'm guessing you're making a new "hitid" variable in each of the areas you're calling the publics?
Reply
#7

No, Thats the strange part. Thats the only new hitid I have.
Reply
#8

Just change the name of hitid in the gamemode in "hitid2" or something similar.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)