I wrote a quick include after I posted to help handle doing this I think I got it all correct honestly I didn't even test it but it should work
You could also use Texture Studio to automatically swap buildings then export your map.
pawn Код:
// AddRemoveBuilding(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, groupid=-1, bool:hide=true)
// ShowRemoveBuilding(index)
// ShowAllRemoveBuilding()
// ShowRemoveBuildingGroup(groupid)
// HideRemoveBulding(index)
// HideAllRemoveBuilding()
// HideRemoveBuldingGroup(groupid)
#include <YSI\y_iterate>
#include <YSI\y_hooks>
#include <streamer>
#define MAX_REMOVED_BUILDINGS 1000
static Iterator:RemovedBuildings<MAX_REMOVED_BUILDINGS>;
enum RBINFO
{
RB_ObjectID,
RB_ModelID,
RB_GroupID,
bool:RB_Shown,
Float:RB_X,
Float:RB_Y,
Float:RB_Z,
Float:RB_RX,
Float:RB_RY,
Float:RB_RZ,
}
static RBData[MAX_REMOVED_BUILDINGS][RBINFO];
// Remove all buildings when a player connects
hook OnPlayerConnect(playerid)
{
foreach(new i : RemovedBuildings)
{
RemoveBuildingForPlayer(playerid, RBData[i][RB_ModelID], RBData[i][RB_X], RBData[i][RB_Y], RBData[i][RB_Z], 0.25);
}
return 1;
}
// Add a new remove building
stock AddRemoveBuilding(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, groupid=-1, bool:hide=true)
{
new index = Iter_Free(RemovedBuildings);
if(index > -1)
{
Iter_Add(RemovedBuildings, index);
RBData[index][RB_ModelID] = modelid;
RBData[index][RB_X] = x;
RBData[index][RB_Y] = y;
RBData[index][RB_Z] = z;
RBData[index][RB_RX] = rx;
RBData[index][RB_RY] = ry;
RBData[index][RB_RZ] = rz;
RBData[index][RB_Shown] = hide;
RBData[index][RB_GroupID] = groupid;
foreach(new i : Player)
{
RemoveBuildingForPlayer(i, modelid, x, y, z, 0.25);
}
if(!hide) RBData[index][RB_ObjectID] = CreateDynamicObject(modelid, x, y, z, rx, ry, rz, -1, -1, -1, 300.0, 300.0);
return index;
}
else
printf("Error::AddRemoveBuilding::Tried to remove too many buildings");
return 0;
}
// Show a specific building
stock ShowRemoveBuilding(index)
{
if(Iter_Contains(RemovedBuildings, index))
{
if(RBData[index][RB_Shown] == false)
{
RBData[index][RB_ObjectID] = CreateDynamicObject(RBData[index][RB_ModelID], RBData[index][RB_X], RBData[index][RB_Y], RBData[index][RB_Z], RBData[index][RB_RX], RBData[index][RB_RY], RBData[index][RB_RZ], -1, -1, -1, 300.0, 300.0);
RBData[index][RB_Shown] = true;
return 1;
}
printf("Error::ShowRemoveBuilding::Building is already shown::Index:%i", index);
return 0;
}
printf("Error::ShowRemoveBuilding::Index is invalid::Index:%i", index);
return 0;
}
// Show all removed buildings
stock ShowAllRemoveBuilding()
{
foreach(new i : RemovedBuildings)
{
if(RBData[i][RB_Shown] == false)
{
RBData[i][RB_ObjectID] = CreateDynamicObject(RBData[i][RB_ModelID], RBData[i][RB_X], RBData[i][RB_Y], RBData[i][RB_Z], RBData[i][RB_RX], RBData[i][RB_RY], RBData[i][RB_RZ], -1, -1, -1, 300.0, 300.0);
RBData[i][RB_Shown] = true;
}
}
return 1;
}
// Show only a group of remove buildings
stock ShowRemoveBuildingGroup(groupid)
{
foreach(new i : RemovedBuildings)
{
if(RBData[i][RB_Shown] == false && RBData[i][RB_GroupID] == groupid)
{
RBData[i][RB_ObjectID] = CreateDynamicObject(RBData[i][RB_ModelID], RBData[i][RB_X], RBData[i][RB_Y], RBData[i][RB_Z], RBData[i][RB_RX], RBData[i][RB_RY], RBData[i][RB_RZ], -1, -1, -1, 300.0, 300.0);
RBData[i][RB_Shown] = true;
}
}
return 1;
}
// Hide a specific building
stock HideRemoveBulding(index)
{
if(Iter_Contains(RemovedBuildings, index))
{
if(RBData[index][RB_Shown] == true)
{
DestroyDynamicObject(RBData[index][RB_ObjectID]);
RBData[index][RB_Shown] = false;
return 1;
}
printf("Error::HideRemoveBulding::Building is already hidden::Index:%i", index);
return 0;
}
printf("Error::HideRemoveBulding::Index is invalid::Index:%i", index);
return 0;
}
// Hide all removed buildings
stock HideAllRemoveBuilding()
{
foreach(new i : RemovedBuildings)
{
if(RBData[i][RB_Shown] == true BData[i][RB_GroupID] == groupid)
{
DestroyDynamicObject(RBData[i][RB_ObjectID]);
RBData[i][RB_Shown] = false;
}
}
return 1;
}
// Hide a group of removed buildings
stock HideRemoveBuldingGroup(groupid)
{
foreach(new i : RemovedBuildings)
{
if(RBData[i][RB_Shown] == true && )
{
DestroyDynamicObject(RBData[i][RB_ObjectID]);
RBData[i][RB_Shown] = false;
}
}
return 1;
}