szekelymilan Posted November 5, 2016 Share Posted November 5, 2016 Hi guys! I have a big problem on my server with road signs. I want to add 192 road signs (custom objects) to my server, but when I wrote an unknown Object ID, it wasn't working. THE SCRIPT: addEventHandler('onClientResourceStart', resourceRoot, function() local txd = engineLoadTXD('files/kresz_es01.txd',true) engineImportTXD(txd, 19998) local dff = engineLoadDFF('files/kresz_es01.dff', 0) engineReplaceModel(dff, 19998) engineSetModelLODDistance(19998, 500) end ) It's a very simple script. I tried to change that id (19998) to a wire's id, and it was working, I was seeing it, but it's a big object by the server, and I couldn't move it a bit. I have only TXD and DFF files, beacuse I downloaded an .img file for SA-MP and with an .img extractor, I extracted the files. (https://sampforum.hu/index.php?topic=32525.0) <- it says the object ids are 19808 -> 19999. I know, there are tables in the editor, but there aren't 192 tables/road signs (only 8). So please help me! Can I create a new ID for objects? Thanks, MakroBox And sorry for my bad English! Bye! Link to comment
Walid Posted November 5, 2016 Share Posted November 5, 2016 11 minutes ago, MakroBox said: Can I add a custom object without replacing an object? No you can't. Link to comment
szekelymilan Posted November 5, 2016 Author Share Posted November 5, 2016 8 minutes ago, Walid said: No you can't. But... Go to a Hungarian Roleplay server. (like SeeMTA or ExternalGamkng) They can solve this... But in the GTA... there are only 8 objects is same sized with my road signs... Link to comment
Walid Posted November 5, 2016 Share Posted November 5, 2016 9 minutes ago, MakroBox said: But... Go to a Hungarian Roleplay server. (like SeeMTA or ExternalGamkng) They can solve this... But in the GTA... there are only 8 objects is same sized with my road signs... Just change the object texture that's all. Link to comment
szekelymilan Posted November 5, 2016 Author Share Posted November 5, 2016 8 hours ago, Walid said: Just change the object texture that's all. You don't understand. "the object": Can you send me a WORKING ID? My problem: I change an object's texture, but if I changing a big object's texture I can't move it, only the size of the object (if my sign has 1 meter width and the object's 10 meter, i can move it only by 10 meters.) And there's only max. 20 goodsized object! Only 20, for 192 road signs. How can I do that? Please! Help me. Link to comment
Walid Posted November 5, 2016 Share Posted November 5, 2016 I'm not talking about the TXD file, you don't need to replace 192 object , just replace only one object (maybe you need 2 objects depending on the signs ( triangle and circle)) then use: (dxCreateShader, dxCreateTexture, dxSetShaderValue, engineApplyShaderToWorldTexture), to change the signs texture. I'm pretty sure, you don't undrestand what i'm talking about. Link to comment
szekelymilan Posted November 5, 2016 Author Share Posted November 5, 2016 47 minutes ago, Walid said: I'm not talking about the TXD file, you don't need to replace 192 object , just replace only one object (maybe you need 2 objects depending on the signs ( triangle and circle)) then use: (dxCreateShader, dxCreateTexture, dxSetShaderValue, engineApplyShaderToWorldTexture), to change the signs texture. I'm pretty sure, you don't undrestand what i'm talking about. Oh. I have 7 different DFF files (triangle up, triangle down, circle, etc.) And the TXD is the texture... Can you send me a script, please, of your idea? And in your idea... is TXD the trinagle up and etc. files and is the DFF the textures? Or what? And that's nice... you're amazing! Thanks, MakroBox Link to comment
HeySlickThatsMe Posted November 5, 2016 Share Posted November 5, 2016 they use shaders to apply different texture to an ONE model model can replace anything that is unused (Eg: unused brothel interiors or something) 1 Link to comment
Walid Posted November 5, 2016 Share Posted November 5, 2016 30 minutes ago, MakroBox said: Can you send me a script, please, of your idea? No try to do it by yourself then post your code here. here is an example with the same object ID: 1323 Before (Default texture) After ( the same object ID with different textures) 1 Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 10 hours ago, Walid said: No try to do it by yourself then post your code here. here is an example with the same object ID: 1323 Before (Default texture) After ( the same object ID with different textures) Okay, I make the object afternoon, thanks for the help! I'm goin' to the Wiki now, to understand your "commands". (sry for bad English :D) Thanks, MakroBox 10 hours ago, ThatsMe said: they use shaders to apply different texture to an ONE model model can replace anything that is unused (Eg: unused brothel interiors or something) No! If I replace an interior... the road sign is okay (at the client), but by the server's idea it's a big object, and I can't move it, etc. I have to replace it to a road sign (beacuse I want a road sign)... Like 1323 OBJECT ID... See Walid's comment. Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 (edited) 10 hours ago, Walid said: No try to do it by yourself then post your code here. here is an example with the same object ID: 1323 Before (Default texture) After ( the same object ID with different textures) I can't... Sorry. I don't know what is shader in MTA. I'm using Google about 30 minutes ago, but there aren't any good description... And have I to use the WorldTexture "command"? Beacuse I don't want to change a world texture... (I think, the world texture is the world objects' texture. And the texture is the objects' texture. But if not, correct me.) I'm a basic scripter... very basic. But, I wrote a nice bank system, but this... I can't. Thanks, MakroBox EDIT: .fx file??? How can I create it? EDIT2: Is it a programming language? Oh my god.... Edited November 6, 2016 by MakroBox Link to comment
Walid Posted November 6, 2016 Share Posted November 6, 2016 Here is the fx file //-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture ) texture Tex0; technique simple { pass P0 { //-- Set up texture stage 0 Texture[0] = Tex0; //-- Leave the rest of the states to the default settings } } Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 34 minutes ago, Walid said: Here is the fx file //-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture ) texture Tex0; technique simple { pass P0 { //-- Set up texture stage 0 Texture[0] = Tex0; //-- Leave the rest of the states to the default settings } } Oh, it's okay, but I only need one fx file? I think I need 2 or more fx file, to change the texture. I'm leading off the script. Link to comment
Walid Posted November 6, 2016 Share Posted November 6, 2016 21 minutes ago, MakroBox said: Oh, it's okay, but I only need one fx file? I think I need 2 or more fx file, to change the texture. I'm leading off the script. Why you need two fx (shader) files ??? Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 56 minutes ago, Walid said: Why you need two fx (shader) files ??? Do I need? I think I need, beacuse one shader for the first texture and one more shader for the second texture. Or not? Help me, please! Link to comment
Walid Posted November 6, 2016 Share Posted November 6, 2016 Just now, MakroBox said: Do I need? I think I need, beacuse one shader for the first texture and one more shader for the second texture. Or not? Help me, please! lol you can use the same shader with multiple textures. Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 Just now, Walid said: lol you can use the same shader with multiple textures. Okay... but. Why do I need shader? What it does? Why? Link to comment
Walid Posted November 6, 2016 Share Posted November 6, 2016 1 minute ago, MakroBox said: Okay... but. Why do I need shader? What it does? Why? Read this : Shader Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 2 minutes ago, Walid said: Read this : Shader Oh, thanks!! And you copied the .fx file from here. Link to comment
Walid Posted November 6, 2016 Share Posted November 6, 2016 1 minute ago, MakroBox said: Oh, thanks!! And you copied the .fx file from here. Ofc if you want to replace world textures with engineApplyShaderToWaorldTexture you need to use it. Link to comment
szekelymilan Posted November 6, 2016 Author Share Posted November 6, 2016 This is my script... I think it's bad, but. I can make that... addEventHandler('onClientResourceStart', resourceRoot, function() local dff = engineLoadDFF('files/kresz01.dff', 0) engineReplaceModel(dff, 1323) engineSetModelLODDistance(1323, 500) local myShader = dxCreateShader('files/shader.fx') end ) function first() local txd = engineLoadTXD('files/kresz_es01.txd') dxSetShaderValue( myShader, "1323", txd ) end function second() local txd = engineLoadTXD('files/kresz_es02.txd') dxSetShaderValue( myShader, "1323", txd ) end addCommandHandler ( "kresz011", first ) addCommandHandler ( "kresz012", second ) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now