yayo Posted September 30, 2012 Share Posted September 30, 2012 [code=text]cobrasmarker1 = createMarker(1020.6630859375, 2257.6728515625, 10.8203125, "cylinder", 1.0,255,0,0,150) function createWindow() GUIEditor_Window = {} GUIEditor_Button = {} menu = guiCreateWindow(238,177,315,171,"I got some shit for you, what you want?",false) sellbat = guiCreateButton(253,210,127,118,"Bat(2$)",false) sillknift = guiCreateButton(411,211,127,118,"Knife(100$)",false) guiSetVisible ( menu, true ) end addEventHandler( "onMarkerHit", cobrasmarker1, createWindow) function destroyWindow () guiSetVisible ( menu, false ) end addEventHandler( "onMarkerLeave", cobrasmarker1, destroyWindow ) function sellbat() if button == "left" and state == "up" then triggerServerEvent ( "sellbat2", getLocalPlayer()) outputChatBox ( "You bought a Bat!(2$)" ) end end function sellknife() if button == "left" and state == "up" then triggerServerEvent ( "sellknife2", getLocalPlayer()) outputChatBox ( "You bought a Knife(100$)" ) end end [/code] it returns in debugscript that createWindow is nil and a couple others too Link to comment
Anderl Posted September 30, 2012 Share Posted September 30, 2012 You're using server-side events on client-side code and you're declaring tables that aren't actually being used. Link to comment
yayo Posted September 30, 2012 Author Share Posted September 30, 2012 sooo, from client.lua and server.lua what should i fix? CLIENT cobrasmarker1 = createMarker(1020.6630859375, 2257.6728515625, 10.8203125, "cylinder", 1.0,255,0,0,150) function createWindow() menu = guiCreateWindow(238,177,315,171,"I got some shit for you, what you want?",false) sellbat = guiCreateButton(253,210,127,118,"Bat(2$)",false) sillknift = guiCreateButton(411,211,127,118,"Knife(100$)",false) guiSetVisible ( menu, true ) end addEventHandler( "onMarkerHit", cobrasmarker1, createWindow) function destroyWindow () guiSetVisible ( menu, false ) end addEventHandler( "onMarkerLeave", cobrasmarker1, destroyWindow ) function sellbat() if button == "left" and state == "up" then triggerServerEvent ( "sellbat2", source) outputChatBox ( "You bought a Bat!(2$)" ) end end function sellknife() if button == "left" and state == "up" then triggerServerEvent ( "sellknife2", source) outputChatBox ( "You bought a Knife(100$)" ) end end SERVER cobraped1 = createPed( 21, 1021.37109375, 2257.6953125, 10.8203125) setPedRotation( cobraped1, 90 ) function sellbat2() giveWeapon ( source, 5, 100 ) takePlayerMoney( source, 2 ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", getRootElement(), sellbat2 ) function sellknife2() giveWeapon ( source, 4, 100 ) takePlayerMoney( source, 100 ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", getRootElement(), sellknife2 ) Link to comment
Anderl Posted September 30, 2012 Share Posted September 30, 2012 Can't you really figure out? Use your brain and read again what I said. Link to comment
yayo Posted September 30, 2012 Author Share Posted September 30, 2012 Figured it out, thanks. 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