PlayerExitHouse(playerid, houseid)
{
SetPlayerVirtualWorld(playerid, FREEROAM_WORLD);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, HouseData[houseid][h_DoorX], HouseData[houseid][h_DoorY], HouseData[houseid][h_DoorZ]);
CurrentHouse[playerid]=-1;
InsideHouse[playerid]=-1;
}
Save cordinates outside of house in house file and when player want to exit from house teleport him to cordinates that u saved
![]() |
new house1Ent, house1Exit;
new house2Ent, house2Exit;
CMD:createhouse(playerid, params[])
{
new interior, type[16];
new Float:x, Float:y, Float:z;
if(sscanf(params, "is[16]", interior, type))
if(interior > 7) SendClientMessage(playerid, -1, "Invaild Interior ID");
GetPlayerPos(playerid, x, y, z);
if(!strcmp(type, "enter", true))
{
if(interior == 1)
{
house1Ent = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
}
else if(interior == 2)
{
house2Ent = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
}
}
if(!strcmp(type, "exit", true))
{
if(interior == 1)
{
house1Exit = CreateDynamicCP(234.1368,1063.7231,1084.2123,2.0,GetPlayerVirtualWorld(playerid),-1,-1,100.0);
}
else if(interior == 2)
{
house2Exit = CreateDynamicCP(225.7605,1021.4443,1084.0177,2.0,GetPlayerVirtualWorld(playerid),-1,-1,100.0);
}
}
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == house1Ent)
{
SetPlayerInterior(playerid,6);
SetPlayerPos(playerid,234.1586,1066.9490,1084.2075);
}
else if(checkpointid == house2Ent)
{
SetPlayerInterior(playerid,7);
SetPlayerPos(playerid,225.8389,1025.0447,1084.0078);
}
else if(checkpointid == house1Exit)
{
SetPlayerPos(playerid,272.884979,306.631988,999.148437);
}
else if(checkpointid == house2Exit)
{
SetPlayerPos(playerid,1526.229980,-11.574499,1002.097106);
}
return 1;
}
hmm tp the player to the dynamic pick up's coordinates when he leave this will reduce work |
hmm tp the player to the dynamic pick up's coordinates when he leave this will reduce work
|
else if(checkpointid == house1Exit)
{
SetPlayerPos(playerid,272.884979,306.631988,999.148437); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}