Jump to content

engineReplaceModel Glitch


masgoku

Recommended Posts

I have made a script for replacing vehicle models in my server, it work fine for the first four vehicles and now it won't work at all but script is the same all the way through out.

This is the script below and before you ask I do have everything in the meta for the models.

function ReplaceVehicle ( ) 
  
txd = engineLoadTXD ( "monster3.txd" ) 
engineImportTXD ( txd, 557 ) 
dff = engineLoadDFF ( "monster3.dff", 0 ) 
engineReplaceModel ( dff, 557 ) 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 
  
function ReplaceVehicle ( ) 
  
txd = engineLoadTXD ( "infernus.txd" ) 
engineImportTXD ( txd, 411 ) 
dff = engineLoadDFF ( "infernus.dff", 0 ) 
engineReplaceModel ( dff, 411 ) 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 
  
function ReplaceVehicle ( ) 
  
txd = engineLoadTXD ( "cheetah.txd" ) 
engineImportTXD ( txd, 415 ) 
dff = engineLoadDFF ( "cheetah.dff", 0 ) 
engineReplaceModel ( dff, 415 ) 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 
  
function ReplaceVehicle ( ) 
  
txd = engineLoadTXD ( "hustler.txd" ) 
engineImportTXD ( txd, 545 ) 
dff = engineLoadDFF ( "hustler.dff", 0 ) 
engineReplaceModel ( dff, 545 ) 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 
  
function ReplaceVehicle ( ) 
  
txd = engineLoadTXD ( "comet.txd" ) 
engineImportTXD ( txd, 480 ) 
dff = engineLoadDFF ( "comet.dff", 0 ) 
engineReplaceModel ( dff, 480 ) 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 
  

GTA?async&rand=0.17271795123815536

Link to comment
local vehicls = { 
-- [carID] = "car file name", 
[557] = "monster3", 
[411] = "infernus", 
[415] = "cheetah", 
[545] = "hustler", 
[480] = "comet", 
} 
  
function ReplaceVehicle ( ) 
    for id,name in pairs(vehicls) do 
    txd = engineLoadTXD ( name..".txd" ) 
    engineImportTXD ( txd, id ) 
    dff = engineLoadDFF ( name..".dff", 0 ) 
    engineReplaceModel ( dff, id ) 
    end 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 

Link to comment

If it truly doesn't work, I guess it could be some memory issue. Avoid using a lot of ridiculously over-sized models and textures.

However, that said, there is something wrong with model replacing for sure. I've modded in a few vehicles into MTA myself, and randomly(albeit rarely) they will sort of lose their suspension setting or something. They just slide along on the ground. Similar to when you give hydraulics to the monster truck - except the wheels look fine.

Absolutely no clue what causes it. :roll:

Link to comment
local vehicls = { 
-- [carID] = "car file name", 
[557] = "monster3", 
[411] = "infernus", 
[415] = "cheetah", 
[545] = "hustler", 
[480] = "comet", 
} 
  
function ReplaceVehicle ( ) 
    for id,name in pairs(vehicls) do 
    txd = engineLoadTXD ( name..".txd" ) 
    engineImportTXD ( txd, id ) 
    dff = engineLoadDFF ( name..".dff", 0 ) 
    engineReplaceModel ( dff, id ) 
    end 
end 
addEvent ( "replaceVeh", true ) 
addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 

Hey I tried this the same issue is still happening not sure why, but thanks I will use this method in the future much more clean looking.

Link to comment
If it truly doesn't work, I guess it could be some memory issue. Avoid using a lot of ridiculously over-sized models and textures.

However, that said, there is something wrong with model replacing for sure. I've modded in a few vehicles into MTA myself, and randomly(albeit rarely) they will sort of lose their suspension setting or something. They just slide along on the ground. Similar to when you give hydraulics to the monster truck - except the wheels look fine.

Absolutely no clue what causes it. :roll:

I tried ALw7sh's method still same issue think it might just be a weird issue with MTA honestly.

Link to comment
  • 4 weeks later...
I uploaded on 4Shared, so you can make an account or use Facebook and various other things to download the file.

I'd recommend you look into setting up an account with Dropbox, or one of the many other cloud storage solutions available, so users don't have to surrender all of their personal information to download a file.

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