Jump to content

event problem again -.-


Wei

Recommended Posts

Posted

I don't know the difrence of source, localplayer, client, root, getRootElement(), thePlayer...

function gaga(source) 
    triggerClientEvent("guievent", source) 
end 
addEventHandler("onMarkerHit",policemarker, gaga) 

addEvent("guievent", true) 
  
function mama( localPlayer ) 
    guiSetVisible(window, true) 
    showCursor ( true ) 
end 
addEventHandler("guievent", getRootElement(), mama) 

Posted

soure is the source of the event...

so onMarkerHit, if u want it to work for a player, use something like:

function gaga(source, dim) -- source is the element that hit the marker (could be any element (car/player/object) 
  if getElementType(source) == "player" and dim then -- if element that hit the marker is a player and if the player is in the same dimension as the marker then... 
    triggerClientEvent(source,"guievent", source)  -- trigger the client event 'guievent'  
end 
addEventHandler("onMarkerHit",policemarker, gaga) 

now in ur client file:

addEvent("guievent", true) 
  
function mama() -- localPlayer isnt needed here since its clientside - nothing is needed, since its only triggered on this client and not all clients. 
    guiSetVisible(window, true) 
    showCursor ( true ) 
end 
addEventHandler("guievent", getRootElement(), mama) 

i take it u have ur window and marker defined elsewhere.

everything else u might need to know explaining about the parameters and arguments etc can be found on the wiki.

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