Jump to content

Replacing Weapon TXD/DFF


vanishSHC

Recommended Posts

Hello again. I'm having an issue trying to import a txd/dff over the brassknuckles model into my server. Instead of having brassknuckles I want to replace it with a cigar. Here is the code.

Meta:

<meta> 
    <info author="n0ps" version="1.1" name="textures" type="misc" /> 
    <script src="skins.lua" type="client" />  
  
    <file src="models/brassknuckles.txd"/> 
    <file src="models/brassknuckles.dff"/> 
  
</meta> 

skin.lua:

  
function onResourceStart() 
       blunt = engineLoadTXD ( "models/brassknuckles.txd" ) 
    engineImportTXD ( blunt, 331 ) 
     
    dff = engineLoadDFF ( "models/brassknuckles.dff", 0 ) 
        engineReplaceModel ( dff, 331 ) 
     
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart) 
  
  

When I load it, I have no model at all for the brass knuckles. No console errors. I Believe its something to do with the engineLoadDFF line. However the wiki tells me I shouldnt use a number if im not replacing a vehicle texture.

Any ideas?

Link to comment

You could always attach another object to the hand bone of the ped, and replace that object with your cigar. Although, we had mixed results when testing that technique on the DKR Server for universal Santa hats attached to ped head bone - sync was ok but ped rotation (eg going down a slope) failed. It might be even worse for a ped's hand, not sure. You could always give it a go, or just wait until a later version of MTA and do it the way you suggested originally.

Edited by Guest
Link to comment

Ah well that sounds like it'll work. The goal is to just make a stationary smoking script but anyway.Im having an issue so far

local xl,yl,zl = getPedBonePosition (ped, 25) 
function bluntequip () 
 local blunt = createObject (1485, 0,0,0) 
    attachElements ( blunt, getLocalPlayer(), xl, yl, zl + 1 ) 
end 
  
-- attach it to an event 
addCommandHandler ( "smokeblunt" , bluntequip ) 

I am perplexed as I vaguely know what I am doing at this point lol Obviously this code doesnt work, neither did my last attempt. :( I know im using the right parameters perhaps missing a couple things

Link to comment
  
function bluntequip () 
local xl,yl,zl = getPedBonePosition (getLocalPlayer(), 25) 
 local blunt = createObject (1485, 0,0,0) 
    attachElements ( blunt, getLocalPlayer(), xl, yl, zl + 1 ) 
end 
addCommandHandler ( "smokeblunt" , bluntequip ) 

maybe that? i didn't know why you put out of the function the getPedBonePosition and as argument you put "ped"

Link to comment
attachElements ( blunt, getLocalPlayer(), xl, yl, zl + 1 ) 

Incorrect usage of parameters 3, 4, and 5. These are offsets of position in distance.

If you want to make a blunt-smoking resource, check out the included briefcase resource for the MTA server. It basically attaches a briefcase to the player's left or right hand.

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