CodyLewis Posted February 23, 2014 Share Posted February 23, 2014 How can I make a marker trigger command? I want to make it so if you enter a garage with a marker it will trigger the command handlingeditor but I can't figure out how to do it can some one please tell me how to do this? Link to comment
Bonsai Posted February 23, 2014 Share Posted February 23, 2014 Instead of triggering a command u just call the function that is attached to it. If thats what u mean. Link to comment
CodyLewis Posted February 23, 2014 Author Share Posted February 23, 2014 What I mean is how can I make it trigger the command I changed command for hedit and dont want people using it without going to garage Link to comment
CodyLewis Posted February 23, 2014 Author Share Posted February 23, 2014 I havent got any Code Cant find anything on it Link to comment
CodyLewis Posted February 23, 2014 Author Share Posted February 23, 2014 All I want to Do is make a marker that when u hit it triggers command for you and brings up gui Link to comment
pa3ck Posted February 23, 2014 Share Posted February 23, 2014 executeCommandHandler - don't forget to define the player element. Link to comment
CodyLewis Posted February 23, 2014 Author Share Posted February 23, 2014 Ok So How can I make it so when I hit marker it does it? Link to comment
Bonsai Posted February 23, 2014 Share Posted February 23, 2014 executeCommandHandler - don't forget to define the player element. But it would still be possible to use the command without being inside that marker, wouldn't it? Link to comment
CodyLewis Posted February 23, 2014 Author Share Posted February 23, 2014 Im going to have a secret command that the marker will trigger Link to comment
pa3ck Posted February 23, 2014 Share Posted February 23, 2014 There is an other way. Go to the 'hedit' folder and open up your meta.xml file. Put this line anywhere and save it: function="toggleEditor" type="client"/> --> Client side only. You can now toggle the GUI from any resource like so: marker = createMarker( 0, 0, 3, "cylinder", 1 ) addEventHandler('onClientMarkerHit', marker, function() exports.hedit:toggleEditor() end) Link to comment
CodyLewis Posted February 23, 2014 Author Share Posted February 23, 2014 Ok I'll try to see if that works Link to comment
pa3ck Posted February 24, 2014 Share Posted February 24, 2014 If you don't want the players to be able to use the command and bind ( command 'hedit' and the 'b' key ), go to this folder: hedit\client\gui. Open up 'guicreator.lua' and comment out lines 72, 73, so it should look like: --bindKey ( getUserConfig ( "usedKey" ), "down", toggleEditor ) --addCommandHandler ( getUserConfig ( "usedCommand" ), toggleEditor ) Link to comment
CodyLewis Posted February 24, 2014 Author Share Posted February 24, 2014 it isnt working the marking is apearing but when I drive car into it nothing happens Link to comment
pa3ck Posted February 24, 2014 Share Posted February 24, 2014 That's impossible. Did you restart hedit after editing the meta.xml? Link to comment
CodyLewis Posted February 24, 2014 Author Share Posted February 24, 2014 wait I might of found problem Link to comment
CodyLewis Posted February 24, 2014 Author Share Posted February 24, 2014 Ok It works Your the best Link to comment
CodyLewis Posted February 24, 2014 Author Share Posted February 24, 2014 wait one thing when I hit it it pops up for every one Link to comment
pa3ck Posted February 24, 2014 Share Posted February 24, 2014 (edited) marker = createMarker( 0, 0, 3, "cylinder", 1 ) addEventHandler('onClientMarkerHit', marker, function( hitElement) if hitElement == localPlayer or hitElement == getPedOccupiedVehicle ( localPlayer ) and getVehicleController( hitElement ) == localPlayer then exports.hedit:toggleEditor() end end) Edited February 24, 2014 by Guest Link to comment
Moderators Citizen Posted February 24, 2014 Moderators Share Posted February 24, 2014 marker = createMarker( 0, 0, 3, "cylinder", 1 ) addEventHandler('onClientMarkerHit', marker, function( hitElement) if hitElement == localPlayer or hitElement == getPedOccupiedVehicle ( localPlayer ) then exports.hedit:toggleEditor() end end) Nope, it will do the same. @CodeLewis: check if the function toggleEditor has arguments. Maybe you can specify the player to show it. Otherwise, modify that function to do so. Link to comment
pa3ck Posted February 24, 2014 Share Posted February 24, 2014 marker = createMarker( 0, 0, 3, "cylinder", 1 ) addEventHandler('onClientMarkerHit', marker, function( hitElement) if hitElement == localPlayer or hitElement == getPedOccupiedVehicle ( localPlayer ) then exports.hedit:toggleEditor() end end) Nope, it will do the same. @CodeLewis: check if the function toggleEditor has arguments. Maybe you can specify the player to show it. Otherwise, modify that function to do so. Huh? Why would it? hitElement is the element that has entered the marker, I don't get it why would it be the same. Link to comment
CodyLewis Posted February 24, 2014 Author Share Posted February 24, 2014 pa3ck's script works 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