Jump to content

Marker Trigger Command


CodyLewis

Recommended Posts

Posted

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?

Posted

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) 
  

Posted

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 ) 

Posted (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 by Guest
  • Moderators
Posted
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.

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...