[M]ister Posted December 13, 2013 Share Posted December 13, 2013 Hello, I created a script that when a player enter the marker one gui opens, I wanted if another player is trying to access window , it can not and a message appears saying that it can not because there is already a player with the window open local marker = createMarker( -2631, 1377, 6, "Cylinder", 0.8, 0, 0, 255, 150) window = guiCreateWindow(400,400,400,264,"Panel Edit", false) guiSetVisible(window, false) Close = guiCreateButton(365, 10, 25, 25, "X", false, window) guiSetFont(Close, 'sans') addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == Close ) then guiSetVisible ( window, false ) showCursor ( false ) end end) addEventHandler("onClientMarkerHit", marker, function (hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(window) then guiSetVisible(window, true) showCursor(true) end end end) Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 You should create the marker server side, because if you do it client side, it won't be easy to do what you want. Link to comment
[M]ister Posted December 13, 2013 Author Share Posted December 13, 2013 Please me more information ? Client: window = guiCreateWindow(400,400,400,264,"Panel Edit", false) guiSetVisible(window, false) Close = guiCreateButton(365, 10, 25, 25, "X", false, window) guiSetFont(Close, 'sans') addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == Close ) then guiSetVisible ( window, false ) showCursor ( false ) end end) addEvent("enterMarker", true) addEventHandler("enterMarker", root, function () if not guiGetVisible(window) then guiSetVisible(window, true) showCursor(true) end end) Server: local marker = createMarker( -2625, 1380, 7, "cylinder", 0.8, 0, 0, 255, 150) addEventHandler( "onMarkerHit", marker, function(hitElement) if getElementType(hitElement) == "player" then triggerClientEvent(root, "enterMarker", source) end end) Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 local marker = createMarker ( -2625, 1380, 7, "cylinder", 0.8, 0, 0, 255, 150 ) local playerInside = false addEventHandler ( "onMarkerHit", marker, function ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then if ( not playerInside ) then triggerClientEvent ( hitElement, "enterMarker", hitElement ) playerInside = true end end end ) addEventHandler ( "onMarkerLeave", marker, function ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then playerInside = false end end ) Link to comment
[M]ister Posted December 13, 2013 Author Share Posted December 13, 2013 It is complete the script or do I have to add anything else? why not have two people to test Link to comment
Castillo Posted December 13, 2013 Share Posted December 13, 2013 Should be working, yes. Link to comment
[M]ister Posted December 13, 2013 Author Share Posted December 13, 2013 Thanks friend, I'll soon be testing with two players Link to comment
[M]ister Posted December 14, 2013 Author Share Posted December 14, 2013 Does not work, if a player it is in maker, another player can enter and open the gui Link to comment
Castillo Posted December 14, 2013 Share Posted December 14, 2013 local marker = createMarker ( -2625, 1380, 7, "cylinder", 0.8, 0, 0, 255, 150 ) addEventHandler ( "onMarkerHit", marker, function ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then if ( #getElementsWithinColShape ( getElementColShape ( source ), "player" ) == 1 ) then triggerClientEvent ( hitElement, "enterMarker", hitElement ) end end end ) Try that one instead. Link to comment
[M]ister Posted December 14, 2013 Author Share Posted December 14, 2013 Now the panel does not open when I enter the marker! Link to comment
Castillo Posted December 14, 2013 Share Posted December 14, 2013 Copy the last code again. Link to comment
[M]ister Posted December 14, 2013 Author Share Posted December 14, 2013 very much thank, it's working perfectly 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