Laura Posted February 27, 2014 Posted February 27, 2014 Hello again, i need some scripting help with this replace script. it's suppose to replace the Bobcat vehicle in my MTA Dayz server but when i Start the resource and refresh everything it dosent replace it. the vehicle is still the same gta default. Any help? / Tips or can somone tell me what im missing on the script? thanks. Script: function replaceModel() txd = engineLoadTXD("bobcat.txd", 422 ) engineImportTXD(bobcat.txd, 422) dff = engineLoadDFF("bobcat.dff", 422 ) engineReplaceModel(bobcat, 422) end Meta.xml: <meta> <script src="script.lua" type="client"/> <file src="bobcat.txd" type="client"/> <file src="bobcat.dff" type="client"/> </meta>
Wei Posted February 27, 2014 Posted February 27, 2014 function replaceModel() txd = engineLoadTXD("bobcat.txd", 422 ) engineImportTXD(bobcat.txd, 422) dff = engineLoadDFF("bobcat.dff", 422 ) engineReplaceModel(bobcat, 422) end addEventHandler("onClientResourceStart", resourceRoot, replaceModel)
Laura Posted February 27, 2014 Author Posted February 27, 2014 it Still did'nt work do you think i have to make the txd and dff start with a capital "B" because the car has a Capital B, (Bobcat) but i think that really wouldnt effect it. unless it does work but the .dff and .txd files im using are unmodded and if i find out they are unmodded i will SCREAM coz i've spent about 3 horus trying to figure this out :@ i will find some replacement Model Mods. to try and then i will let you know if it worked.
Laura Posted February 27, 2014 Author Posted February 27, 2014 No it did not work.. still... so it's not the files im using it's defiantly the script / meta or somthing.
Castillo Posted February 27, 2014 Posted February 27, 2014 function replaceModel() txd = engineLoadTXD("bobcat.txd", 422 ) engineImportTXD(bobcat.txd, 422) dff = engineLoadDFF("bobcat.dff", 422 ) engineReplaceModel(bobcat, 422) end addEventHandler("onClientResourceStart", resourceRoot, replaceModel) That's wrong... @Laura: Use this: function replaceModel ( ) local txd = engineLoadTXD ( "bobcat.txd" ) engineImportTXD ( txd, 422 ) local dff = engineLoadDFF ( "bobcat.dff", 422 ) engineReplaceModel ( 422 ) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel )
Laura Posted February 27, 2014 Author Posted February 27, 2014 Hello Solidsnake14, i tried yours in the script and it did the same as the others. basically in Dayz, i type /spawnbobcat. it spawns a bobcat. i then open console. i type "Refresh" and "Refreshall" it tells me the Resource which i added to replace the models has loaded. i press "p" and ehad to resources, Refresh that. search for the resource which will replace. i click start and it loads up, and the bobcat "Flashes on and off" so on the system its worked but i still see the same bobcat what else could be the issue?
Wei Posted February 27, 2014 Posted February 27, 2014 function replaceModel() txd = engineLoadTXD ( "bobcat.txd" ) engineImportTXD ( txd, 422) dff = engineLoadDFF ( "bobcat.dff", 422) engineReplaceModel ( dff, 422) end addEventHandler("onClientResourceStart", resourceRoot, replaceModel) That should work
cheez3d Posted February 27, 2014 Posted February 27, 2014 Any debugscript errors? Use /debugscript 3 in game and show us what you get.
PaiN^ Posted February 27, 2014 Posted February 27, 2014 You may have a corrupt .txd and .dff files. Are you sure that they work ?
Wei Posted February 27, 2014 Posted February 27, 2014 @Laura: Use this: function replaceModel ( ) local txd = engineLoadTXD ( "bobcat.txd", 422 ) engineImportTXD ( txd, 422 ) local dff = engineLoadDFF ( "bobcat.dff", 422 ) engineReplaceModel ( 422 ) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel ) This code is wrong ... txd engineLoadTXD ( string txd_file [, bool filteringEnabled = true ] ) bool engineReplaceModel ( dff theModel, int modelID [, bool alphaTransparency = false ] )
Laura Posted February 27, 2014 Author Posted February 27, 2014 You may have a corrupt .txd and .dff files. Are you sure that they work ? Yes i am sure they work.
Laura Posted February 27, 2014 Author Posted February 27, 2014 Any debugscript errors? Use /debugscript 3 in game and show us what you get. I will try this now.
Laura Posted February 27, 2014 Author Posted February 27, 2014 function replaceModel() txd = engineLoadTXD ( "bobcat.txd" ) engineImportTXD ( txd, 422) dff = engineLoadDFF ( "bobcat.dff", 422) engineReplaceModel ( dff, 422) end addEventHandler("onClientResourceStart", resourceRoot, replaceModel) That should work I used this in the script, and instead of uploading the "Replace_Model".zip tot he server. i uplaoded it as a FOLDER and included the files 1 by 1 myself. i then loaded the game up and starter the resource and it now Works. i'd like to thank everyone for their effort i belive we was right all along only i was uploading it as a .zip and not a folder. i dont see why the .zip should not work seen as all the addons and my skin replace script is as a .zip file all worked. maybe it was the script after all who knows either way it works now and thanks everyone xx
Laura Posted February 27, 2014 Author Posted February 27, 2014 Quick update. i have just removed the replace_model Folder. and uploaded it as a ZIP as a Test. and it works as a Zip also so i blelive that it was the script all along. the correct script is. function replaceModel() txd = engineLoadTXD ( "bobcat.txd" ) engineImportTXD ( txd, 422) dff = engineLoadDFF ( "bobcat.dff", 422) engineReplaceModel ( dff, 422) end addEventHandler("onClientResourceStart", resourceRoot, replaceModel)
Moderators Citizen Posted February 27, 2014 Moderators Posted February 27, 2014 Wei just told you the solution but you don't really seem to care about it: Solidsnake's code with Wei's fix: function replaceModel ( ) local txd = engineLoadTXD ( "bobcat.txd" ) engineImportTXD ( txd, 422 ) local dff = engineLoadDFF ( "bobcat.dff" ) engineReplaceModel ( 422 ) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel )
Castillo Posted February 27, 2014 Posted February 27, 2014 @Laura: Use this: function replaceModel ( ) local txd = engineLoadTXD ( "bobcat.txd", 422 ) engineImportTXD ( txd, 422 ) local dff = engineLoadDFF ( "bobcat.dff", 422 ) engineReplaceModel ( 422 ) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel ) This code is wrong ... txd engineLoadTXD ( string txd_file [, bool filteringEnabled = true ] ) bool engineReplaceModel ( dff theModel, int modelID [, bool alphaTransparency = false ] ) Well, it was your code actually, I just changed the variable names .
Wei Posted February 27, 2014 Posted February 27, 2014 Well, it was your code actually, I just changed the variable names . I just added event, I didn't look carefuly
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