LeSp33dy Posted October 30, 2014 Share Posted October 30, 2014 Well, I was doing a trucker job, made GUI all set, working fine n' stuff but now, I tried to do when the player clicks the button "Take Job" that then it sets ElementData to "Trucker" at the bottom. I prefer setElementData because It's easy to work with it as you got then getElementData to continue with the script.: Client: local jobMarker = createMarker(-1940.9755859375, 2383.365234375, 48.6953125,"cylinder", 2, 125,255,0 ) local blip = createBlipAttachedTo(jobMarker, 51,3) GUIEditor = { button = {}, window = {}, staticimage = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(543, 151, 284, 462, " - Truckers Job", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF6B00") GUIEditor.memo[1] = guiCreateMemo(10, 29, 249, 179, "Howdy'\nMa' name is Bob and I'm the boss here.\nI employ good drivers so if you are one\nof them, I'd like to see you in my job.\nAll you have to do is get yo' self a truck\nand go to your delivery place which is\nlocated with a grey truck on your\nminimap.\n\nGood luck,\nBob.", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[1], true) jobbutton = guiCreateButton(13, 385, 109, 57, "Take job.", false, GUIEditor.window[1]) guiSetFont(jobbutton, "default-bold-small") exitbutton = guiCreateButton(132, 385, 137, 57, "Exit ", false, GUIEditor.window[1]) guiSetFont(exitbutton, "default-bold-small") GUIEditor.staticimage[1] = guiCreateStaticImage(13, 213, 246, 162, ":guieditor/images/examples/mtalogo.png", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], false) end ) function showgui (hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer ) then if not guiGetVisible(GUIEditor.window[1]) then guiSetVisible(GUIEditor.window[1] , true) showCursor(true) end end end addEventHandler("onClientMarkerHit" , jobMarker , showgui) function showguil (leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(GUIEditor.window[1]) then guiSetVisible(GUIEditor.window[1] , false) showCursor(false) end end end addEventHandler("onClientMarkerLeave" , jobMarker,showguil ) function ButtonExit() if source == exitbutton then guiSetVisible(GUIEditor.window[1],false) showCursor( false ) end end addEventHandler("onClientGUIClick",getRootElement(),ButtonExit) function TakeJob(thePlayer) if source == jobbutton then setElementData ( thePlayer, "Trucker", true ) guiSetVisible(GUIEditor.window[1],false) showCursor(false) outputChatBox ( "#ffffffBob: Welcome, Now go and work for ya' money!", 0, 255, 0, true ) end end addEventHandler("onClientGUIClick",getRootElement(),TakeJob) Link to comment
pa3ck Posted October 30, 2014 Share Posted October 30, 2014 First argument @ onClientGUIClick is the button. Use localPlayer instead of thePlayer @ line 57 Link to comment
ALw7sH Posted October 30, 2014 Share Posted October 30, 2014 first parameter in "onClientGUIClick" event the button not the player Link to comment
-.Paradox.- Posted October 30, 2014 Share Posted October 30, 2014 triggerServerEvent setElementData 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