Jump to content

Format Problem


TheEcstasy

Recommended Posts

  • Administrators

Hey, if you're looking to replace GTA models with custom models, the engineReplaceModel function will come in handy. The function page has a few code examples that you can use to test this out as needed.

p.s. Moved this into the Scripting section

Edited by Tut
Link to comment
  • 2 weeks later...

hello ,i have an idea about it.

@TheEcstasycan you try this code, it may help you, have a nice day

 

function changeskin(playersource)
	if not isPedOnGround(playersource) then outputChatBox("You have to be on the ground to use this command.",playersource) return end
	if (getElementModel(playersource) == 12) then
		setElementModel(playersource,73) --(73 this is the current skin ID)
	else
		setElementModel(playersource,12) --(12 this is the skin ID you can change)
	end
end
addCommandHandler("changeskin",changeskin)

 

meta.xml: 

 

<meta>
<info type="script"/>
<script src="changeskin.lua" type="server"/>
</meta>

 

Edited by eoL|Shady
edit for code
Link to comment

 

3 minutes ago, eoL|Shady said:

hello ,i have an idea about it.

@TheEcstasycan you try this code, it may help you, have a nice day

 

function changeskin(playersource)
	if not isPedOnGround(playersource) then outputChatBox("You have to be on the ground to use this command.",playersource) return end
	if (getElementModel(playersource) == 12) then
		setElementModel(playersource,73) --(73 this is the current skin ID)
	else
		setElementModel(playersource,12) --(12 this is the skin ID you can change)
	end
end
addCommandHandler("changeskin",changeskin)

 

I don't think this is what he needs. I think he is asking if he can load the txd and dff files with custom format such as 'myModel.blabla'. If this is what is he is asking then yes it can

Link to comment

I tried this as normal. Are you sure this is what you want? Do you want to encrypt txd or dff? if not, you can get what you want by changing the extensions
You can change it to ".dff.3D" or ".3D" same applies in txd it worked in both cases

addEventHandler("onClientResourceStart", resourceRoot,
	function ()
		local txd = engineLoadTXD("skin.txd.3D")
		engineImportTXD (txd, 10)
		local dff = engineLoadDFF("skin.dff.3D")
		engineReplaceModel(dff, 10)
	end
)

 

<meta>
	<script src="skin_c.lua" type="client" />
	<file src="skin.txd.3D" />
	<file src="skin.dff.3D" />
</meta>

 

Edited by Burak5312
Link to comment
52 minutes ago, eoL|Shady said:

hello ,i have an idea about it.

@TheEcstasycan you try this code, it may help you, have a nice day

 

function changeskin(playersource)
	if not isPedOnGround(playersource) then outputChatBox("You have to be on the ground to use this command.",playersource) return end
	if (getElementModel(playersource) == 12) then
		setElementModel(playersource,73) --(73 this is the current skin ID)
	else
		setElementModel(playersource,12) --(12 this is the skin ID you can change)
	end
end
addCommandHandler("changeskin",changeskin)

 

meta.xml: 

 

<meta>
<info type="script"/>
<script src="changeskin.lua" type="server"/>
</meta>

 

It's doesn't work

[Thank you for Try]

4 minutes ago, Burak5312 said:

I tried this as normal. Are you sure this is what you want? Do you want to encrypt txd or dff if not, you can get what you want by changing the extensions
You can change it to ".dff.3D" or ".3D" same applies in txd it worked in both cases

addEventHandler("onClientResourceStart", resourceRoot,
	function ()
		local txd = engineLoadTXD("skin.txd.3D")
		engineImportTXD (txd, 10)
		local dff = engineLoadDFF("skin.dff.3D")
		engineReplaceModel(dff, 10)
	end
)

 

<meta>
	<script src="skin_c.lua" type="client" />
	<file src="skin.txd.3D" />
	<file src="skin.dff.3D" />
</meta>

 

its for Txd And Dff Formats 
I have already seen people use coroutine 
3d Format Its Fake and people do this for safe hes txd and dff

Edited by TheEcstasy
Pb
Link to comment
addEventHandler ( "onClientResourceStart", resourceRoot,
    function ()
        txd = engineLoadTXD ("name.txd")
        engineImportTXD (txd, 26)  -- ID
        dff = engineLoadDFF ("name.dff")
        engineReplaceModel (dff, 26) -- ID
    end
)

meta.xml
 

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

 

Edited by eoL|Shady
Link to comment
2 minutes ago, eoL|Shady said:
addEventHandler ( "onClientResourceStart", resourceRoot,
    function ()
        txd = engineLoadTXD ("name.txd")
        engineImportTXD (txd, 26)  -- ID
        dff = engineLoadDFF ("name.dff")
        engineReplaceModel (dff, 26) -- ID
    end
)

meta.xml
 

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

 

Nope , its for normal txd and dff 

Link to comment

These are the functions you need to use:

fileExists

fileDelete

fileOpen

fileRead

engine functions for replace the model

Quick description: You can get the data from your original file using fileRead then use engine functions for the data you get from your .dff and .txd to replace the model and delete the files after using fileDelete. I hope you understand what I said because I'm on phone and can't give you an example

Edited by Hydra
Link to comment
1 hour ago, Hydra said:

These are the functions you need to use:

fileExists

fileDelete

fileOpen

fileRead

engine functions for replace the model

Quick description: You can get the data from your original file using fileRead then use engine functions for the data you get from your .dff and .txd to replace the model and delete the files after using fileDelete. I hope you understand what I said because I'm on phone and can't give you an example

Send an example whenever you can
Because I did not understand exactly 

thank you 

Link to comment
19 hours ago, TheEcstasy said:

Send an example whenever you can
Because I did not understand exactly 

thank you 

function protectModel()
   if fileExists("model.dff") then

      local replaceDFF = engineLoadDFF("model.dff")
      engineReplaceModel(replaceDFF, 411)

      local fakeFile = fileCreate("model.3d")
      fileWrite(fakeFile, "Nope")
      fileClose(fakeFile)

      fileDelete("model.dff")
   end
end
addEventHandler("onClientResourceStart", resourceRoot, protectModel)

This script will replace the model when the resource start, will make a fake file named model.3d and will delete the original file.

Edited by Hydra
  • Like 1
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...