Jump to content

GUI not showing up


Bean666

Recommended Posts

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

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
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
  • Moderators

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

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