Jump to content

Crash when replacing bodikit


Recommended Posts

When i was trying to replace the bodikits for custom ones for the elegy (replaced it with an Acura) the game crashed everytime i wanted to join

The Meta is this one:

"Threule" name="Bodikit" version="1" type="script"/> 

and the lua this one:

    function replaceModel() 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("elegy.dff", 562 ) 
    engineReplaceModel(dff, 562) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("exh_a_l.dff", 1034 ) 
    engineReplaceModel(dff, 1034) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("fbmp_a_l.dff", 1171 ) 
    engineReplaceModel(dff, 1171) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("rbmp_a_l.dff", 1149 ) 
    engineReplaceModel(dff, 1085) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("rf_a_l.dff", 1038 ) 
    engineReplaceModel(dff, 1038) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("spl_a_l_b", 1147 ) 
    engineReplaceModel(dff, 1096) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("wg_l_a_l.dff", 1036 ) 
    engineReplaceModel(dff, 1036) 
    dff = engineLoadDFF("elegy.txd", 562 ) 
    engineReplaceModel(txd, 562) 
    dff = engineLoadDFF("wg_r_a_l.dff", 1040 ) 
    engineReplaceModel(dff, 1040) 
  
    end 
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
  
    addCommandHandler ( "reloadcar", replaceModel ) 

and the car, here:

http://www.gtainside.com/en/download.ph ... =18805&t=1

Why the hell is it crashing?

Link to comment

Look at this page's example: https://wiki.multitheftauto.com/wiki/EngineReplaceModel and then look at your code.

You will notice that you replace the TXDs as DFFs, which are different. Use the example in the Wiki. Also, you do not need the type after file tag in meta.xml so you can take it off.

PS. No one else replies to this thread unless you really have to. I hate when someone starts helping and then everybody joins and after 1 hour the thread is 5 pages long. Just let the first helper help...

Link to comment
Look at this page's example: https://wiki.multitheftauto.com/wiki/EngineReplaceModel and then look at your code.

You will notice that you replace the TXDs as DFFs, which are different. Use the example in the Wiki. Also, you do not need the type after file tag in meta.xml so you can take it off.

PS. No one else replies to this thread unless you really have to. I hate when someone starts helping and then everybody joins and after 1 hour the thread is 5 pages long. Just let the first helper help...

I dont understand that part. I thought if you put the txd before it, it means the texture is there. Can you fix one line (the last one, for example) so i know what you mean?

Link to comment

meta.xml

<meta> 
    <info author="Threule" name="Bodikit" version="1" type="script" /> 
    <script src="script.lua" type="client" /> 
    <file src="elegy.txd" /> 
    <file src="elegy.dff" /> 
    <file src="exh_a_l.dff" /> 
    <file src="fbmp_a_l.dff" /> 
    <file src="rbmp_a_l.dff" /> 
    <file src="rf_a_l.dff" /> 
    <file src="spl_a_l_b.dff" /> 
    <file src="wg_l_a_l.dff" /> 
</meta> 

Client-side (script.lua)

function replaceModel() 
    -- Elegy 
    local txd = engineLoadTXD("elegy.txd") 
    engineImportTXD(txd, 562) 
  
    local dff = engineLoadDFF("elegy.dff", 562) 
    engineReplaceModel(dff, 562) 
  
    -- Mods 
    local dff = engineLoadDFF("exh_a_l.dff", 1034) 
    engineReplaceModel(dff, 1034) 
  
    local dff = engineLoadDFF("fbmp_a_l.dff", 1171) 
    engineReplaceModel(dff, 1171) 
  
    local dff = engineLoadDFF("rbmp_a_l.dff", 1149) 
    engineReplaceModel(dff, 1149) 
  
    local dff = engineLoadDFF("rf_a_l.dff", 1038) 
    engineReplaceModel(dff, 1038) 
  
    local dff = engineLoadDFF("spl_a_l_b.dff", 1147) 
    engineReplaceModel(dff, 1147) 
  
    local dff = engineLoadDFF("wg_l_a_l.dff", 1036) 
    engineReplaceModel(dff, 1036) 
  
    local dff = engineLoadDFF("wg_r_a_l.dff", 1040) 
    engineReplaceModel(dff, 1040) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 
addCommandHandler("reloadcar", replaceModel) 

Please note that you are only replacing the DFFs, not the TXDs.

Edited by Guest
Link to comment
Have you noticed that the file name doesn't have extension?
local dff = engineLoadDFF("spl_a_l_b", 1147) 
engineReplaceModel(dff, 1147) 

Edited my last post.

You have extra bracket after resourceRoot.

addEventHandler("onClientResourceStart", resourceRoot), replaceModel) 

it should be

addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...