Prieto_Galletini Posted July 10, 2009 Share Posted July 10, 2009 ok so my code worked fine so i tried to add another custom car to try it out without looking at the wiki. the first one was using the wiki heres the code, to see if you guys see something wrong in here, it loads without errors and it loads the elegy new dff and txd but the banshee's do not load function ReplaceVehicle ( ) -- skyline(elegy) elgtx = engineLoadTXD ( "files/elegy.txd" ) engineImportTXD ( elgtx, 562 ) elgdf = engineLoadDFF ( "files/elegy.dff", 562 ) engineReplaceModel ( elgdf, 562 ) -- viper(banshee) vprtx = engineLoadTXD ( "files/banshee.txd" ) engineImportTXD ( vprtx, 429 ) vprdf = engineLoadDFF ( "files/banshee.dff" ) engineReplaceModel ( vprdf, 429 ) end addEventHandler ( "onClientResourceStart", getRootElement(), ReplaceVehicle ) Link to comment
50p Posted July 10, 2009 Share Posted July 10, 2009 Any errors you get? You don't want to reload new models every time resources start, so change getRootElement() to getResourceRootElement( getThisResource() ). Output some messages to make sure engineLoadTXD and engineLoadDFF didn't fail. Link to comment
Prieto_Galletini Posted July 10, 2009 Author Share Posted July 10, 2009 function ReplaceVehicle ( ) outputChatBox ( "cargando skyline" ) -- skyline(elegy) elgtx = engineLoadTXD ( "files/elegy.txd" ) engineImportTXD ( elgtx, 562 ) elgdf = engineLoadDFF ( "files/elegy.dff", 562 ) engineReplaceModel ( elgdf, 562 ) outputChatBox ( "ya se ha cargado el skyline" ) outputChatBox ( "cargando viper" ) -- viper(banshee) vprtx = engineLoadTXD ( "files/banshee.txd" ) engineImportTXD ( vprtx, 429 ) vprdf = engineLoadDFF ( "files/banshee.dff" ) engineReplaceModel ( vprdf, 429 ) outputChatBox ( "se ha cargado el viper" ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), ReplaceVehicle ) i made it how you said and still the viper ain't showing look heres meta.xml in case the problem is in there <?xml version="1.0" encoding="utf-8"?>> author="Prieto" type="script" name="models" /> ="models.lua" type="client" /> ="srv_models.lua" /> src="files/elegy.dff" /> src="files/elegy.txd" /> src="files/banshee.txd" /> src="files/banshee.dff" />> Thanks in advance. Link to comment
Cazomino05 Posted July 10, 2009 Share Posted July 10, 2009 ok so my code worked fine so i tried to add another custom car to try it out without looking at the wiki. the first one was using the wikiheres the code, to see if you guys see something wrong in here, it loads without errors and it loads the elegy new dff and txd but the banshee's do not load function ReplaceVehicle ( ) -- skyline(elegy) elgtx = engineLoadTXD ( "files/elegy.txd" ) engineImportTXD ( elgtx, 562 ) elgdf = engineLoadDFF ( "files/elegy.dff", 562 ) engineReplaceModel ( elgdf, 562 ) -- viper(banshee) vprtx = engineLoadTXD ( "files/banshee.txd" ) engineImportTXD ( vprtx, 429 ) vprdf = engineLoadDFF ( "files/banshee.dff" ) engineReplaceModel ( vprdf, 429 ) end addEventHandler ( "onClientResourceStart", getRootElement(), ReplaceVehicle ) vprdf = engineLoadDFF ( "files/banshee.dff" ) You didn't specify the model ID in engineLoadDFF for the banshee nice skyline by the way Link to comment
50p Posted July 10, 2009 Share Posted July 10, 2009 Maybe I wasn't clear enough but usually when you debug your script/program you output what functions returned. For instance: viper = engineLoadDFF( "viper.dff", 560 ); outputChatBox( tostring( viper ) ); -- output what is viper, if it is false, then loading failed Link to comment
Prieto_Galletini Posted July 10, 2009 Author Share Posted July 10, 2009 thank you both this is what was missing and thank you 50p for teaching me how to output if worked or not thanks again both. I'm really liking this community a lot. so you guys can play on my Role play GM like in one year when it's finished hahaha another question does this works for player skins too? Link to comment
50p Posted July 10, 2009 Share Posted July 10, 2009 Check this post https://forum.multitheftauto.com/viewtop ... 18#p292835 and see for yourself. Link to comment
Prieto_Galletini Posted July 10, 2009 Author Share Posted July 10, 2009 si its basically the same thing right? sorry fir asking too much and this is my skin change ped but it does not work for now so please take a look, if you see some error's let me know thanks in advance function ReplaceSkin ( ) tiptx = engineLoadTXD ( "skins/bmybar.txd" ) engineImportTXD ( tiptx, 176 ) tipdf = engineLoadDFF ( "skins/bmybar.dff", 176 ) engineReplaceModel ( tipdf, 176 ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), ReplaceSkin ) and another thing i know this is a dumb question does the word that goes always after function does it have to be something specific or it can be any word i want? Link to comment
50p Posted July 10, 2009 Share Posted July 10, 2009 Yes, it's the same way to replace textures but you can't replace the models. Only custom objects and vehicles are supported, not pedestrians (characters). The word after "function" can be anything you like because it's a name of a function. You can then call this function from another functions or attach this function to an event (that's what you do with addEventHandler). Link to comment
Prieto_Galletini Posted July 10, 2009 Author Share Posted July 10, 2009 Yes, it's the same way to replace textures but you can't replace the models. Only custom objects and vehicles are supported, not pedestrians (characters).The word after "function" can be anything you like because it's a name of a function. You can then call this function from another functions or attach this function to an event (that's what you do with addEventHandler). thanks again so for peds its only txd, too bad but too good for now, i remember when i started playing samp i though i was the best thing ever since a came across MTA damm i was like all my dreams came true hahaha 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