GhostXoP Posted December 27, 2012 Share Posted December 27, 2012 Is there a way or an event that triggers if within range of a sound? Like, an event triggers when someone fires a gun within 20 feet of the element? I would plant a colshape that lasted for a half a second around the person firing a gun using on ped or player weapon fire event, but it wouldnt work as users must "enter" the colshape to trigger the colshape event, if you plant the colshape over an element, while the element is within the colshape, the element must leave and reenter the colshape to trigger the event, Or is that not true? Link to comment
Castillo Posted December 27, 2012 Share Posted December 27, 2012 I think that you can use the weapon fire event plus the function to calculate the distance. onClientPlayerWeaponFire getDistanceBetweenPoints3D Link to comment
GhostXoP Posted December 27, 2012 Author Share Posted December 27, 2012 A good idea, but how would this trigger the event to the player listening? Link to comment
Castillo Posted December 27, 2012 Share Posted December 27, 2012 addEventHandler ( "onClientPlayerWeaponFire", root, function ( ) local x, y, z = getElementPosition ( source ) local lx, ly, lz = getElementPosition ( localPlayer ) local distance = getDistanceBetweenPoints3D ( x, y, z, lx, ly, lz ) outputChatBox ( getPlayerName ( source ) .." fired a weapon at distance: ".. distance ) end ) Test that, I don't know if it'll work. Link to comment
GhostXoP Posted December 27, 2012 Author Share Posted December 27, 2012 I see what you mean now, even if it doesnt work i understand what your getting at. Thanks 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