Monty Posted May 19, 2012 Share Posted May 19, 2012 why when i open a gui any player in the server see it??? here the code client local marker = createMarker( 1787.5069580078, -1382.6146240234, 14.7578125, "Cylinder", 2, 41, 41, 41, 153) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"FBI agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take FBI team job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function FBIjob(hitElement) if getElementType(hitElement) == "player" then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, FBIjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, FBIjobleave) function joinTeam() triggerServerEvent("setFBI",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeFBIWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeFBIWindow, false) server: function createFBITeam () FBITeam = createTeam ("FBI", 41, 41, 41) end addEventHandler ("onResourceStart", resourceRoot, createFBITeam) function joinFBI() --- local gang = exports [ 'ROADgang' ]:getAccountGang ( getAccountName ( getPlayerAccount ( source ) ) ) --- if ( gang == "FBI" ) then setPlayerTeam(source,FBITeam) setElementModel(source,286) setElementData( source, "Occupation", "FBI", true ) outputChatBox("You are now an FBI agent.",source,0,255,0) end addEvent("setFBI", true) addEventHandler("setFBI",root,joinFBI) Link to comment
Guest Guest4401 Posted May 19, 2012 Share Posted May 19, 2012 local marker = createMarker( 1787.5069580078, -1382.6146240234, 14.7578125, "Cylinder", 2, 41, 41, 41, 153) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"FBI agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take FBI team job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function FBIjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, FBIjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, FBIjobleave) function joinTeam() triggerServerEvent("setFBI",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeFBIWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeFBIWindow, false) Link to comment
Stanley Sathler Posted May 19, 2012 Share Posted May 19, 2012 Oh, I also had this question. Karthik, what did you do? Added the condition "and (hitElement == localPlayer)"? Link to comment
Noneatme Posted May 20, 2012 Share Posted May 20, 2012 He added a query whether the hitElement is the local player, and no other player(omfg bad english ) - Multivan Link to comment
Stanley Sathler Posted May 20, 2012 Share Posted May 20, 2012 Thank you for the reply, Multivan. =D 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