Problem with houses.
#9

Quote:
Originally Posted by kovac
Посмотреть сообщение
Try this m8

PHP код:
#define MAX_HOUSES 500
//Don't store information such as ID of entered house in player data enum, it has nothing to do with it. Instead, you can create a new variable:
// Top
new bool:IsInHouse[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{
    
bool:IsInHouse[playerid] = false;
    return 
1;
}
CMD:exit(playerid)
{
    for(new 
0MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.5HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
        {
            
SetPlayerPos(playeridHouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]);
            
SetPlayerFacingAngle(playeridHouseData[i][housePos][3] - 180.0);
            
SetPlayerVirtualWorld(playeridHouseData[i][houseExteriorVW]); // I don't know why you use this, you should have a default virtual world and reset it
            
SetCameraBehindPlayer(playerid);
            
IsInHouse[playerid] = false;
            break;
        }
    }
    return 
1;
}
CMD:enter(playerid)
{
    for(new 
0MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.5HouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2])
        {
            if(
HouseData[i][houseLocked]) return SendErrorMessage(playerid"You cannot enter a locked house.");
               
SetPlayerPos(playeridHouseData[i][houseInt][0], HouseData[i][houseInt][1], HouseData[i][houseInt][2]);
            
SetPlayerFacingAngle(playeridHouseData[i][houseInt][3]);
            
SetPlayerInterior(playeridHouseData[i][houseInterior]);
            
SetPlayerVirtualWorld(playeridi); // You can just use house id as virtual world, it won't mix with others
            
SetCameraBehindPlayer(playerid);
            
IsInHouse[playerid] = true;
            break;
        }
    }
    return 
1;

I'm using KEY_FIRE or w/e for that
Reply


Messages In This Thread
Problem with houses. - by MaestrulFritz - 16.04.2018, 18:01
Re: Problem with houses. - by jasperschellekens - 16.04.2018, 18:06
Re: Problem with houses. - by MaestrulFritz - 16.04.2018, 18:18
Re: Problem with houses. - by jasperschellekens - 16.04.2018, 18:22
Re: Problem with houses. - by MaestrulFritz - 16.04.2018, 18:28
Re: Problem with houses. - by jasperschellekens - 16.04.2018, 18:33
Re: Problem with houses. - by MaestrulFritz - 16.04.2018, 18:36
Re: Problem with houses. - by kovac - 16.04.2018, 18:41
Re: Problem with houses. - by MaestrulFritz - 16.04.2018, 18:47
Re: Problem with houses. - by MaestrulFritz - 16.04.2018, 18:51

Forum Jump:


Users browsing this thread: 1 Guest(s)