I was in the works with a new house system, and I wanted to make a /lockhouse command. But I wanted to make it work not only from the inside but the outside as well. But, for some reason it only worked on the inside. So I made this command and now it doesn't even work at all. I want it to work if you own the house, and are inside. or if you own the house and you are on the outside. Could someone take a look and let me know what I'm doing wrong please?
Код:
CMD:lockhouse(playerid, params[])
{
new HouseID;
if (INT_IsPlayerLoggedIn(playerid) == 0) return 0;
if (GetPlayerVehicleSeat(playerid) == -1)
{
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
if (IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, AHouseData[HouseID][HouseX],AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
if (AHouseData[HouseID][HouseOpened] == false)
{
if (House_PlayerIsOwner(playerid, HouseID) == 1)
{
AHouseData[HouseID][HouseOpened] = true;
SetTimer("unmessage", 1000, false);
return 1;
}
}
AHouseData[HouseID][HouseOpened] = false;
SetTimer("message", 1000, false);
}
}
else if (!IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
{
if (!IsPlayerInRangeOfPoint(playerid, 1.0, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
if (AHouseData[HouseID][HouseOpened] == false)
{
if (House_PlayerIsOwner(playerid, HouseID) == 1)
{
AHouseData[HouseID][HouseOpened] = true;
SetTimer("unmessage", 1000, false);
return 1;
}
}
AHouseData[HouseID][HouseOpened] = false;
SetTimer("message", 1000, false);
}
}
}
}
return 0;
}