KalashnikovZ Posted December 30, 2015 Posted December 30, 2015 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 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
Revolt Posted December 30, 2015 Posted December 30, 2015 This wont work. If you wish to have a custom weapon, you have to replace the model and texture of an existing one.
Captain Cody Posted December 30, 2015 Posted December 30, 2015 Well what I ment when I said make weapon invsible, and put another model over it is, give the player a weapon, set it invisible, then attach an element to it.
KalashnikovZ Posted December 30, 2015 Author Posted December 30, 2015 You know... I understood what you said, but I don't know how to make that weapon invisible? That's wgat i need an example for
Captain Cody Posted December 30, 2015 Posted December 30, 2015 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
KalashnikovZ Posted December 30, 2015 Author Posted December 30, 2015 Thanks mate, that really helped me out
Revolt Posted December 31, 2015 Posted December 31, 2015 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.
Captain Cody Posted December 31, 2015 Posted December 31, 2015 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. -
Alexs Posted December 31, 2015 Posted December 31, 2015 There isn't an element for the ped weapon and getPedWeapon returns an integer value. The only way to make a weapon invisible is replacing the texture with a transparent one.
Revolt Posted December 31, 2015 Posted December 31, 2015 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.
KalashnikovZ Posted December 31, 2015 Author Posted December 31, 2015 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.
Captain Cody Posted December 31, 2015 Posted December 31, 2015 The getpedWeapon returns the weapon that is in his hand. Meaning it should allow him to set that transparent.
n3wage Posted December 31, 2015 Posted December 31, 2015 The getpedWeapon returns the weapon that is in his hand. Meaning it should allow him to set that transparent. Player weapons aren't elements and getPedWeapon returns an int, Look at the wiki next time, The only solution is replace the weapon texture as Alexs said.
Captain Cody Posted December 31, 2015 Posted December 31, 2015 There was another page I was looking on that returned an object, I did the getPedWeapon off of memory and I thought that was the page I was looking at. I didn't recall correctly my mistake. I did something similar to making new custom weapons a while ago, I'll see if I still have that script.
Alexs Posted December 31, 2015 Posted December 31, 2015 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now