Bean666 Posted May 28, 2016 Share Posted May 28, 2016 hello. when i hit the marker with colshape, the GUI doesn't show up. server theMarker = createMarker( 2492.1240234375, -1670.7578125, 12.3, "cylinder", 1.5, 0, 255, 0, 80 ) local theShape = getElementColShape( theMarker ) function oncolhit (player, hitElement) if getElementType ( player ) == "player" then triggerClientEvent(player, "showGUI", player) end end addEventHandler ("onColShapeHit", theShape, oncolhit) client: addEvent("showGUI", true) function guishow(player) guiSetVisible(classWnd, true) showCursor(true) end addEventHandler("showGUI",getRootElement(),guishow) Link to comment
roaddog Posted May 28, 2016 Share Posted May 28, 2016 No warning or error? Try debugging by adding ouputChatBox if the function is called or not Link to comment
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 no warning. nothing shows up in debug. Link to comment
Anubhav Posted May 28, 2016 Share Posted May 28, 2016 The marker might not have been created. It happens sometimes. theMarker = createMarker( 2492.1240234375, -1670.7578125, 12.3, "cylinder", 1.5, 0, 255, 0, 80 ) theShape = nil function oncolhit (player, hitElement) if getElementType ( player ) == "player" then triggerClientEvent(player, "showGUI", player) end end setTimer( function( ) theShape = getElementColShape( theMarker ) addEventHandler ("onColShapeHit", theShape, oncolhit) end , 1000, 1) Link to comment
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 The marker might not have been created. It happens sometimes. theMarker = createMarker( 2492.1240234375, -1670.7578125, 12.3, "cylinder", 1.5, 0, 255, 0, 80 ) theShape = nil function oncolhit (player, hitElement) if getElementType ( player ) == "player" then triggerClientEvent(player, "showGUI", player) end end setTimer( function( ) theShape = getElementColShape( theMarker ) addEventHandler ("onColShapeHit", theShape, oncolhit) end , 1000, 1) not working. Link to comment
roaddog Posted May 28, 2016 Share Posted May 28, 2016 I think its a bug, because i try using that in server it doesnt trigger the onColShapeHit but it works if the marker created in client. Link to comment
Bean666 Posted May 28, 2016 Author Share Posted May 28, 2016 Aight... thanks for the info. i hope it'll be fixed soon if it's a bug, but i think it's not. Link to comment
Moderators Citizen Posted May 28, 2016 Moderators Share Posted May 28, 2016 Actually you should use the event onMarkerHit directly on the marker instead of getting the colshape of it and then use onColShapeHit on that colshape: theMarker = createMarker( 2492.1240234375, -1670.7578125, 12.3, "cylinder", 1.5, 0, 255, 0, 80 ) function onmarkerhit( hitElement ) if getElementType( hitElement ) == "player" then triggerClientEvent(hitElement, "showGUI", hitElement) end end addEventHandler ("onMarkerHit", theMarker, onmarkerhit) onColShapeHit was meant to be used with colshapes you created with these colshapes functions: createColCircle createColCuboid createColRectangle createColSphere createColTube createColPolygon But yeah adding an onColShapeHit on a maker's colshape should works too, this bug needs to be investigated. 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