fairyoggy Posted April 30, 2019 Share Posted April 30, 2019 Quote -- server function addMarkers ( res ) marker = createPickup (x,y,z, 3, 2663, 1, 1 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), addMarkers ) function showAmmoGUI( hitPlayer, matchingDimension ) triggerClientEvent( hitPlayer, "showAmmoGUI_Ed", getRootElement(), hitPlayer, marker ) end -- client function showAmmoGUI( hitPlayer, type ) guiSetVisible ( GUIEditor_Window[1], true ) showCursor( true ) end addEvent("showAmmoGUI_Ed",true) addEventHandler("showAmmoGUI_Ed",getRootElement(),showAmmoGUI) I’m ready to do that when a player gets on a marker. The gui window opens but i need when the player is on the marker, you must click the button (for example, N) and after clicking the button, the gui window will open. It is necessary that this button (N) works only in the marker area Link to comment
DNL291 Posted April 30, 2019 Share Posted April 30, 2019 getElementColShapebindKeyisElementWithinColShapeguiSetVisible I recommend you to use createPickup on client-side as well. Link to comment
SaNoR Posted April 30, 2019 Share Posted April 30, 2019 function showAmmoGUI(hitPlayer) triggerClientEvent(hitPlayer, "showAmmoGUI_Ed", getRootElement(), hitPlayer, marker) end addEventHandler("onPlayerPickupHit", marker, function() bindKey(source, "N", "down", showAmmoGUI) end) addEventHandler("onPlayerPickupLeave", marker, function() unbindKey(source, "N", "down", showAmmoGUI) end) Link to comment
fairyoggy Posted April 30, 2019 Author Share Posted April 30, 2019 7 hours ago, SaNoR said: function showAmmoGUI(hitPlayer) triggerClientEvent(hitPlayer, "showAmmoGUI_Ed", getRootElement(), hitPlayer, marker) end addEventHandler("onPlayerPickupHit", marker, function() bindKey(source, "N", "down", showAmmoGUI) end) addEventHandler("onPlayerPickupLeave", marker, function() unbindKey(source, "N", "down", showAmmoGUI) end) and how to write a condition that something like "if button == N then triggerClientEvent( hitPlayer, "showAmmoGUI_Ed", getRootElement(), hitPlayer, marker ) else CancelEvent() ___ how to make it right? Link to comment
TAPL Posted May 4, 2019 Share Posted May 4, 2019 (edited) Try -- server function addMarkers() marker = createPickup(x,y,z, 3, 2663, 1, 1) end addEventHandler("onResourceStart", resourceRoot, addMarkers) function pickupEvent() triggerClientEvent(source, "trAmmoGUI_Ed", source, eventName == "onPlayerPickupHit" and true or false) end addEventHandler("onPlayerPickupHit", marker, pickupEvent) addEventHandler("onPlayerPickupLeave", marker, pickupEvent) -- client addEvent("trAmmoGUI_Ed",true) addEventHandler("trAmmoGUI_Ed", root, function (type) if type then bindKey("n", "down", bindTheKey) else unbindKey("n", "down", bindTheKey) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end) function bindTheKey() if not guiGetVisible(GUIEditor_Window[1]) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end) Edited May 4, 2019 by TAPL 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