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
#2

Isn't the path supposed to be folder\file and not folder/file? Or does it not matter?
Reply
#3

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Isn't the path supposed to be folder\file and not folder/file? Or does it not matter?
Nope.
Reply
#4

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Isn't the path supposed to be folder\file and not folder/file? Or does it not matter?
I guess it does not matter as Mr_DjolE said and because I am using this way in a few other parts in my script.
That's not the problem.

Thank you for trying to help!
Reply
#5

I found the problem. Thank you all for trying!
I used my GetHouseID stock and it only returns the house ID if you are outside it and at its icon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)