RekZ Posted March 16, 2018 Share Posted March 16, 2018 function onPlayerWeaponFire (weapon, endX, endY, endZ, hitElement, startX, startY, startZ) if isElement(hitElement) and getElementType(hitElement) == "player" then if weapon == 34 then outputChatBox( "* Damage" ) end end end addEventHandler("onPlayerWeaponFire", getRootElement(), onPlayerWeaponFire) When i use the sniper and i shot it dont give me the chatbox but if i remove the second line ( isElement(....) ) it work why ? Link to comment
XaskeL Posted March 16, 2018 Share Posted March 16, 2018 (edited) 59 minutes ago, RekZ said: function onPlayerWeaponFire (weapon, endX, endY, endZ, hitElement, startX, startY, startZ) if isElement(hitElement) and getElementType(hitElement) == "player" then if weapon == 34 then outputChatBox( "* Damage" ) end end end addEventHandler("onPlayerWeaponFire", getRootElement(), onPlayerWeaponFire) When i use the sniper and i shot it dont give me the chatbox but if i remove the second line ( isElement(....) ) it work why ? Check returning value a function "isElement" outputChatBox("Return: "..tostring(isElement(hitElement)) hitElement: an element which was hit by a shot. Currently this can be only another player. Edited March 16, 2018 by XaskeL Link to comment
RekZ Posted March 16, 2018 Author Share Posted March 16, 2018 (edited) false it seems that there is no element, but whit others weapons return true Edited March 16, 2018 by RekZ Link to comment
XaskeL Posted March 16, 2018 Share Posted March 16, 2018 (edited) 19 minutes ago, RekZ said: false it seems that there is no element, but whit others weapons return true maybe this is a bug? I would check, but there's no way. The lock in the MTA forever. haha. Don't use "isElement" otherwise the damage would not have passed if there was no element Edited March 16, 2018 by XaskeL Link to comment
RekZ Posted March 16, 2018 Author Share Posted March 16, 2018 if i dont use isElement the element dont receive the damage whit sniper is the same dont detect the element >-< Link to comment
RekZ Posted March 17, 2018 Author Share Posted March 17, 2018 Sorry for the double post, but what i can do >-< the players in my server cant use the sniper now Link to comment
Storm-Hanma Posted March 17, 2018 Share Posted March 17, 2018 (edited) For freeroam its eassy press p panel then double click freeroam settings /disable weapon add here the weapon id save then restart free roam If you want in script type give function of take weapon ! In damage purpose(body parts) use cancel event ! Go through MTA sa wiki you will get all Edited March 17, 2018 by Khadeer143 1 Link to comment
RekZ Posted March 17, 2018 Author Share Posted March 17, 2018 1 hour ago, Khadeer143 said: For freeroam its eassy press p panel then double click freeroam settings /disable weapon add here the weapon id save then restart free roam If you want in script type give function of take weapon ! In damage purpose(body parts) use cancel event ! Go through MTA sa wiki you will get all You only comment the post and dont see what is the problem right... the problem is the function not the gamemode ._. ? Link to comment
Storm-Hanma Posted March 18, 2018 Share Posted March 18, 2018 23 hours ago, RekZ said: Sorry for the double post, but what i can do >-< the players in my server cant use the sniper now you asked this and i replied the easiest way to do yes it depends on gamemode to if it is freeroam then you can forbid weapons and if want to not use sniper i suggest you how to do also use function forbidWeapons( previousWeaponID, currentWeaponID ) then if weapon - weapon ID then then take the weapon by setting timer setTimer(takeWeapon,50,1,source,currentWeaponID) Link to comment
RekZ Posted March 18, 2018 Author Share Posted March 18, 2018 (edited) I have a custom damage system for weapons and the event dont detect any element whit sniper so if no exist element player cant be hit by other players because the function i think dont work whit this weapon.. this is the problem. onPlayerWeaponFire PD : You only read one comment no the post :v Edited March 18, 2018 by RekZ Link to comment
RekZ Posted March 20, 2018 Author Share Posted March 20, 2018 What ever i post the function in the Mantis because i think is a bug :3 just i need to wait now https://bugs.mtasa.com/view.php?id=9827 Link to comment
Skully Posted March 20, 2018 Share Posted March 20, 2018 Have you tried this with bullet sync enabled? Link to comment
RekZ Posted March 20, 2018 Author Share Posted March 20, 2018 (edited) yeah is enabled like the wiki said " Note: This event works only with weapons which have enabled bullet sync. " Edited March 20, 2018 by RekZ Link to comment
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