SetObjectMaterial with objects with the same modelid - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetObjectMaterial with objects with the same modelid (
/showthread.php?tid=332485)
SetObjectMaterial with objects with the same modelid -
Baboon - 08.04.2012
Hey guys,
Is there any way to set the object material to EVERY object which has the same modelid?
So that you wont have to use arrays or simple variables for each object you create?
Thanks.
Re: SetObjectMaterial with objects with the same modelid -
Kar - 08.04.2012
loop?
Re: SetObjectMaterial with objects with the same modelid -
Baboon - 08.04.2012
But there is no way to get the objectid of objects. Sure you can do stuff like:
for(new o = 0; o < MAX_OBJECTS; o++)
But that would just get every object, but not the id if I am correct, cus there is nothing like GetObjectID(); unlike GetPlayerVehicleID(
Re: SetObjectMaterial with objects with the same modelid -
alex9419 - 08.04.2012
It's not that hard to store the information about the object in variables, using the ID that's produced when you call Create(Dynamic)Object.
PHP код:
enum objectData
{
objectModel //, whatever else you want
}
new ObjectData[MAX_OBJECTS][objectData];
// Farther down the script, where you spawn your objects.
stock CreateObjectEx(blablabla, model, blablabla)
{
new oID = CreateObject(blabla); ObjectData[oID][objectModel] = model;
}
Or something. You'll think of a good way.
Re: SetObjectMaterial with objects with the same modelid -
Kar - 08.04.2012
pawn Код:
stock CreateObjectEx(blablabla, model, blablabla)
{
switch(model)
{
}
}
Re: SetObjectMaterial with objects with the same modelid -
Baboon - 08.04.2012
thnx guys,
but thats not really what I wanted..
I found a way myself.