i tired make my script dynamic house and now have smail problems.
PHP код:
new house1Ent, house1Exit;
new house2Ent, house2Exit;
new house3Ent, house3Exit;
new house4Ent, house4Exit;
new house5Ent, house5Exit;
new house6Ent, house6Exit;
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(interior == 3)
{
house3Ent = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
}
if(interior == 4)
{
house4Ent = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
}
if(interior == 5)
{
house5Ent = CreateDynamicCP(x, y, z, 2.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
}
if(interior == 6)
{
house6Ent = 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);
}
else if(interior == 3)
{
house3Exit = CreateDynamicCP(140.2828,1365.9211,1083.8594,2.0,GetPlayerVirtualWorld(playerid),-1,-1,100.0);
}
else if(interior == 4)
{
house4Exit = CreateDynamicCP(2324.4011,-1149.5393,1050.7101,2.0,GetPlayerVirtualWorld(playerid),-1,-1,100.0);
}
else if(interior == 5)
{
house5Exit = CreateDynamicCP(491.1555,1398.5007,1080.2578,2.0,GetPlayerVirtualWorld(playerid),-1,-1,100.0);
}
else if(interior == 6)
{
house6Exit = CreateDynamicCP(2317.8250,-1026.7659,1050.2178,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);
}
if(checkpointid == house3Ent)
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,140.2494,1369.8427,1083.8650);
}
if(checkpointid == house4Ent)
{
SetPlayerInterior(playerid,12);
SetPlayerPos(playerid,2324.3672,-1145.9575,1050.7101);
}
if(checkpointid == house5Ent)
{
SetPlayerInterior(playerid,2);
SetPlayerPos(playerid,491.2881,1400.8329,1080.2645);
}
if(checkpointid == house6Ent)
{
SetPlayerInterior(playerid,9);
SetPlayerPos(playerid,2317.3748,-1023.6965,1050.2109);
}
else if(checkpointid == house1Exit)
{
SetPlayerPos(playerid,272.884979,306.631988,999.148437);
}
else if(checkpointid == house2Exit)
{
SetPlayerPos(playerid,1526.229980,-11.574499,1002.097106);
}
else if(checkpointid == house3Exit)
{
SetPlayerPos(playerid,1526.229980,-11.574499,1002.097106);
}
else if(checkpointid == house4Exit)
{
SetPlayerPos(playerid,1526.229980,-11.574499,1002.097106);
}
else if(checkpointid == house5Exit)
{
SetPlayerPos(playerid,1526.229980,-11.574499,1002.097106);
}
else if(checkpointid == house6Exit)
{
SetPlayerPos(playerid,1526.229980,-11.574499,1002.097106);
}
return 1;
}
This is not dynamic, and the way you're doing it, is wrong. Dynamic system means you can manage things (like create, delete or edit) on run-time.
First thing you might need to understand or learn in order to make a dynamic house system is saving system (ex. INI or MySQL) for you to save created house data, so you can load them and don't need to recreate them after server restart.