else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt])) //enter house!
{
if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) return SendClientMessage(playerid,-1,""COL_RED"SERVER"COL_WHITE":You can't enter the house since it's not yours");
if(pinfo[playerid][ID] == HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1)
{
EnterHouse(playerid,hid);
}
}
function EnterHouse(playerid,houseid)
{
SetPlayerPos(playerid,HouseInfo[houseid][XExit],HouseInfo[houseid][YExit],HouseInfo[houseid][ZExit]);
SetPlayerInterior(playerid,HouseInfo[houseid][HInterior]);
SetPlayerVirtualWorld(playerid,HouseInfo[houseid][HVirtualWorld]);
Loading(playerid);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt])) //enter house! { print("1"); if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) return SendClientMessage(playerid,-1,""COL_RED"SERVER"COL_WHITE":You can't enter the house since it's not yours"); print("2"); if(pinfo[playerid][ID] == HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) { print("3"); EnterHouse(playerid,hid); } }
else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt])) //enter house!
{
printf(Player House ID: %d, House OwnerID: %d",pinfo[playerid][ID],HouseInfo[hid][HOwnerID]);
if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) return SendClientMessage(playerid,-1,""COL_RED"SERVER"COL_WHITE":You can't enter the house since it's not yours");
if(pinfo[playerid][ID] == HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1)
{
EnterHouse(playerid,hid);
}
}
function EnterHouse(playerid,houseid)
{
SetPlayerPos(playerid,HouseInfo[houseid][XExit],HouseInfo[houseid][YExit],HouseInfo[houseid][ZExit]);
printf("%f, %f, %f",HouseInfo[houseid][XExit],HouseInfo[houseid][YExit],HouseInfo[houseid][ZExit]);
SetPlayerInterior(playerid,HouseInfo[houseid][HInterior]);
SetPlayerVirtualWorld(playerid,HouseInfo[houseid][HVirtualWorld]);
Loading(playerid);
return 1;
}
First, find where the prob is:
Код:
else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt])) //enter house! { print("1"); if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) return SendClientMessage(playerid,-1,""COL_RED"SERVER"COL_WHITE":You can't enter the house since it's not yours"); print("2"); if(pinfo[playerid][ID] == HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) { print("3"); EnterHouse(playerid,hid); } } |
print your house info & player info to see if they're loaded right,
PHP код:
PHP код:
|
So this was suppose to help me?
I don't think the problem is related to the variables but i think it needs somehow a loop So i printed and realised that on the 2nd house it doesnt even print when i am in range of it and press f button |
stock GetHouseID(playerid)
{
for(new i=1; i<MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit]))
{
return i;
}
else if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[i][XEnt], HouseInfo[i][YEnt], HouseInfo[i][ZEnt]))
{
return i;
}
}
return INVALID_HOUSE_ID;
}
else if(hid != INVALID_HOUSE_ID)) //enter house!
{
if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1) return SendClientMessage(playerid,-1,""COL_RED"SERVER"COL_WHITE":You can't enter the house since it's not yours");
if(pinfo[playerid][ID] == HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned] == 1)
{
EnterHouse(playerid,hid);
}
} else return SendClienMessage(playerid,-1,"You're not near any house");
Sorry for all this but had to mention that it happens vice versa it enters to house id 2 but not at houseid 1
anyway i did what you tell me and i noticed that when i go at house id 1 again i can't enter and says you are not near any house but at house id 2 i can |
stock GetHouseID(playerid) { for(new i=0; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[i][XExit], HouseInfo[i][YExit], HouseInfo[i][ZExit])) { return i; } else if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[i][XEnt], HouseInfo[i][YEnt], HouseInfo[i][ZEnt])) { return i; } } return INVALID_HOUSE_ID; }