KillerNico Posted April 17, 2011 Posted April 17, 2011 I have made a gui. and i want to open it if i hit a marker! But how ??
#Paper Posted April 17, 2011 Posted April 17, 2011 shopMarker = createMarker (2308.87,-1.91,25.9,"cylinder",1,255,0,0,128) function showGui (hitPlayer, matchingDimension) --------- end addEventHandler("onMarkerHit",shopMarker,showGui)
Castillo Posted April 17, 2011 Posted April 17, 2011 Acitano, that's not a valid example. --server side myMarker = createMarker (2308.87,-1.91,25.9,"cylinder",1,255,0,0,128) function showGui (hitPlayer, matchingDimension) triggerClientEvent(hitPlayer,"showGUI",getRootElement()) end addEventHandler("onMarkerHit",myMarker,showGui) --client side addEvent("showGUI",true) addEventHandler("showGUI",getRootElement(), function () guiSetVisible(myGUIElement,true) end)
#Paper Posted April 17, 2011 Posted April 17, 2011 Acitano, that's not a valid example.--server side myMarker = createMarker (2308.87,-1.91,25.9,"cylinder",1,255,0,0,128) function showGui (hitPlayer, matchingDimension) triggerClientEvent(hitPlayer,"showGUI",getRootElement()) end addEventHandler("onMarkerHit",myMarker,showGui) --client side addEvent("showGUI",true) addEventHandler("showGUI",getRootElement(), function () guiSetVisible(myGUIElement,true) end) I know, i wanted to let he to make the CS part
AGENT_STEELMEAT Posted April 18, 2011 Posted April 18, 2011 Ehm, why not create the marker clientside when the resource starts, then use onClientMarkerHit to show the GUI? Saves bandwidth and works faster. Also, why is myMarker a global variable? No need for that. local myMarker = createMarker (2308.87,-1.91,25.9,"cylinder",1,255,0,0,128) function showGui (hitPlayer, matchingDimension) --gui code here end addEventHandler("onClientMarkerHit",myMarker,showGui)
Castillo Posted April 18, 2011 Posted April 18, 2011 John, i was thinking the same, but since he posted server-side, i continued the code.
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