Sign in to follow this  
TheSandwich

Need help on custom model script!

Recommended Posts

Hi guys, I've been wondering if I could use custom ped models for script and not installing as a mod.

Is it possible? I've seen some server loading up custom models as an AI and loading custom objects.

Share this post


Link to post

It's fairly simple actually, just use these functions

engineImportTXD 
engineLoadDFF 
engineLoadTXD 
engineReplaceModel 

Share this post


Link to post
  
function replaceModel()  
        txd = engineLoadTXD("androm.txd", 592) 
    engineImportTXD(txd, 592) 
    dff = engineLoadDFF("androm.dff", 592 ) 
    engineReplaceModel(dff, 592) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel ) 
  

Share this post


Link to post
  
function replaceModel()  
        txd = engineLoadTXD("androm.txd", 592) 
    engineImportTXD(txd, 592) 
    dff = engineLoadDFF("androm.dff", 592 ) 
    engineReplaceModel(dff, 592) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel ) 
  

So Extreme123, how do I make the whole script?

Do I have to place a folder with the model inside it?

Also thanks! :D

Share this post


Link to post

aha ok Create the file and name it replace

put this Code

function replaceModel() 
        txd = engineLoadTXD("replace/androm.txd", 592)  
    engineImportTXD(txd, 592) 
    dff = engineLoadDFF("replace/androm.dff", 592 ) 
    engineReplaceModel(dff, 592) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel ) 

Share this post


Link to post
aha ok Create the file and name it replace

put this Code

function replaceModel() 
        txd = engineLoadTXD("replace/androm.txd", 592)  
    engineImportTXD(txd, 592) 
    dff = engineLoadDFF("replace/androm.dff", 592 ) 
    engineReplaceModel(dff, 592) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel ) 

Sorry if it took me too long to reply once again.

May I ask if this stream the models to both client and server?

Thanks for your help!

Share this post


Link to post
aha ok Create the file and name it replace

put this Code

function replaceModel() 
        txd = engineLoadTXD("replace/androm.txd", 592)  
    engineImportTXD(txd, 592) 
    dff = engineLoadDFF("replace/androm.dff", 592 ) 
    engineReplaceModel(dff, 592) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel ) 

Sorry if it took me too long to reply once again.

May I ask if this stream the models to both client and server?

Thanks for your help!

That script is client-sided.

It temprorarily replaces a model in the client's engine.

Which means you need to download the model file to the client before launching script.

After leaving the server, MTA replaces the downloaded file with a backup done BEFORE entering server.

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

Share this post


Link to post
aha ok Create the file and name it replace

put this Code

function replaceModel() 
        txd = engineLoadTXD("replace/androm.txd", 592)  
    engineImportTXD(txd, 592) 
    dff = engineLoadDFF("replace/androm.dff", 592 ) 
    engineReplaceModel(dff, 592) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel ) 

Sorry if it took me too long to reply once again.

May I ask if this stream the models to both client and server?

Thanks for your help!

That script is client-sided.

It temprorarily replaces a model in the client's engine.

Which means you need to download the model file to the client before launching script.

After leaving the server, MTA replaces the downloaded file with a backup done BEFORE entering server.

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

Last question. (Thank you for the help I got it working!)

How do I use this if I'm going to replace the anim/ped.ifp?

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.