Jump to content

Change the .ddf of a car in mid game?


Recommended Posts

Ok, so I found a cool helicopter and it has 2 .ddf's (1 with the landing gear in and 1 with landing gear out), and I was wondering if it is possible to change the texture of it in mid game/flight? (all I need is the command line) :D

I have this so far....

local textureIn = 1 
local textureOut = 0 
  
function setTexture( key ) 
    if key == "0" then 
        if textureOut == 0 then 
            textureOut = textureOut + 1 
            textureIn = textureIn - 1 
            -->make texture change... 
        end 
    elseif key == "9" then 
        if textureIn == 0 then 
            textureIn = playerGear + 1 
            textureOut = playerGear - 1 
            --->make texture change... 
        end 
    end 
end 
  

What would I need to fill in the comment lines?

Link to comment
Use the engine functions, https://wiki.multitheftauto.com/wiki/Cl ... _functions

There are examples of what you need.

Ok thanks, but I am in need of just a little more assistance... I am not sure how to bind keys... I know just enough to get errors... How do I make an alternating key? (I.E. when I press it once it changes the texture, and when I press it again it changes back) Thanks! :mrgreen:

skinchange.lua

local textureIn = 1 
local textureOut = 0 
  
function setTexture( key ) 
    if key == "0" then 
        if textureOut == 0 then 
            textureOut = textureOut + 1 
            textureIn = textureIn - 1 
            dff = engineLoadDFF ( "geardown/hunter.dff", 425 ) 
            engineReplaceModel ( dff, 425 ) 
            -->make texture change... 
        end 
    elseif key == "9" then 
        if textureIn == 0 then 
            textureIn = playerGear + 1 
            textureOut = playerGear - 1 
            dff = engineLoadDFF ( "gearup/hunter.dff", 425 ) 
            engineReplaceModel ( dff, 425 ) 
            --->make texture change... 
        end 
    end 
end 
bindKey( "0", "up", setTexture ) 
bindKey( "9", "up", setTexture ) 

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