Need a shortcut for this...
#1

Hey guys, I'm working on a map which needs a lot of retexturing, about 10x of this;

Код:
new obj1 = CreateDynamicObject(1937, 116.01868, -176.79443, 14.21660,   0.00000, 0.00000, 90.00000);
new obj2 = CreateDynamicObject(1949, 1928.37769, -170.45520, 14.21660,   0.00000, 0.00000, 0.00000);
new obj3 = CreateDynamicObject(1944, 119.32312, -175.06409, 12.15660,   0.00000, 0.00000, 90.00000);
new obj4 = CreateDynamicObject(1937, 16.01868, -16.79443, 1.21660,   0.00000, 0.00000, 90.00000);
new obj5 = CreateDynamicObject(1949, 198.37769, -10.45520, 1.21660,   0.00000, 0.00000, 0.00000);
new obj6 = CreateDynamicObject(1944, 19.32312, -17.06409, 1.15660,   0.00000, 0.00000, 90.00000);

SetObjectMaterial(obj1, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
SetObjectMaterial(obj2, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
SetObjectMaterial(obj3, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
SetObjectMaterial(obj4, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
SetObjectMaterial(obj5, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
SetObjectMaterial(obj6, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
I don't know much about scripting. Can someone teach me a way around this torture? Is there a way to avoid having to enter a setobjectmaterial for each and ever object? I'm talking about something like this;

Код:
store (orwtfevernativefunction) myobjects;
{
CreateDynamicObject(1937, 116.01868, -176.79443, 14.21660,   0.00000, 0.00000, 90.00000);
CreateDynamicObject(1949, 1928.37769, -170.45520, 14.21660,   0.00000, 0.00000, 0.00000);
CreateDynamicObject(1944, 119.32312, -175.06409, 12.15660,   0.00000, 0.00000, 90.00000);
CreateDynamicObject(1937, 16.01868, -16.79443, 1.21660,   0.00000, 0.00000, 90.00000);
CreateDynamicObject(1949, 198.37769, -10.45520, 1.21660,   0.00000, 0.00000, 0.00000);
CreateDynamicObject(1944, 19.32312, -17.06409, 1.15660,   0.00000, 0.00000, 90.00000);
}

SetObjectMaterial(myobjects, 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
Reply
#2

EDIT: Or you can use a loop instead:

pawn Код:
new obj[6];

obj[0] = CreateDynamicObject(1937, 116.01868, -176.79443, 14.21660,   0.00000, 0.00000, 90.00000);
obj[1] = CreateDynamicObject(1949, 1928.37769, -170.45520, 14.21660,   0.00000, 0.00000, 0.00000);
obj[2] = CreateDynamicObject(1944, 119.32312, -175.06409, 12.15660,   0.00000, 0.00000, 90.00000);
obj[3] = CreateDynamicObject(1937, 16.01868, -16.79443, 1.21660,   0.00000, 0.00000, 90.00000);
obj[4] = CreateDynamicObject(1949, 198.37769, -10.45520, 1.21660,   0.00000, 0.00000, 0.00000);
obj[5] = CreateDynamicObject(1944, 19.32312, -17.06409, 1.15660,   0.00000, 0.00000, 90.00000);

for(new i; i < sizeof(obj); i ++)
{
    SetObjectMaterial(obj[i], 0, 18237, "cuntwbtzzcs_t", "corugwallnew6_128", 0);
}
Reply
#3

Yep. Thank you mate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)