manve1 Posted November 23, 2012 Share Posted November 23, 2012 Would there be a way to make that if a player goes a lot higher then the marker is, he wouldn't get the function for example like a GUI shown if it is created that when u hit the marker u get a gui shown ---------------------------------- --Better explanation i think-- ---------------------------------- I have a problem, when i don't hit the marker ( cylinder ) i just go flying through the top of it, i get a gui visible ( which i only want to make like if you hit the marker ) P.s. Its a cylinder, and i only want to know if it is possible to make that when the original cylinder is hit ( colored bit ) you get the gui visible, not when in mid air. Link to comment
uhm Posted November 23, 2012 Share Posted November 23, 2012 (edited) could change it to ring marker type or add to the handler that the ped position must be within range using getElementPosition Edited November 23, 2012 by Guest Link to comment
manve1 Posted November 23, 2012 Author Share Posted November 23, 2012 how could i use "getElementPosition" to fix my problem? Link to comment
uhm Posted November 23, 2012 Share Posted November 23, 2012 oh I updated my post after you replied Link to comment
manve1 Posted November 23, 2012 Author Share Posted November 23, 2012 sorry uhm, i don't get your script, but this is how mine looks ( just a small piece ): local guiFinnish = guiCreateWindow( 0.25, 0.3, 0.5, 0.3, 'Quit Job', true ) local markerFinnishJob = createMarker( 321, 874, 19.3, 'cylinder', 2.0, 255, 255, 0, 170 ) addEventHandler('onClientMarkerHit', markerFinnishJob, function() guiSetVisible( guiFinnish, true ) showCursor( true ) end, false ) Link to comment
uhm Posted November 23, 2012 Share Posted November 23, 2012 Ok, check if this works: local guiFinnish = guiCreateWindow( 0.25, 0.3, 0.5, 0.3, 'Quit Job', true ) local markerFinnishJob = createMarker( 321, 874, 19.3, 'cylinder', 2.0, 255, 255, 0, 170 ) addEventHandler('onClientMarkerHit', markerFinnishJob, function(hitPlayer, matchingDimension) -- get position of ped and marker local pedx,pedy,pedz = getElementPosition(hitPlayer) local cpx,cpy,cpz = getElementPosition(source) -- check if the player is within 10 meters below or above the checkpoint, if so execute desired code -- also check for dimension since its free if (matchingDimension and ((pedz - cpz < 10 and pedz - cpz > 0) or (cpz - pedz < 10 and cpz - pedz > 0))) then guiSetVisible( guiFinnish, true ) showCursor( true ) end end , false) Link to comment
manve1 Posted November 23, 2012 Author Share Posted November 23, 2012 Worked, just for the marker had to change "source" to the name of the marker, don't know why, but worked fine thanx 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