CMD:Exit does not get the right house
#1

Okay so i got this:
pawn Код:
CMD:exit(playerid, params[])
{
    if(APlayerData[playerid][CurrentHouse] > -1)
    {
        new HouseID;
        APlayerData[playerid][CurrentHouse] = HouseID;
        SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        APlayerData[playerid][CurrentHouse] = -1;
    }
    else
        SendClientMessage(playerid, 0xFFFFFF, "{FF0000}You are not in a house!");
    return 1;
}
But it always gets me to the ID 0. While CurrentHouse is for example 2. I debugged that it is 2 so why does this not get the positions?
Reply
#2

Yes, because "new HouseID" returns 0 and you assign your CurrentHouse variable to this.
You have to store the houseID when you enter the house
Reply
#3

new HouseID;

When you make that, you are initializing the variable to 0, that's why it is allways the house in the id 0, you don't change that value.
Reply
#4

CurrentHouse is assigned to the houseID when you enter the house.
Reply
#5

Quote:
Originally Posted by thimo
Посмотреть сообщение
CurrentHouse is assigned to the houseID when you enter the house.
So, maybe you want to do this:

pawn Код:
new HouseID =  APlayerData[playerid][CurrentHouse];
Reply
#6

My bad. Sorry xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)