pawn Код:
//Above main
new bool:ScriptObject[MAX_OBJECTS];
//At OnFilterScriptInit
DestroyScriptObjects();
CreateScriptObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); //This does same thing as CreateObject and are the same params etc.
//At OnFilterScriptExit
DestroyScriptObjects();
//Somewhere in script
stock CreateScriptObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
{
Snew objectid = CreateObject(modelid, X, Y, Z, rX, rY, rZ);
ScriptObject[objectid] = true;
}
stock DestroyScriptObjects()
{
for(new o=0; o<sizeof(ScriptObject); o++)
{
if(ScriptObject[o])
{
DestroyObject(o);
ScriptObject[o]=false;
}
}
}
Use "CreateScriptObject" function instead of CreateObject.