Jump to content

Change vehicle model


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 what else I need to change the texture of it in mid game/flight...

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

Thanks!

Link to comment

Have you tested the code yet? (Please use [lua ] or

 when posting a script)

 

Not really sure if this will work, but if it dosn't please post any errors (/debugscript 3)

[xml]local textureIn = 0
local textureOut = 1
 
function setTexture( key )
    if key == "0" then
        if textureOut == 0 then
            -- ( Gear Down ) --
            textureOut = 1
            textureIn = 0
            engineReplaceModel ( engineLoadDFF ( "geardown/hunter.dff", 425 ), 425 )
        end
    elseif key == "9" then
        if textureIn == 0 then
            -- ( Gear Up ) --
            textureIn = 1
            textureOut = 0
            engineReplaceModel ( engineLoadDFF ( "gearup/hunter.dff", 425 ), 425 )
        end
    end
end
bindKey( "0", "up", setTexture )
bindKey( "9", "up", setTexture )
 
[/xml]

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