Jump to content

Make weapon invisible, then put another model to its place?


KalashnikovZ

Recommended Posts

I'd like to set the weapon in my hand invisible, then put a model to it's place. I started editing a script, guys, please don't laugh, I'm a real beginner :D

function fegyo() 
   local weapon = createWeapon("m4", getElementPosition(localPlayer)) 
   setElementAlpha(localWeapon, 0) 
   setWeaponClipAmmo(weapon, 40) 
   setWeaponState(weapon, firing) 
end 
addCommandHandler(gun, fegyo) 

I would really enjoy someone's example script :'(

Link to comment
function customWep () 
 local weapon = givePedWeapon (source,31,5000) 
setElementAlpha(weapon, 0) 
local gunModel = createElement(object,'ModelId') -- ModelId = Find a unused Id and replace Dff, and TXD with gun model you want. -- 
attachElements ( gunModel, weapon) 
end 

That won't work. givePedWeapon(..) does not return a weapon, it returns a boolean. Therefore, that will cause an error.

Link to comment

Oh btw it's

giveWeapon, not givePedWeapon 

- Messed up a bit there, but to the point of what you just said, it should return the weapon that was given, if that does not work, use

weapon = getPedWeapon(source) 

function customWep () 
 giveWeapon (source,31,5000) 
 local weapon = getPedWeapon(source) 
 setElementAlpha(weapon, 0) 
 local gunModel = createElement(object,'ModelId') -- ModelId = Find a unused Id and replace Dff, and TXD with gun model you want. -- 
attachElements ( gunModel, weapon) 
end 

- That should work, sorry about that, forgot about few things there. -

Link to comment

codylewiz, open the wiki and you'll see that it only returns/pushes back a boolean, not an element. Don't spread false information to the people who are willing to learn.

KalashnikovZ, do what Alexs_Steel said, it is the only (or at least the easiest) way to accomplish what you wish to do.

Link to comment
I know how can I change model of a weapon, of course engineLoadDFF, and TXD, I know it, but I'm heading to make 2 different models, for 1 weapon type.

You should replace the original texture with a transparent one and then attach an object as if it were the weapon.

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