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 cant enter the house since it's not yours!");
EnterHouse(playerid,hid);
}
|
How to restrict player to enter house if it is not his own?
What i am using now is doing vice versa and i don't know why. I want to check if houseownerid is the same as playerid(from table accounts) so i am using the same variables is there other way i can do it? PHP код:
|
if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID] || HouseInfo[hid][HOwned] == 1)
if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID])
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 cant enter the house since it's not yours!");
EnterHouse(playerid,hid);
}
else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[hid][XEnt],HouseInfo[hid][YEnt],HouseInfo[hid][ZEnt])) //enter house!
{
if(pinfo[playerid][ID] != HouseInfo[hid][HOwnerID])
{
if(HouseInfo[hid][HOwned]) == 1)
{
SendClientMessage(playerid, -1, ""COL_RED"SERVER"COL_WHITE":You cant enter the house since it's not yours!");
}
}
else
{
if(HouseInfo[hid][HOwned]) == 1)
{
EnterHouse(playerid,hid);
}
}
}
|
print them maybe ? work is simple and works for sure, you aren't saving ownerid right I guess.
|
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 cant enter the house since it's not yours!");
EnterHouse(playerid,hid);
}
printf("%d %d",HouseInfo[hid][HOwnerID] && HouseInfo[hid][HOwned]);
|
PHP код:
cause you were inserting string into int I think you were bugging all house enum saves, try to print house id on the command PHP код:
|