Jump to content

Dayz Server, Need Help. thanks.


Laura

Recommended Posts

Hello again, i need some scripting help with this replace script.

it's suppose to replace the Bobcat vehicle in my MTA Dayz server but when i Start the resource and refresh everything it dosent replace it. the vehicle is still the same gta default. Any help? / Tips or can somone tell me what im missing on the script? thanks.

Script:

function replaceModel()  
  txd = engineLoadTXD("bobcat.txd", 422 ) 
  engineImportTXD(bobcat.txd, 422) 
  dff = engineLoadDFF("bobcat.dff", 422 ) 
  engineReplaceModel(bobcat, 422) 
end 

Meta.xml:

<meta> 
    <script src="script.lua" type="client"/> 
    <file src="bobcat.txd" type="client"/> 
    <file src="bobcat.dff" type="client"/> 
</meta> 

Link to comment
function replaceModel() 
  txd = engineLoadTXD("bobcat.txd", 422 ) 
  engineImportTXD(bobcat.txd, 422) 
  dff = engineLoadDFF("bobcat.dff", 422 ) 
  engineReplaceModel(bobcat, 422) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 

Link to comment

it Still did'nt work :(

do you think i have to make the txd and dff start with a capital "B" because the car has a Capital B, (Bobcat) but i think that really wouldnt effect it.

unless it does work but the .dff and .txd files im using are unmodded and if i find out they are unmodded i will SCREAM coz i've spent about 3 horus trying to figure this out :@

i will find some replacement Model Mods. to try and then i will let you know if it worked. xD

Link to comment
function replaceModel() 
  txd = engineLoadTXD("bobcat.txd", 422 ) 
  engineImportTXD(bobcat.txd, 422) 
  dff = engineLoadDFF("bobcat.dff", 422 ) 
  engineReplaceModel(bobcat, 422) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 

That's wrong...

@Laura: Use this:

function replaceModel ( ) 
    local txd = engineLoadTXD ( "bobcat.txd" ) 
    engineImportTXD ( txd, 422 ) 
    local dff = engineLoadDFF ( "bobcat.dff", 422 ) 
    engineReplaceModel ( 422 ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel ) 

Link to comment

Hello Solidsnake14, i tried yours in the script and it did the same as the others.

basically in Dayz, i type /spawnbobcat.

it spawns a bobcat.

i then open console.

i type "Refresh" and "Refreshall"

it tells me the Resource which i added to replace the models has loaded.

i press "p" and ehad to resources, Refresh that. search for the resource which will replace.

i click start and it loads up, and the bobcat "Flashes on and off" so on the system its worked but i still see the same bobcat

what else could be the issue? :S

Link to comment
function replaceModel() 
    txd = engineLoadTXD ( "bobcat.txd" ) 
    engineImportTXD ( txd, 422) 
    dff = engineLoadDFF ( "bobcat.dff", 422) 
    engineReplaceModel ( dff, 422) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 

That should work

Link to comment

@Laura: Use this:

function replaceModel ( ) 
    local txd = engineLoadTXD ( "bobcat.txd", 422 ) 
    engineImportTXD ( txd, 422 ) 
    local dff = engineLoadDFF ( "bobcat.dff", 422 ) 
    engineReplaceModel ( 422 ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel ) 

This code is wrong ...

txd engineLoadTXD ( string txd_file [, bool filteringEnabled = true ] ) 

bool engineReplaceModel ( dff theModel, int modelID [, bool alphaTransparency = false ] ) 

Link to comment
function replaceModel() 
    txd = engineLoadTXD ( "bobcat.txd" ) 
    engineImportTXD ( txd, 422) 
    dff = engineLoadDFF ( "bobcat.dff", 422) 
    engineReplaceModel ( dff, 422) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 

That should work

I used this in the script, and instead of uploading the "Replace_Model".zip tot he server. i uplaoded it as a FOLDER

and included the files 1 by 1 myself. i then loaded the game up and starter the resource and it now Works. i'd like to thank everyone for their effort i belive we was right all along only i was uploading it as a .zip and not a folder.

i dont see why the .zip should not work seen as all the addons and my skin replace script is as a .zip file all worked. maybe it was the script after all who knows either way it works now and thanks everyone :) xx

Link to comment

Quick update. i have just removed the replace_model Folder. and uploaded it as a ZIP as a Test. and it works as a Zip also so i blelive that it was the script all along.

the correct script is.

function replaceModel() 
    txd = engineLoadTXD ( "bobcat.txd" ) 
    engineImportTXD ( txd, 422) 
    dff = engineLoadDFF ( "bobcat.dff", 422) 
    engineReplaceModel ( dff, 422) 
end 
addEventHandler("onClientResourceStart", resourceRoot, replaceModel) 

Link to comment
  • Moderators

Wei just told you the solution but you don't really seem to care about it:

Solidsnake's code with Wei's fix:

function replaceModel ( ) 
    local txd = engineLoadTXD ( "bobcat.txd" ) 
    engineImportTXD ( txd, 422 ) 
    local dff = engineLoadDFF ( "bobcat.dff" ) 
    engineReplaceModel ( 422 ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel ) 

Link to comment

@Laura: Use this:

function replaceModel ( ) 
    local txd = engineLoadTXD ( "bobcat.txd", 422 ) 
    engineImportTXD ( txd, 422 ) 
    local dff = engineLoadDFF ( "bobcat.dff", 422 ) 
    engineReplaceModel ( 422 ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel ) 

This code is wrong ...

txd engineLoadTXD ( string txd_file [, bool filteringEnabled = true ] ) 

bool engineReplaceModel ( dff theModel, int modelID [, bool alphaTransparency = false ] ) 

Well, it was your code actually, I just changed the variable names ;).

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