Jump to content

how to replace mta cars?


Recommended Posts

http://mta.dzek.eu/vehicle/

Probably he will change the DFF too. Not only the TXD.

function applyMods() 
        local txd = engineLoadTXD ( "(file).txd" ) 
        engineImportTXD ( txd, [VehicleID] ) 
        local dff = engineLoadDFF ( "(file).dff", [VehicleID] ) 
        engineReplaceModel ( dff, [VehicleID] ) 
end 
addEventHandler("onClientResourceStart", getRootElement(), applyMods) 

https://wiki.multitheftauto.com/wiki/EngineReplaceModel

Click link above for example to replace vehicle skin.

Link to comment
  • Scripting Moderators
http://mta.dzek.eu/peds/

Is easy way

  
function applyMods() 
        local skin = engineLoadTXD ( "(file).txd" ) 
        engineImportTXD ( skin, (skin id) ) 
end 
addEventHandler("onClientResourceStart", getRootElement(), applyMods) 

It's a bit harder(for starter) but same.

He said car mods. viewtopic.php?f=91&t=42687&p=431325#p431325

Use first "Search" function. :)

Link to comment
    addCommandHandler("replace", 
    function () 
        setTimer(function () 
        engineImportTXD(engineLoadTXD("skin.txd", ID), ID) 
        engineReplaceModel(engineLoadDFF("skin.dff", 0), ID) 
        end, 1000, 1) 
    end) 
      
    addCommandHandler("restore", 
    function () 
         engineRestoreModel(ID) 
    end) 

the default code for this should look like this? and what if i want to bind these actions?

bindKey("F3", "up", 
function() 
    replace = (not replace) 
    if(replace)then 
        outputChatBox("#FFFFFF[ENABLE]#FF5500Custom skin is now #00FF00enabled#FF5500!", 255, 128, 0, true) 
    else 
        outputChatBox("#FFFFFF[DISABLE]#FF5500Custom skin is now #FF0000disabled#FF5500!", 255, 128, 0, true) 
    end 

Will_It_Blend.jpg

Link to comment

Why did you need to use timer? And why you should put command if you want to bind it?

local useMod = 0 -- You can name it as you wish actually 
  
bindKey("F3", "down", 
function() 
if useMod == 0 then 
     engineImportTXD(engineLoadTXD("skin.txd", ID), ID) 
     engineReplaceModel(engineLoadDFF("skin.dff", ID), ID) -- You should fill it with the object ID instead of 0 
     useMod = 1 
     outputChatBox("#FFFFFF[ENABLE]#FF5500Custom skin is now #00FF00enabled#FF5500!", 255, 128, 0, true) 
elseif useMod == 1 then 
     engineRestoreModel(ID) 
     useMod = 0 
     outputChatBox("#FFFFFF[DISABLE]#FF5500Custom skin is now #FF0000disabled#FF5500!", 255, 128, 0, true) 
end 
end 
) 

But if you still want to let those command. Try this function.

executeCommandHandler 

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...