-|PG|-Sliver Posted December 21, 2014 Posted December 21, 2014 Hey, i get no bug in my script no errors, but this script is when you hit a marker you will find a gui asking you to buy a drunk, so when i hit the marker, nothing happens, please if you can help me, leave a commenter, and thanks, Client side : [lua] GUIEditor = { tab = {}, tabpanel = {}, label = {}, button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() window[1] = guiCreateWindow(450, 450, 402, 120, "Buy a drunk", false) guiWindowSetSizable(window[1], false) guiSetVisible (window[1], false ) image[1] = guiCreateStaticImage(14, 29, 83, 76, "question.png", false, window[1]) llabel[1] = guiCreateLabel(107, 33, 271, 20, "Are you sure you want to buy a drunk for 1000$ ?", false, window[1]) button[yes] = guiCreateButton(212, 73, 74, 22, "Yes", false, window[1]) guiSetProperty(button[yes], "NormalTextColour", "FFAAAAAA") button[no] = guiCreateButton(294, 73, 74, 22, "No", false, window[1]) guiSetProperty(button[no], "NormalTextColour", "FFAAAAAA") end ) function drunk(hitElement) guiSetVisible(window[1],true) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then showCursor(true) playSound("files/notif.mp3") end end addEvent("drunk",true) addEventHandler("drunk", getRootElement(), drunk) function showGUIbf() guiSetVisible (window[1], false ) showCursor ( false ) end addEventHandler("onClientGUIClick", button[no], showGUIbf, false) function showPedAnim() guiSetVisible (window[1], false ) showCursor ( false ) end addEventHandler("onClientGUIClick", button[yes], showPedAnim, false) function Bar( Player ) setElementPosition(Player, 1633.6669921875, 1667.9755859375, 16.987487792969) outputChatBox (" #ffffffYou have teleported to : #FF0030Bar#ffffff(Command: /bar)", root, 255, 255, 255, true) end addCommandHandler( "bar",Bar) [/lua] Server Side : marker = createMarker( 1672.900390625, 1661.099609375, 16, "cylinder", 0.7, 0, 0, 0 ,0) marker2 = createMarker( 1679.5, 1679.4333496094, 11.4, "cylinder", 0.7, 0, 0, 0 ,0) function Hit(hitPlayer) if hitPlayer and getElementType(hitPlayer) == "player" then triggerClientEvent (hitPlayer,"drunk",getRootElement(),hitPlayer) end end addEventHandler("onMarkerHit",marker,Hit) addEventHandler("onMarkerHit",marker2,Hit)
Castillo Posted December 21, 2014 Posted December 21, 2014 Well, you obviously have some error? try checking if the event is being triggered ( add some debug outputs in the client side ).
-|PG|-Sliver Posted December 21, 2014 Author Posted December 21, 2014 ye, i got only 2 error, said attempt to index global "button" (a nil value) and attempt to index global "window" (a nil value)> what i should do?
Castillo Posted December 21, 2014 Posted December 21, 2014 It's because these tables don't exist, you should change them to this: GUIEditor.button GUIEditor.label GUIEditor.image GUIEditor.window Etc.
-|PG|-Sliver Posted December 21, 2014 Author Posted December 21, 2014 It's because these tables don't exist, you should change them to this:GUIEditor.button GUIEditor.label GUIEditor.image GUIEditor.window Etc. ok i will try it Thanks for your help a lot
-|PG|-Sliver Posted December 21, 2014 Author Posted December 21, 2014 No errors, but it's still wont working
-|PG|-Sliver Posted December 21, 2014 Author Posted December 21, 2014 Post the new code. Well, now only 1 error by the line N°14 GUIEditor = { tab = {}, tabpanel = {}, label = {}, button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(450, 450, 402, 120, "Buy a drunk", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible (GUIEditor.window[1], false ) GUIEditor.image[1] = guiCreateStaticImage(14, 29, 83, 76, "files/question.png", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(107, 33, 271, 20, "Are you sure you want to buy a drunk for 1000$ ?", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(212, 73, 74, 22, "Yes", false, GUIEditor.window[1]) guiSetProperty(button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(294, 73, 74, 22, "No", false, GUIEditor.window[1]) guiSetProperty(button[1], "NormalTextColour", "FFAAAAAA") end ) function drunk(hitElement) guiSetVisible(GUIEditor.window[1],true) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then showCursor(true) playSound("files/notif.mp3") end end addEvent("drunk",true) addEventHandler("drunk", getRootElement(), drunk) function showGUIbf() guiSetVisible (GUIEditor.window[1], false ) showCursor ( false ) end addEventHandler("onClientGUIClick", GUIEditor.button[2], showGUIbf, false) function showPedAnim() guiSetVisible (GUIEditor.window[1], false ) showCursor ( false ) end addEventHandler("onClientGUIClick", GUIEditor.button[1], showPedAnim, false) function Bar( Player ) setElementPosition(source, 1633.6669921875, 1667.9755859375, 16.987487792969) outputChatBox (" #ffffffYou have teleported to : #FF0030Bar#ffffff(Command: /bar)", root, 255, 255, 255, true) end addCommandHandler( "bar",Bar)
-|PG|-Sliver Posted December 21, 2014 Author Posted December 21, 2014 And the error is? lol, no error now and the script wont working :c
Blaawee Posted December 21, 2014 Posted December 21, 2014 I guess he didn't use 'setPedAnimation' function.
-|PG|-Sliver Posted December 21, 2014 Author Posted December 21, 2014 Yes, i used and then delete it, also setPedAnimation have bug + error
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