Jump to content

Adding your own vehicles: script problem


Recommended Posts

Hello everyone,

I'm still quite new to making a MTA server, and now have some trouble. (again...) I want to mod the vehicles for my gamemode, but the script doesn't work...

function installAuto ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        outputChatBox ( "A few mods are being loaded for this gamemode." ) 
        txd = engineLoadTXD ( "hydra.txd" ) 
        engineImportTXD ( txd, 520 ) 
        dff = engineLoadDFF ( "hydra.dff", 520 ) 
        engineReplaceModel ( dff, 520 ) 
    end 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), installAuto ) 
  
function installAuto2 ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        txd = engineLoadTXD ( "androm.txd" ) 
        engineImportTXD ( txd, 592 ) 
        dff = engineLoadDFF ( "androm.dff", 592 ) 
        engineReplaceModel ( dff, 592 )    
    end 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), installAuto2 )  
  
function installAuto3 ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        txd = engineLoadTXD ( "cheetah.txd" ) 
        engineImportTXD ( txd, 415 ) 
        dff = engineLoadDFF ( "cheetah.dff", 415 ) 
        engineReplaceModel ( dff, 415 ) 
     
    end 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), installAuto3 )  
  
function installAuto4 ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        txd = engineLoadTXD ( "copcarla.txd" )        
        engineImportTXD ( txd, 596 ) 
        dff = engineLoadDFF ( "copcarla.dff", 596 ) 
        engineReplaceModel ( dff, 596 ) 
     
    end 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), installAuto4 )  
  
function installAuto5 ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        txd = engineLoadTXD ( "turismo.txd" ) 
        engineImportTXD ( txd, 451 ) 
        dff = engineLoadDFF ( "turismo.dff", 451 ) 
        engineReplaceModel ( dff, 451 ) 
    end                                               
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), installAuto5 ) 

And yes, I have used in the meta file :P . Furthermore I don't know what the problem is... Because this script is actually an a bit modified code that was listed between the resources. The F-18 script, used it as an example. The example worked, my script didn't. :( There are no errors by the way, not even warnings. The models just don't load... They download and all, but loading is a whole different thing...

Thanks in advance,

Gamesnert.

Link to comment

I also want to add some custom vehicles and i have everything already configured but wont load in game, the resource loads fine what am i doing wrong? this is what i've got:

function installAuto ( startedResource )

if ( startedResource == getThisResource() ) then

outputChatBox ( "warthog" )

txd = engineLoadTXD ( "data/bfinject.txd" )

engineImportTXD ( txd, 520 )

dff = engineLoadDFF ( "data/bfinject.dff", 520 )

engineReplaceModel ( dff, 520 )

end

end

addEventHandler ( "onClientResourceStart", getRootElement(), installAuto )

EDIT*** just changed the id numbers for the model so it should work now if not ill say ;]

Link to comment

... Have you actually loaded these models in the meta.xml? If not, open meta.xml, add , and check again.

If that's not the problem, go ingame, login with an admin account, and type "/debugscript 2". It'll show what's going on.

Link to comment

what is the engineReplaceModel for.

i have a number of modded vehicles running but i have only needed engineReplaceTXD and engineReplaceDFF and mostly they work

( have found a few that dont ). im very new to scripting and was just wondering if i might need to replace model to get the not working vehicles to load

( sorry to butt in on your thread ) :D:D

Link to comment
  • Recently Browsing   0 members

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