yousseftawab Posted May 2, 2012 Share Posted May 2, 2012 please help I made a lot of jobs and everything is working well but when someone walks into the marker the gui appears to everyone not him only. I want the Gui to appear to him only I tried everything please help me. here is the code: local marker = createMarker( 94.800003051758, 1925.1999511719, 17, "Cylinder", 2, 40, 73, 0, 200) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} windowjob = guiCreateWindow(531,232,301,397,"Armed Forces",false) guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"Welcome To Armed Forces\n\nTo take Armed Forces job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) function AFjob(hitElement) if getElementType(hitElement) == "player" then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, AFjob) function AFjobleave(leaveElement) if getElementType(leaveElement) == "player" then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, AFjobleave) function joinTeam() triggerServerEvent("setAF",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeAFWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeAFWindow, false) server side: function createTeamsOnStart () teamAF = createTeam ( "Armed Forces", 40, 73, 0 ) setTeamFriendlyFire ( teamAF, false ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function joinAF() setPlayerTeam(source,teamAF) setElementModel(source,287) setPlayerNametagColor (source, 40, 73, 0 ) giveWeapon ( source, 3, 1 ) setElementData( source, "Occupation", "Armed Forces", true ) outputChatBox("You have been employed as Armed Forces.",source,0,255,0) end addEvent("setAF", true) addEventHandler("setAF",root,joinAF) Link to comment
Kenix Posted May 2, 2012 Share Posted May 2, 2012 CUT function AFjob( pPlayer ) if pPlayer == localPlayer then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, AFjob) function AFjobleave( pPlayer ) if pPlayer == localPlayer then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, AFjobleave) You should use this condition in events onClientMarkerLeave, onClientMarkerHit. if pPlayer == localPlayer then 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