I've been trying to find fix to this problem for few days now and I haven't found anything.
Here's the problem. I have this function which should create three objects and attach two of them to the first object.
CreateBillboard(2, 2048.7175,1360.0249,10.6719,5.0234); // this is called under OnGgameModeInit
stock CreateBillboard(Type, Float:X, Float:Y, Float:Z, Float:rZ) // function located in an include file
{
new id = -1;
for(new i; i<MAX_BILLBOARDS; i++)
{
if(Board[i][Created] == false)
{
id = i;
break;
}
}
// billboard
Board[id][Object][0] = CreateDynamicObject(1260, X, Y, Z, 0.0, 0.0, 0.0);
// black background 1
Board[id][Object][1] = CreateDynamicObject(7901, X + 0.3, Y - 0.1, Z + 5.6, 0.0, 0.0, 270.0);
SetDynamicObjectMaterialText(Board[id][Object][1], 0, "Your ad \ncan be here", 50, "Arial", 11, 1, 0xFFFF8200, 0xFF000000, 1);
AttachDynamicObjectToObject(Board[id][Object][1], Board[id][Object][0], 0.3, -0.1, 5.6, 0.0, 0.0, 270.0, true);
// black background 2
Board[id][Object][2] = CreateDynamicObject(7901, X + 0.7, Y - 0.1, Z + 5.6, 0.0, 0.0, 90.0);
SetDynamicObjectMaterialText(Board[id][Object][2], 0, "Your ad \ncan be here", 50, "Arial", 11, 1, 0xFFFF8200, 0xFF000000, 1);
AttachDynamicObjectToObject(Board[id][Object][2], Board[id][Object][0], 0.7, -0.1, 5.6, 0.0, 0.0, 90.0, true); // <---- this is the line which caused the crash
// after setting all the coordinates, I'm just rotating the object with the correct offsets of the last two objects
SetDynamicObjectRot(Board[id][Object][0], 0.0, 0.0, rZ);
When I compile the gamemode, everything is alright. No errors or warnings.
That location is set around 20-30 meters from the spawn location and when I spawn and the objects begin to stream, my server crashes without any messages from crash detect or under OnPluginError.
But when I set the location to, let's say, few kilometers from the spawning location, objects doesn't get streamed and server doesn't crash.
I'm not sure if I gave you enough information about the problem so feel free to ask me for anything to post here and I'll do it. Cheers!