14.03.2017, 22:23
Replace OnPlayerEnterDynamicCP with this. Your code currently will only allow one interior to be used by all the houses loaded. You can perhaps use an array to store the details of possible interiors and then store the key into the file associated with each house.
PHP код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
for(new i = 0; i < MAX_HOUSES;i++)
{
if(checkpointid == HouseEnter[i])
{
new pName[24];
GetPlayerName(playerid,pName,24);
if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) == 0)
{
SetPVarInt(playerid,"PlayersInteriorHouse",GetPlayerInterior(playerid));
SetPVarInt(playerid,"PlayerVirtualWorldHouse",GetPlayerVirtualWorld(playerid));
SetPlayerInterior(playerid,2);// u can change this to the interior of ur house interior
SetPlayerPos(playerid,271.884979,306.631988,999.148437);// u can change the position of the interior
SetPlayerVirtualWorld(playerid,HInfo[i][VirtualWorld]);
PlayerInHouseID[playerid] = i;
}
if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName)!= 0)
{
SendClientMessage(playerid,-1,"You don't own this house");
}
if(HInfo[i][Owned] == 0)
{
SendClientMessage(playerid,-1,"/buy to buy this lovely house");
}
}
if(checkpointid == HouseExit[i])
{
SetPlayerPos(playerid,HInfo[i][XPos]+3,HInfo[i][YPos],HInfo[i][ZPos]);
SetPlayerInterior(playerid,GetPVarInt(playerid,"PlayersInteriorHouse"));
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid ,"PlayerVirtualWorldHouse"));
}
}
return 1;
}