SetDynamicObjectMaterialText
#1

Hi,

When i SetDynamicObjectMaterialText, i could get was was object material? i mean GetDynamicObjectMaterial?

I mean i want to SetDynamicObjectMaterial to previous, it's like edit house textures, furniture. Too it's can set object material text, but i also want to need to know, because when i disable text i need to restore texture which was. I could do that with variables but if take a lot if bites, like

new StoreDobjectModel[ MAX_STREAMED_OBJECTS ][ 17 ];

I have to for all streamed object and for all slots 17, save object material text, but there is much more bites if i need to save texture name
Reply
#2

I think i don't understand. You want to save object material before applying materialtext on it, am i right?
Reply
#3

Or i notice when i use setdynamicobjectmaterial, i write modelid 0, texture, txt names "" (empty) and i just change color, but no color..
Reply
#4

So it will be better to save it to database than array, because that method with MAX_STREAMED_OBJECTS will not work (that array can't handle id's over MAX_STREAMED_OBJECTS). Only array for MAX_OBJECTS.

Anyway, if you don't wanna use database, you can store it in one array like Object[oid][object_material] where object_material is string with 100 lenght and oid is MAX_OBJECTS based object id.

Usage:

Format all variables(index, color, model, txd names) to one string with ":". This string name will be data[100] in my example. Format it like that:

Код:
format(data, sizeof(data), "%d:%06x:%d:%s:%s", index, color, etc...)
Then apply "data" to your array "Object[oid][object_material], and now you can restore it this way:

Код:
sscanf(Object[oid][object_material], "ds[16]ds[32]s[32]", index, color, mmodel, txd_name, texture_name);
SetDynamicObjectMaterial(index, color, model etc...);
If you want to change color only, try to use existing modelid and fake txt names.
Reply
#5

I want smth simplier, like when i setdynamicobjectmaterialtext, i want that with GetDynamicObjectMaterial, i could get what material was
Reply
#6

You can't get material by samp function without using arrays if you apply materialtext on the same index.
1 index = material OR materialtext, not both.
Reply
#7

Hm.. Because now i use just setplayerdynamicmaterial, just change color, so i know what was model,texture and so on.. But i want to make all object with that color, so if i write model id -1, so if i getdynamicobjectmaterial, modelid i will get -1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)