BrokenPixel Posted June 29, 2012 Share Posted June 29, 2012 (edited) Hey people, me and a friend are running a small fun server. We have a "big" Problem. I Designed a new T-Shirt (txd) and we wanted to have it in the Server. Is it possible? I would like to change the tshirtwhite.txd (in players.img*) to my own .txd It would be really helpful if you could give me a .LUA file. Thank you in advice! Edited June 29, 2012 by Guest Link to comment
qaisjp Posted June 29, 2012 Share Posted June 29, 2012 You mean players.img I don't know whether this is possible as of now, because afaik and iirc the engine functions only work for gta3.img modifications. Link to comment
BrokenPixel Posted June 29, 2012 Author Share Posted June 29, 2012 hmm okay, well, shouldnt it be possible with something like a "load" function? Link to comment
qaisjp Posted June 29, 2012 Share Posted June 29, 2012 well maybe on the engine functions something like "image file" = "player" Link to comment
BrokenPixel Posted June 29, 2012 Author Share Posted June 29, 2012 is it possible that you could try out something like that? im a total noob in lua, maybe you can help me? Link to comment
50p Posted June 29, 2012 Share Posted June 29, 2012 Shader is a helper in this case but then you don't need .txd but a .png or .dds https://wiki.multitheftauto.com/wiki/Shader_examples - check "shader_tex_names" and use it to get the name of the tshirt you want to replace (you probably know its original name from .txd so it will save you time) This is a simple shader which replaces in-game texture with your image file (eg .png, NOT .txd) texture gTexture; technique replace { pass P0 { Texture[0] = gTexture; } } All you need to script is: txd = dxCreateTexture( "your_texture.png" ); if not txd then txd = nil; -- it's best to nil a variable because it'll waste unnecessary memory return false; end shader = dxCreateShader( "shader_file.fx" ); -- the content of this file should be what I included above if not shader then destroyElement( txd ); txd = nil; return false; end dxSetShaderValue( shader, "gTexture", txd ); -- gTexture is inside the shader file which you want to set with your texture engineApplyShaderToWorldTexture( shader, "name_of_the_texture" ); -- this is the name of texture you want to replace eg. "tshirtwhite" If you want to replace another texture you will have to use the same code as above but with different names/filenames. Link to comment
BrokenPixel Posted June 30, 2012 Author Share Posted June 30, 2012 THANK YOU SO MUCH 50p! so i just have to paste your code into a .lua file, or how it's going? Link to comment
BrokenPixel Posted June 30, 2012 Author Share Posted June 30, 2012 dude, i'm trying to be nice. so i pasted the 2. code in a lua file and pasted in my variables, added the meta and customized it. i created a shader_file.fx file with the 1. code and when i load it in the server i dont get any errors, but the texture wont show Link to comment
qaisjp Posted June 30, 2012 Share Posted June 30, 2012 dude, i'm trying to be nice.so i pasted the 2. code in a lua file and pasted in my variables, added the meta and customized it. i created a shader_file.fx file with the 1. code and when i load it in the server i dont get any errors, but the texture wont show sorry for what i said before. Show us your meta.xml and .lua file Link to comment
50p Posted June 30, 2012 Share Posted June 30, 2012 The bottom code needs to go to a script file (.lua), the top one needs to go to shader file (.fx). Both of these files need to be inside a resource folder and added to meta.xml. EDIT: I've just tested it and unfortunately it doesn't seem to support ped textures (any ped texture, not just clothes). Link to comment
BrokenPixel Posted June 30, 2012 Author Share Posted June 30, 2012 The bottom code needs to go to a script file (.lua), the top one needs to go to shader file (.fx). Both of these files need to be inside a resource folder and added to meta.xml. well okay i got it, pasted the 2. in a lua and the 1. in a .fx file named "shader_file.fx". so okay, like i said, i pasted all my variables, but when i start it i dont get any errors, but it wont show off, when im now in MTA (in my server) and go to Debugmode 3, i got the error that the technique is wrong. wheres the problem? here's my .fx - texture gTexture; technique replace { pass P0 { Texture[0] = gTexture; } } that's the .lua - txd = dxCreateTexture( "tshirtwhite.png" ); if not txd then txd = nil; -- it's best to nil a variable because it'll waste unnecessary memory return false; end shader = dxCreateShader( "shader_file.fx" ); -- the content of this file should be what I included above if not shader then destroyElement( txd ); txd = nil; return false; end dxSetShaderValue( shader, "gTexture", texture ) engineApplyShaderToWorldTexture( shader, "tshirtwhite" ); -- this is the name of texture you want to replace eg. "tshirtwhite" and here's the meta - <meta> <info description="Shader - Clothes" version="0.1.3" type="script" /> <script src="clothes.lua" type="client" /> <file src="shader_file.fx" type="client" /> <file src="tshirtwhite.png" type="client" /> </meta> as a noob i really dont know what to do. Link to comment
qaisjp Posted June 30, 2012 Share Posted June 30, 2012 it should work, hopefully 50p will help you here Link to comment
BrokenPixel Posted June 30, 2012 Author Share Posted June 30, 2012 i hope it... but when i load it i got the error in debugmode with the technique, i really dont get it o: Link to comment
50p Posted June 30, 2012 Share Posted June 30, 2012 i help it too so much... but when i load it i got the error in debugmode with the technique, i really dont get it o: If you get an error about technique that's propably because you saved the shader file with UTF-8 encoding. Save it with ASCI encoding and you'll be fine. This is my simple test resource: http://www.filefactory.com/file/ku2j1or ... re_rep_zip Link to comment
BrokenPixel Posted June 30, 2012 Author Share Posted June 30, 2012 even with your test resource i get this error... something wrong with my mta server? Link to comment
50p Posted June 30, 2012 Share Posted June 30, 2012 even with your test resource i get this error... something wrong with my mta server? Might be, I'm not a shader pro and haven't seen many shader error messages. What MTA version are you using? Maybe it's your graphics card fault but you seem to run high resolution so the card isn't old. Link to comment
BrokenPixel Posted June 30, 2012 Author Share Posted June 30, 2012 even with your test resource i get this error... something wrong with my mta server? Might be, I'm not a shader pro and haven't seen many shader error messages. What MTA version are you using? Maybe it's your graphics card fault but you seem to run high resolution so the card isn't old. I'm using MTA 1.3 My Graphics Card can't be wrong... if ENB doesn't lag, why should there be problems with this? Hmmm... But it worked for you? Link to comment
50p Posted July 1, 2012 Share Posted July 1, 2012 Well, it works fine because I changed the texture name from "tshirtwhite" to "shad_ped" (shadow ped) and it replaced player's shadow with the texture of new tshit and I didn't get any error/warning message. Link to comment
qaisjp Posted July 1, 2012 Share Posted July 1, 2012 HEY SO NOW WE CAN REMOVE THE SHADOW OF A PED! Link to comment
50p Posted July 2, 2012 Share Posted July 2, 2012 HEY SO NOW WE CAN REMOVE THE SHADOW OF A PED! You can do a lot of things with shaders. There is no need for caps. Link to comment
qaisjp Posted July 2, 2012 Share Posted July 2, 2012 HEY SO NOW WE CAN REMOVE THE SHADOW OF A PED! You can do a lot of things with shaders. There is no need for caps. Sorry, but it's quite a big deal for those people who like going invisible. 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