15.05.2014, 09:56
So I tried to fix a really annoying bug in my house system so I will explain it.
When you enter in house everything works perfect but when you exit it spawns you at last created house. I checked everything but I can't find why this happen.
When you enter in house everything works perfect but when you exit it spawns you at last created house. I checked everything but I can't find why this happen.
pawn Код:
for(new i = 1; i < sizeof(HouseInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,HouseInfo[i][hEnterX],HouseInfo[i][hEnterY],HouseInfo[i][hEnterZ]))
{
if(HouseInfo[i][hLock] == 1) return GameTextForPlayer(playerid, "~r~Locked", 3000, 6);
SetPlayerPos(playerid, HouseInfo[i][hExitX],HouseInfo[i][hExitY],HouseInfo[i][hExitZ]);
SetPlayerInterior(playerid, HouseInfo[i][hExitInt]);
SetPlayerVirtualWorld(playerid, i+HouseInfo[i][hExitVW]);
}
}
for(new i = 1; i < sizeof(HouseInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,HouseInfo[i][hExitX],HouseInfo[i][hExitY],HouseInfo[i][hExitZ]))
{
SetPlayerPos(playerid, HouseInfo[i][hEnterX],HouseInfo[i][hEnterY],HouseInfo[i][hEnterZ]);
SetPlayerInterior(playerid, 0);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, HouseInfo[i][hEnterVW]);
}
}