Jump to content

[Help]change weapon


Mido111

Recommended Posts

Hello,

It's simple, take ID weapon (https://wiki.multitheftauto.com/wiki/Weapons)

And create file "replace.lua" and copy code:

function replaceModel()  
  
  txd = engineLoadTXD("filename.txd", modelID ) -- Filename, if you file (deagle mod) name desert_eagle.txd. 
  engineImportTXD(txd, modelID) 
  
  dff = engineLoadDFF("filename.dff", ModelID ) -- Model ID, if you change skin deagle, use ID: 348 
  engineReplaceModel(dff, ModelID)  
  
  
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 

And meta.xml

<meta> 
     <info name="Weapon Mod"></info> 
     <script src="replace.lua" type="client"></script> 
     <file src="filename.txd"></file> 
     <file src="filename.dff"></file> 
</meta> 

Link to comment

So you want to completely replace the shovel and use it as a physical gun which shoots? There are several things you can do to achieve this but it may be quite difficult for you:

  • Start by replacing the shovels DFF and TXD with your choice of gun (for example the deagle).
  • You can use bindKey to bind left-click and using getPedTarget you can get a target player.
  • When the player shoots you can deduct health from the target using setElementHealth and getElementHealth.
  • Then to make the sound effects you can use playSound and setSoundVolume for all nearby players.
  • For the blood effect (when they're shot) you can use fxAddBlood which will simulate when the player is shot with a real GTA gun.
  • For the crosshair you can use getKeyState (to check if they're aiming) and then render some dx shapes.

Link to comment
So you want to completely replace the shovel and use it as a physical gun which shoots? There are several things you can do to achieve this but it may be quite difficult for you:

  • Start by replacing the shovels DFF and TXD with your choice of gun (for example the deagle).
  • You can use bindKey to bind left-click and using getPedTarget you can get a target player.
  • When the player shoots you can deduct health from the target using setElementHealth and getElementHealth.
  • Then to make the sound effects you can use playSound and setSoundVolume for all nearby players.
  • For the blood effect (when they're shot) you can use fxAddBlood which will simulate when the player is shot with a real GTA gun.
  • For the crosshair you can use getKeyState (to check if they're aiming) and then render some dx shapes.

any more ?? , or another way with setWeaponProperty

Link to comment
  • 3 weeks later...

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