Jump to content

trigger event problem


Wei

Recommended Posts

Whats the problem it doesn't open the window:

client:

addEvent ( "myevent", true ) 
  
function onmarkerhitevent () 
    guiSetVisible( window, true ) 
end 
  
addEventHandler ( "myevent", onmarkerhitevent  ) 

server:

cmarker = createMarker (2069.53760, -1628.82056, 12.87616, "cylinder", 2, 255, 255, 0, 50 ) 
  
function jup() 
    triggerClientEvent(myevent) 
end 
addEventHandler("onMarkerHit", cmarker, jup) 

Link to comment

try,

server:

cmarker = createMarker (2069.53760, -1628.82056, 12.87616, "cylinder", 2, 255, 255, 0, 50 ) 
  
function jup() 
    triggerClientEvent( "myevent", source) -- you need to read the arguments kenix said.  
end 
addEventHandler("onMarkerHit", cmarker, jup) 

Link to comment
local cmarker = createMarker ( 2069.53760, -1628.82056, 12.87616, "cylinder", 2, 255, 255, 0, 50 ) 
  
addEventHandler ( 'onClientMarkerHit', root, 
    function ( uPlayer ) 
        if ( source == cmarker ) then 
            guiSetVisible ( window, true ) 
        end 
    end 
) 

Link to comment
local uMarker = createMarker ( 2069.53760, -1628.82056, 12.87616, "cylinder", 2, 255, 255, 0, 50 ) 
  
addEventHandler ( 'onClientMarkerHit', uMarker, 
    function ( uPlayer ) 
        if uPlayer == localPlayer then 
            guiSetVisible ( window, true ) 
        end 
    end 
) 

Link to comment

You not add handlers for this buttons.

Instand of this

    function buttonClick(button) 
 if (button) ~= "left" then return end 
 if (source == close) then 
                guiSetVisible ( window, false ) 
                showCursor ( false) 
 end 
end 
addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) 
  
function buttonlick() 
if (source == button1) then 
triggerServerEvent ( "event1", localPlayer ) 
else if (source == button2) then 
triggerServerEvent ( "event2", localPlayer ) 
else if (source == button3) then 
triggerServerEvent ( "event3", localPlayer ) 
else if (source == button4) then 
triggerServerEvent ( "event4", localPlayer ) 
else if (source == button5) then 
triggerServerEvent ( "event5", localPlayer ) 
else if (source == button6) then 
triggerServerEvent ( "event6", localPlayer ) 
else if (source == button7) then 
triggerServerEvent ( "event7", localPlayer ) 
end 
end 
end 
end 
end 
end 
end 
end 

You need make this

function fButtonClick( ) 
    if source == button1 then 
        triggerServerEvent ( 'event1', localPlayer ) 
    elseif source == button2 then 
        triggerServerEvent ( 'event2', localPlayer ) 
    elseif source == button3 then 
        triggerServerEvent ( 'event3', localPlayer ) 
    elseif source == button4 then 
        triggerServerEvent ( 'event4', localPlayer ) 
    elseif source == button5 then 
        triggerServerEvent ( 'event5', localPlayer ) 
    elseif source == button6 then 
        triggerServerEvent ( 'event6', localPlayer ) 
    elseif source == button7 then 
        triggerServerEvent ( 'event7', localPlayer ) 
    elseif source == close then 
        guiSetVisible ( window, false ) 
        showCursor ( false ) 
    end 
end 
addEventHandler( 'onClientGUIClick', guiRoot, fButtonClick ) 

Edited by Guest
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...