House id[+REP][MYSQL]
#1

Solved
Reply
#2

Quote:

else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt])) //enter house!
{
SetPlayerPos(playerid,HouseInfo[hid][XExit],HouseInfo[hid][YExit],HouseInfo[hid][ZExit]);
SetPlayerInterior(playerid,HouseInfo[hid][HInterior]);
SetPlayerVirtualWorld(playerid,HouseInfo[hid][HVirtualWorld]);
}
else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XExit],HouseInfo[hid][YExit],HouseInfo[hid][ZExit])) //exit house
{
SetPlayerPos(playerid,HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt]);
SetPlayerDefaultWorld(playerid);
}

Can you tell me what is the value of hid and how do you get it?
Reply
#3

I realised that the problem is that it can't enter the houses at all after changing and setting somehow value to House id
Here it is
PHP код:
new hid GetHouseID(playerid); 
Gethouseid function
PHP код:
stock GetHouseID(playerid)
{
    for(new 
i=0i<MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit]))
        {
            return 
i;
        }
    }
    return 
INVALID_HOUSE_ID;

I tried to exit from 2 different houses and it spawns me correctly at the enter coords of each house.. I Can't enter it though
Reply
#4

Because GetHouseID is checking only if he is near the exit.

PHP код:
stock GetHouseID(playerid)
{
    for(new 
i=0i<MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit]) || IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XEnt], HouseInfo[i][YEnt], HouseInfo[i][ZEnt]))
        {
            return 
i;
        }
    }
    return 
INVALID_HOUSE_ID;

Another way:

PHP код:
stock GetHouseID(playerid)
{
    for(new 
i=0i<MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit]))
        {
            return 
i;
        }
        else if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XEnt], HouseInfo[i][YEnt], HouseInfo[i][ZEnt]))
        {
             return 
i;
        }
    }
    return 
INVALID_HOUSE_ID;

Reply
#5

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
Because GetHouseID is checking only if he is near the exit.

PHP код:
stock GetHouseID(playerid)
{
    for(new 
i=0i<MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit]) || IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XEnt], HouseInfo[i][YEnt], HouseInfo[i][ZEnt]))
        {
            return 
i;
        }
    }
    return 
INVALID_HOUSE_ID;

Another way:

PHP код:
stock GetHouseID(playerid)
{
    for(new 
i=0i<MAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit]))
        {
            return 
i;
        }
        else if(
IsPlayerInRangeOfPoint(playerid1HouseInfo[i][XEnt], HouseInfo[i][YEnt], HouseInfo[i][ZEnt]))
        {
             return 
i;
        }
    }
    return 
INVALID_HOUSE_ID;

Solved
Thank you friend +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)