Jump to content

Heshan_Shalinda_eUnlock

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by Heshan_Shalinda_eUnlock

  1. When I open/close shutter it will only show to a single player but I want to show it to all players nearby. Tell me how to show changing shutter state to all players when one players switch his vehicles window state. thank you for your help
  2. I hope this helps you! Come back to me if you have any further problems related to your script. ? Thank you for your help could you please tell me how to make showGUI only when we enter a vehicle because my panel is showing using bindkey when we are not in the vehicle. And I when I use seat change it applies for all the players in the server, I want to make it for one player but show to other players in the server thank you for your help
  3. Error is exactly showing in this lines ------ trigger Client Events ------ addEventHandler("onPlayerResourceStart", root, function open (playerSource, commandName) triggerClientEvent (playerSource, "open", playerSource) end addCommandHandler ("open", open) end) why is it? tell me please
  4. Error : Loading Script Failed: Car_controlpanel03\ccp_s.lua : 20 : '<' expected near 'open' I am making a script to 1.control vehicle doors open and close 2.Engine on/off 3.Lights on/off 4.change vehicle seats 5.open shutters of the vehicle I need help for this problem --Client Side Script -- --ccp_c.lua-- GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(400, 500, 478, 216, "Car Control Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(28, 35, 113, 37, "Engine On/Off", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(182, 36, 113, 36, "Front Left Door", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(182, 97, 113, 37, "Rear Left Door", false, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(322, 35, 114, 37, "Front Right Door", false, GUIEditor.window[1]) GUIEditor.button[5] = guiCreateButton(323, 97, 113, 37, "Rear Right Door", false, GUIEditor.window[1]) GUIEditor.button[6] = guiCreateButton(182, 158, 113, 37, "Hood", false, GUIEditor.window[1]) GUIEditor.button[7] = guiCreateButton(323, 158, 113, 37, "Dickey", false, GUIEditor.window[1]) GUIEditor.button[8] = guiCreateButton(28, 158, 113, 37, "Lights", false, GUIEditor.window[1]) GUIEditor.window[2] = guiCreateWindow(957, 513, 138, 138, "Change Seat", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[9] = guiCreateButton(10, 25, 55, 50, "Seat 01", false, GUIEditor.window[2]) GUIEditor.button[10] = guiCreateButton(10, 80, 55, 48, "Seat 03", false, GUIEditor.window[2]) GUIEditor.button[11] = guiCreateButton(73, 25, 53, 50, "Seat 02", false, GUIEditor.window[2]) GUIEditor.button[12] = guiCreateButton(73, 80, 53, 47, "Seat 04", false, GUIEditor.window[2]) GUIEditor.window[3] = guiCreateWindow(129, 311, 105, 121, "Open Shutters", false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.button[13] = guiCreateButton(9, 27, 41, 39, "Shutter 01", false, GUIEditor.window[3]) GUIEditor.button[14] = guiCreateButton(54, 71, 41, 39, "Shutter 04", false, GUIEditor.window[3]) GUIEditor.button[15] = guiCreateButton(54, 27, 41, 39, "Shutter 02", false, GUIEditor.window[3]) GUIEditor.button[16] = guiCreateButton(10, 71, 40, 39, "Shutter 03", false, GUIEditor.window[3]) local seatWindows = { [0] = 4, [1] = 2, [2] = 5, [3] = 3 } function OpenDoor1() triggerServerEvent("OpenDoor1", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[2], OpenDoor1) function OpenDoor2() triggerServerEvent("OpenDoor2", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[4], OpenDoor2) function OpenDoor3() triggerServerEvent("OpenDoor3", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[3], OpenDoor3) function OpenDoor4() triggerServerEvent("OpenDoor4", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[5], OpenDoor4) function OpenDoor5() triggerServerEvent("OpenDoor5", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[6], OpenDoor5) function OpenDoor6() triggerServerEvent("OpenDoor6", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[7], OpenDoor6) function switchEngine() triggerServerEvent("switchEngine", localPlayer) -- use localPlayer as a sourceElement, it is best choice, because root/resourceRoot could contain extra elements end addEventHandler("onClientGUIClick", GUIEditor.button[1], switchEngine) function changeSeat01() triggerServerEvent("changeSeat01", localPlayer) end addEventHandler("onClientGUIClick", GUIEditor.button[9], changeSeat01) function changeSeat02() triggerServerEvent("changeSeat02", localPlayer) end addEventHandler("onClientGUIClick", GUIEditor.button[11], changeSeat02) function changeSeat03() triggerServerEvent("changeSeat03", localPlayer) end addEventHandler("onClientGUIClick", GUIEditor.button[10], changeSeat03) function changeSeat04() triggerServerEvent("changeSeat04", localPlayer) end addEventHandler("onClientGUIClick", GUIEditor.button[12], changeSeat04) function consoleVehicleLights() triggerServerEvent("consoleVehicleLights", localPlayer) end addEventHandler ( "onClientGUIClick", GUIEditor.button[8], consoleVehicleLights ) function open() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 4, not isVehicleWindowOpen( playerVehicle, 4 ) ) then outputChatBox( "Driver Window Switched" ) else outputChatBox( "You don't have window!" ) end end end end addCommandHandler("open", open) addEvent("open", true) addEventHandler( "open", localPlayer, open ) addEventHandler ( "onClientGUIClick", GUIEditor.button[13], open ) function open2() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 2, not isVehicleWindowOpen( playerVehicle, 2 ) ) then outputChatBox( "Front Right Window switched" ) else outputChatBox( "You don't have window!" ) end end end end addCommandHandler("open2", open2) addEvent("open2", true) addEventHandler( "open2", localPlayer, open2 ) addEventHandler ( "onClientGUIClick", GUIEditor.button[15], open2 ) function open3() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 5, not isVehicleWindowOpen( playerVehicle, 5 ) ) then outputChatBox( "Back Left Window switched!" ) else outputChatBox( "You don't have window!" ) end end end end addCommandHandler("open3", open3) addEvent("open3", true) addEventHandler( "open3", localPlayer, open3 ) addEventHandler ( "onClientGUIClick", GUIEditor.button[16], open3 ) function open4() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 3, not isVehicleWindowOpen( playerVehicle, 3 ) ) then outputChatBox( "Back Right Window switched!" ) else outputChatBox( "You don't have window!" ) end end end end addCommandHandler("open4", open4) addEvent("open4", true) addEventHandler( "open4", localPlayer, open4 ) addEventHandler ( "onClientGUIClick", GUIEditor.button[14], open4 ) function guiackapa () if guiGetVisible ( GUIEditor.window[1] ) and guiGetVisible ( GUIEditor.window[2] ) and guiGetVisible ( GUIEditor.window[3] ) then guiSetVisible ( GUIEditor.window[1], false ) guiSetVisible ( GUIEditor.window[2], false ) guiSetVisible ( GUIEditor.window[3], false ) showCursor(false) else guiSetVisible ( GUIEditor.window[1], true) guiSetVisible ( GUIEditor.window[2], true) guiSetVisible ( GUIEditor.window[3], true) showCursor(true) end end addEvent( "ShowGUI", false ) addEventHandler ( "ShowGUI", getRootElement(), guiackapa ) bindKey("F10","down",guiackapa) end ) --End of Client Side Script -- --ccp_c.lua-- --Server Side Script-- --ccp_s.lua-- -- Open All Doors at once -- addCommandHandler ( "carshowoff", function ( playerSource ) local vehicle = getPedOccupiedVehicle ( playerSource ) if vehicle then for i=0,5 do setVehicleDoorOpenRatio ( vehicle, i, 1 - getVehicleDoorOpenRatio ( vehicle, i ), 1000 ) end end end ) ------ trigger Client Events ------ addEventHandler("onPlayerResourceStart", root, function open (playerSource, commandName) triggerClientEvent (playerSource, "open", playerSource) end addCommandHandler ("open", open) end) addEventHandler("onPlayerResourceStart", root, function open2 (playerSource, commandName) triggerClientEvent (playerSource, "open2", playerSource) end addCommandHandler ("open2", open2) end) addEventHandler("onPlayerResourceStart", root, function open3 (playerSource, commandName) triggerClientEvent (playerSource, "open3", playerSource) end addCommandHandler ("open3", open3) end) addEventHandler("onPlayerResourceStart", root, function open4 (playerSource, commandName) triggerClientEvent (playerSource, "open4", playerSource) end addCommandHandler ("open4", open4) end) -- Open Doors one by one -- function OpenDoor1( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) if vehicle then setVehicleDoorOpenRatio ( vehicle, 2, 1 - getVehicleDoorOpenRatio ( vehicle, 2 ), 1000 ) end end addEvent("OpenDoor1", true) addEventHandler("OpenDoor1", root, OpenDoor1) function OpenDoor2( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) if vehicle then setVehicleDoorOpenRatio ( vehicle, 3, 1 - getVehicleDoorOpenRatio ( vehicle, 3 ), 1000 ) end end addEvent("OpenDoor2", true) addEventHandler("OpenDoor2", root, OpenDoor2) function OpenDoor3( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) if vehicle then setVehicleDoorOpenRatio ( vehicle, 4, 1 - getVehicleDoorOpenRatio ( vehicle, 4 ), 1000 ) end end addEvent("OpenDoor3", true) addEventHandler("OpenDoor3", root, OpenDoor3) function OpenDoor4( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) if vehicle then setVehicleDoorOpenRatio ( vehicle, 5, 1 - getVehicleDoorOpenRatio ( vehicle, 5 ), 1000 ) end end addEvent("OpenDoor4", true) addEventHandler("OpenDoor4", root, OpenDoor4) function OpenDoor5( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) if vehicle then setVehicleDoorOpenRatio ( vehicle, 0, 1 - getVehicleDoorOpenRatio ( vehicle, 0 ), 1000 ) end end addEvent("OpenDoor5", true) addEventHandler("OpenDoor5", root, OpenDoor5) function OpenDoor6( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) if vehicle then setVehicleDoorOpenRatio ( vehicle, 1, 1 - getVehicleDoorOpenRatio ( vehicle, 1 ), 1000 ) end end addEvent("OpenDoor6", true) addEventHandler("OpenDoor6", root, OpenDoor6) -- Switch Engine -- function switchEngine ( playerSource ) local vehicle = getPedOccupiedVehicle ( client ) -- Check if the player is in any vehicle and if he is the driver if vehicle and getVehicleController ( vehicle ) == client then local state = getVehicleEngineState ( vehicle ) setVehicleEngineState ( vehicle, not state ) end end addCommandHandler ( "switchengine", switchEngine ) addEvent("switchEngine", true) addEventHandler("switchEngine", root, switchEngine) --------- Should Ask From Eranda Aiyya -------- function consoleVehicleLights () if isPedInVehicle(getRandomPlayer()) then -- checks is the player in vehicle if yes, then: playerVehicle = getPedOccupiedVehicle ( getRandomPlayer() ) -- get the local player's vehicle if ( playerVehicle ) then -- if he was in one if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then -- if the current state isn't 'force on' setVehicleOverrideLights ( playerVehicle, 2 ) -- force the lights on else setVehicleOverrideLights ( playerVehicle, 1 ) -- otherwise, force the lights off end end end end addEvent("consoleVehicleLights", true) addEventHandler("consoleVehicleLights", root, consoleVehicleLights) --------- Should Ask From Eranda Aiyya -------- -- To be Fixed -- function changeSeat01 ( ) thePed = getRandomPlayer() theVehicle = getPedOccupiedVehicle ( thePed ) if ( theVehicle ) then warpPedIntoVehicle ( thePed, theVehicle, 0 ) outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) else outputChatBox ( getPlayerName(thePed).." is not in a vehicle." ) end end addEvent ("changeSeat01", true) addEventHandler ("changeSeat01", root, changeSeat01) function changeSeat02 ( ) thePed = getRandomPlayer() theVehicle = getPedOccupiedVehicle ( thePed ) if ( theVehicle ) then warpPedIntoVehicle ( thePed, theVehicle, 1 ) outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) else outputChatBox ( getPlayerName(thePed).." is not in a vehicle." ) end end addEvent ("changeSeat02", true) addEventHandler ("changeSeat02", root, changeSeat02) function changeSeat03 ( ) thePed = getRandomPlayer() theVehicle = getPedOccupiedVehicle ( thePed ) if ( theVehicle ) then warpPedIntoVehicle ( thePed, theVehicle, 2 ) outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) else outputChatBox ( getPlayerName(thePed).." is not in a vehicle." ) end end addEvent ("changeSeat03", true) addEventHandler ("changeSeat03", root, changeSeat03) function changeSeat04 ( ) thePed = getRandomPlayer() theVehicle = getPedOccupiedVehicle ( thePed ) if ( theVehicle ) then warpPedIntoVehicle ( thePed, theVehicle, 3 ) outputChatBox ( getPlayerName(thePed).." is in a vehicle in seat number " .. getPedOccupiedVehicleSeat ( thePed ) .. "." ) else outputChatBox ( getPlayerName(thePed).." is not in a vehicle." ) end end addEvent ("changeSeat04", true) addEventHandler ("changeSeat04", root, changeSeat04) --End of Server Side Script-- --ccp_s.lua-- I need help for this script please help me to build this script for our server.
×
×
  • Create New...