SetObjectMaterial and usage of arrays.
#1

pawn Код:
new MapArray[7];

new v = 0;
MapArray[v++] = CreateDynamicObject(19531,0,0,0,0.000,0.000,0.000,-1,-1,-1,80.000,80.000);
SetDynamicObjectMaterial(MapArray[v], 0, 4, "texture", "name", 0);
MapArray[v++] = CreateDynamicObject(19377,0.110,0.386,-70.515,0.000,0.000,0.000,-1,-1,-1,80.000,80.000);
SetDynamicObjectMaterial(MapArray[v], 0, 0, "texture", "name", 0);
MapArray[v++] = CreateDynamicObject(19377,0.110,0.760,-70.515,0.000,0.000,0.000,-1,-1,-1,80.000,80.000);
SetDynamicObjectMaterial(MapArray[v], 0, 0, "texture", "name", 0);
MapArray[v++] = CreateDynamicObject(19377,0.110,0.599,-70.515,0.000,0.000,0.000,-1,-1,-1,80.000,80.000);
SetDynamicObjectMaterial(MapArray[v], 0, 0, "texture", "name", 0);
MapArray[v++] = CreateDynamicObject(19377,0.277,0.033,-70.515,0.000,0.000,90.000,-1,-1,-1,80.000,80.000);
SetDynamicObjectMaterial(MapArray[v], 0, 1, "texture", "name", -12303292);
MapArray[v++] = CreateDynamicObject(19377,0.471,0.900,-70.515,0.000,0.000,90.000,-1,-1,-1,80.000,80.000);
SetDynamicObjectMaterial(MapArray[v], 0, 0, "texture", "name", 0);
So instead of using
MapArray[0] = CreateDynamicObject
and then
SetObjectMaterial(MapArray[0],.....);

I decided to do it this way.

But the textures are not updating, any idea why?

** Ignore coordinates, model ids, those are just placeholders, I don't want to show my original map.
Reply
#2

Because you're trying to update the texture of an object that doesn't exist. Directly after the CreateDynamicObject line, v gets incremented. It should be incremented only after the textures have been applied.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)