TioTiago Posted July 14, 2015 Posted July 14, 2015 Wanted when firing on a bed (id 1812) created a ped, I tried this but to no avail: / function onlyFunction () if getElementType (hitElement) == "object" and getElementModel (hitElement) == 1812 then x,y,z = getElementPosition(hitElement) createPed (0, x, y, z, true) end end addEventHandler ("onClientPlayerWeaponFire", getRootElement(), onlyFunction) O que está errado? ty
lolman Posted July 15, 2015 Posted July 15, 2015 I think that making onClientPlayerDamage would he better...
GTX Posted July 15, 2015 Posted July 15, 2015 I think that making onClientPlayerDamage would he better... onClientPlayerDamage doesn't trigger when an object is hit. You forgot to pass a parameter to the function. function onlyFunction (hitElement) if getElementType (hitElement) == "object" and getElementModel (hitElement) == 1812 then local x,y,z = getElementPosition(hitElement) createPed (0, x, y, z, true) end end addEventHandler ("onClientPlayerWeaponFire", getRootElement(), onlyFunction)
TioTiago Posted July 15, 2015 Author Posted July 15, 2015 even removing getElementModel (hitElement) == 1812 it does not work function onlyFunction (hitElement) if getElementType (hitElement) == "object" then local x,y,z = getElementPosition(hitElement) createPed (0, x, y, z, true) end end addEventHandler ("onClientPlayerWeaponFire", getRootElement(), onlyFunction)
lolman Posted July 15, 2015 Posted July 15, 2015 Use onClientObjectDamage. Lmaoo didnt even know that there was a function called with that name. Because of you, i've learned something new today ! Thank you
GTX Posted July 15, 2015 Posted July 15, 2015 You're both welcome I didn't know that it exists also, but I found it out pretty easily Makes sense tho, since it's a useful function. By the way, does it work with weapons? I had small doubt in this case.
TioTiago Posted July 15, 2015 Author Posted July 15, 2015 You're both welcome I didn't know that it exists also, but I found it out pretty easily Makes sense tho, since it's a useful function. By the way, does it work with weapons? I had small doubt in this case. yes, work with weapons.
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