Khalil Posted August 24, 2013 Share Posted August 24, 2013 Debug says: :28:'end' expected (to close 'function' on line 23) near 'elseif'. local lp = getLocalPlayer ( ) sx, sy = guiGetScreenSize () win = guiCreateWindow( ( sx / 2 - 524 / 2 ), ( sy / 2 - 320 / 2 ), 524, 320, "Car Options", false) buttonOne = guiCreateButton(72, 98, 119, 66, "Engine", false, win) buttonTwo = guiCreateButton(309, 99, 119, 66, "Lights", false, win) buttonThree = guiCreateButton(500, 23, 15, 15, "X", false, win) buttonFour = guiCreateEdit(142, 240, 263, 29, "", false, win) buttonFive = guiCreateLabel(67, 246, 75, 15, "License Plate:", false, win) buttonSix = guiCreateButton(405, 240, 59, 31, "Set", false, win) buttonSeven = guiCreateLabel(148, 271, 219, 32, "Maximum 8 characters\nSetting your license plate costs $1000.", false, win) buttonEight = guiCreateButton(200, 165, 99, 52, "Lock", false, win) guiSetVisible(win,false) bindKey ( "f2", "down", function ( ) if ( isPedInVehicle ( lp ) == false or getVehicleController ( getPedOccupiedVehicle ( lp ) ) ~= lp ) then return end local tostate = not guiGetVisible ( win ) guiSetVisible ( win, tostate ) showCursor ( tostate ) end) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == buttonThree ) then guiSetVisible ( win, false ) showCursor ( false ) end elseif ( source == buttonSix ) then local veh = getPedOccupiedVehicle ( lp ) if( veh ) then triggerServerEvent ( "onVehicleLisenceChange", lp, guiGetText ( buttonFour ) ) end end elseif ( source == buttonEight ) then executeCommandHandler ( "lock" ) elseif ( source == buttonOne ) then if ( isVehicleDamageProof ( theVehicle ) ) then return end guiSetEnabled ( buttonOne, false ) setTimer( guiSetEnabled, 2000, 1, buttonOne, true ) local veh = getPedOccupiedVehicle ( lp ) if ( veh and getVehicleController ( veh ) == lp ) then local state = not getVehicleEngineState ( veh ) setVehicleEngineState ( veh, state ) if ( state ) then playSound ( "start.mp3" ) outputChatBox ( "You have started your car's engine.", 231, 0, 0 ) else playSound ( "stop.mp3" ) outputChatBox ( "You have stopped your car's engine.", 231, 0, 0 ) end end elseif ( source == buttonTwo ) then triggerServerEvent ( "onVehicleLightStateChange", lp ) elseif ( source == buttonSix ) then local text = guiGetText ( butonFour ) local veh = getPedOccupiedVehicle ( lp ) if( veh ) then triggerServerEvent ( "onVehicleLisenceChange", lp, guiGetText ( buttonFour ) ) end end addEvent ( "onVehicleLightStateChange", true ) addEventHandler ( "onVehicleLightStateChange", root, function ( state, x, y, z ) if ( state ) then SoundPath = "on.mp3" else SoundPath = "on.mp3" end playSound3D ( "on.mp3", x, y, z ) end ) Link to comment
Castillo Posted August 24, 2013 Share Posted August 24, 2013 local lp = getLocalPlayer ( ) sx, sy = guiGetScreenSize () win = guiCreateWindow( ( sx / 2 - 524 / 2 ), ( sy / 2 - 320 / 2 ), 524, 320, "Car Options", false) buttonOne = guiCreateButton(72, 98, 119, 66, "Engine", false, win) buttonTwo = guiCreateButton(309, 99, 119, 66, "Lights", false, win) buttonThree = guiCreateButton(500, 23, 15, 15, "X", false, win) buttonFour = guiCreateEdit(142, 240, 263, 29, "", false, win) buttonFive = guiCreateLabel(67, 246, 75, 15, "License Plate:", false, win) buttonSix = guiCreateButton(405, 240, 59, 31, "Set", false, win) buttonSeven = guiCreateLabel(148, 271, 219, 32, "Maximum 8 characters\nSetting your license plate costs $1000.", false, win) buttonEight = guiCreateButton(200, 165, 99, 52, "Lock", false, win) guiSetVisible(win,false) bindKey ( "f2", "down", function ( ) if ( isPedInVehicle ( lp ) == false or getVehicleController ( getPedOccupiedVehicle ( lp ) ) ~= lp ) then return end local tostate = not guiGetVisible ( win ) guiSetVisible ( win, tostate ) showCursor ( tostate ) end ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == buttonThree ) then guiSetVisible ( win, false ) showCursor ( false ) elseif ( source == buttonSix ) then local veh = getPedOccupiedVehicle ( lp ) if ( veh ) then triggerServerEvent ( "onVehicleLisenceChange", lp, guiGetText ( buttonFour ) ) end elseif ( source == buttonEight ) then executeCommandHandler ( "lock" ) elseif ( source == buttonOne ) then if ( isVehicleDamageProof ( theVehicle ) ) then return end guiSetEnabled ( buttonOne, false ) setTimer ( guiSetEnabled, 2000, 1, buttonOne, true ) local veh = getPedOccupiedVehicle ( lp ) if ( veh and getVehicleController ( veh ) == lp ) then local state = not getVehicleEngineState ( veh ) setVehicleEngineState ( veh, state ) if ( state ) then playSound ( "start.mp3" ) outputChatBox ( "You have started your car's engine.", 231, 0, 0 ) else playSound ( "stop.mp3" ) outputChatBox ( "You have stopped your car's engine.", 231, 0, 0 ) end end elseif ( source == buttonTwo ) then triggerServerEvent ( "onVehicleLightStateChange", lp ) elseif ( source == buttonSix ) then local text = guiGetText ( butonFour ) local veh = getPedOccupiedVehicle ( lp ) if ( veh ) then triggerServerEvent ( "onVehicleLisenceChange", lp, guiGetText ( buttonFour ) ) end end end ) addEvent ( "onVehicleLightStateChange", true ) addEventHandler ( "onVehicleLightStateChange", root, function ( state, x, y, z ) if ( state ) then SoundPath = "on.mp3" else SoundPath = "on.mp3" end playSound3D ( "on.mp3", x, y, z ) end ) 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