Jump to content

need help with triggerevents


icarus

Recommended Posts

So what i wanna make is, create a marker at serverside, and when a player hits that marker it shows a gui that is at clientside.

I made this but doesnt work, can someone help me.

-----Serverside 
local door1marker = createMarker ( 2655, 2706, 411, "arrow", 1, 100, 20, 20 ) 
  
function door1markerhit( hitElement, matchingDimension )  
    if  getElementType( hitElement ) == Player then 
     triggerClientEvent ( Player, "ondoor1markerhit", Player ) 
end 
end 
addEventHandler( "onMarkerHit", door1marker, door1markerhit ) 

----Clientside 
addEvent ( "ondoor1markerhit", true ) 
function showguidoor1 () 
    guiSetVisible(keypadWindow,true) 
    showCursor(true,true) 
    setElementData(keypadWindow,"keypadID","GateKeypadCode") 
end 
addEventHandler( "ondoor1markerhit", getLocalPlayer ( ), showguidoor1 ) 

Link to comment
  • Other Languages Moderators

You don't need to make it server side.

-- Client Side --

local door1marker = createMarker(2655, 2706, 411, "arrow", 1, 100, 20, 20) 
  
function door1markerhit(player)  
     if  getElementType(player) == "player" and player == localPlayer then 
          guiSetVisible(keypadWindow,true) 
          showCursor(true) 
          setElementData(keypadWindow,"keypadID","GateKeypadCode") 
     end 
end 
addEventHandler( "onClientMarkerHit", door1marker, door1markerhit) 

Link to comment
local door1marker = createMarker ( 2655, 2706, 411, "arrow", 1, 100, 20, 20 ) 
  
function door1markerhit( hitElement, matchingDimension ) 
    if  ( getElementType( hitElement ) == "player" ) then 
          triggerClientEvent ( hitElement, "ondoor1markerhit", hitElement ) 
     end 
end 
addEventHandler( "onMarkerHit", door1marker, door1markerhit ) 

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