Wei Posted April 22, 2012 Share Posted April 22, 2012 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
Kenix Posted April 22, 2012 Share Posted April 22, 2012 (edited) triggerClientEvent(myevent) lolwhat? Did you read arguments? Edited April 22, 2012 by Guest Link to comment
Smart. Posted April 22, 2012 Share Posted April 22, 2012 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
Kenix Posted April 22, 2012 Share Posted April 22, 2012 seb:>, wrong. It's triggered for all players. I think he not needed it. Link to comment
Kenix Posted April 22, 2012 Share Posted April 22, 2012 Did you create and define window? Also use /debugscript 3 and make your marker little upper + ~2 ( for test ).( because if your marker below ground, event not triggered ( "onMarkerHit" ) ) Link to comment
Michael# Posted April 22, 2012 Share Posted April 22, 2012 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
Smart. Posted April 22, 2012 Share Posted April 22, 2012 Helped him over skype, the problem was he had button5 = guiCreateButton(236,104,211,71,"Minigun" /n/ "6000$",false,window) where it's supposed to be button5 = guiCreateButton(236,104,211,71,"Minigun\n6000$",false,window) Link to comment
Kenix Posted April 22, 2012 Share Posted April 22, 2012 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
Wei Posted April 22, 2012 Author Share Posted April 22, 2012 (edited) - Edited April 23, 2012 by Guest Link to comment
Kenix Posted April 22, 2012 Share Posted April 22, 2012 (edited) 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 April 22, 2012 by Guest Link to comment
Castillo Posted April 22, 2012 Share Posted April 22, 2012 @server side: Change "client" to "source" at giveWeapon. Link to comment
Wei Posted April 22, 2012 Author Share Posted April 22, 2012 how can I do that. Can you show me example ? @Solidsnake Same Edit: Kenix works thanks ! Link to comment
Castillo Posted April 22, 2012 Share Posted April 22, 2012 Is that hard to find and replace? Link to comment
Kenix Posted April 22, 2012 Share Posted April 22, 2012 (edited) Edit: Kenix works thanks ! No problem. Edited April 22, 2012 by Guest Link to comment
Castillo Posted April 22, 2012 Share Posted April 22, 2012 Oh, my bad, I forgot about that. Link to comment
Wei Posted April 22, 2012 Author Share Posted April 22, 2012 Is that hard to find and replace? I said that to kenix. He edited he's post... 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