Does not understand that I am in an interior.
#1

First of all, thank you for even reading this.

Alright, so I've made a house system and now I'm working on a rent and unrent command.
On my rent command when a player's rents a house he will respawn INSIDE it everytime he spawns/respawns.

Everything is working perfectly, just.. when I try to exit the house it just does nothing.

The code:

The OnPlayerSpawn code:
pawn Код:
GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "Users/%s.ini", name);
   
    if(fexist(file))
    {
        if(PlayerInfo[playerid][Rented] == 1)
        {
            format(file, sizeof(file), "Houses/House_%d.ini", PlayerInfo[playerid][RentedHouseID]);
            SetPlayerPos(playerid, HouseInfo[PlayerInfo[playerid][RentedHouseID]][ExitX], HouseInfo[PlayerInfo[playerid][RentedHouseID]][ExitY], HouseInfo[PlayerInfo[playerid][RentedHouseID]][ExitZ]);
            SetPlayerVirtualWorld(playerid, HouseInfo[PlayerInfo[playerid][RentedHouseID]][VWorld]);
            SetPlayerInterior(playerid, dini_Int(file, "InteriorID"));
            InHouse[playerid] = true;
        }
    }
The OnPlayerKeyStateChange callback:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_SECONDARY_ATTACK ) && !(oldkeys & KEY_SECONDARY_ATTACK ))
    {
        GetHouseID(playerid);
        if(HouseID != -1)
        {
            if(InHouse[playerid] == false)
            {
                format(file, sizeof(file), "Houses/House_%d.ini", HouseID);
                if(IsPlayerInRangeOfPoint(playerid, 0.5, dini_Float(file, "EnterX"), dini_Float(file, "EnterY"), dini_Float(file, "EnterZ")))
                {
                    SetPlayerPos(playerid, dini_Float(file, "ExitX"), dini_Float(file, "ExitY"), dini_Float(file, "ExitZ"));
                    SetPlayerVirtualWorld(playerid, HouseID);
                    SetPlayerInterior(playerid, dini_Int(file, "InteriorID"));
                    InHouse[playerid] = true;
                }
            }
            else
            {
                format(file, sizeof(file), "Houses/House_%d.ini", HouseID);
                if(!IsPlayerInRangeOfPoint(playerid, 0.5, dini_Float(file, "ExitX"), dini_Float(file, "ExitY"), dini_Float(file, "ExitZ"))) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not close to the house door.");
                SetPlayerPos(playerid, dini_Float(file, "EnterX"), dini_Float(file, "EnterY"), dini_Float(file, "EnterZ"));
                SetPlayerVirtualWorld(playerid, 0);
                SetPlayerInterior(playerid, 0);
                InHouse[playerid] = false;
            }
        }
    }
    return 1;
}
Any ideas why it does not get that I am in a house?

Thank you in advance.
Reply


Messages In This Thread
Does not understand that I am in an interior. - by Denying - 12.03.2013, 16:14
Re: Does not understand that I am in an interior. - by RajatPawar - 12.03.2013, 16:17
Re: Does not understand that I am in an interior. - by Djole1337 - 12.03.2013, 16:18
Re: Does not understand that I am in an interior. - by Denying - 12.03.2013, 16:21
Re: Does not understand that I am in an interior. - by Denying - 13.03.2013, 17:41

Forum Jump:


Users browsing this thread: 1 Guest(s)