ViRuZGamiing Posted January 2, 2014 Posted January 2, 2014 hello, When I exit the plane the plane gets destroyed but the blip not, Server pilotMarker = createMarker (-1421.5, -287.5, 13.1, "cylinder", 1.5, 0, 100, 255) addEventHandler("onMarkerHit", pilotMarker, function ( thePlayer, matchingDimension) local elementType = getElementType( thePlayer ) if elementType == "player" and matchingDimension then triggerClientEvent("showPilotGUI", thePlayer) end end ) addEvent("onPilotAccept", true) addEventHandler("onPilotAccept", root, function () local thePlayer = source pilotPlane = createVehicle (577, -1641.5, -148.39999, 14.5, 0, 0, 314.25) warpPedIntoVehicle ( thePlayer, pilotPlane ) addEventHandler("onVehicleExit", pilotPlane, function (thePlayer) destroyElement(pilotPlane) setElementPosition(thePlayer, 1424.2098388672, -90.74224853516, 14.1484375) givePlayerMoney(thePlayer, 1000) triggerClientEvent("onLVHit", thePlayer) end ) end ) Client GUIEditor = { button = {}, window = {}, staticimage = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() pilotWindow = guiCreateWindow(850, 570, 400, 200, "Pilot Job", false) guiWindowSetSizable(pilotWindow, false) pilotLabel = guiCreateLabel(10, 90, 380, 56, "Welcome, to start the Pilot job press accept! To leave press cancel.\n\n Your task: Fly to Las Venturas Airport!", false, pilotWindow) guiSetFont(pilotLabel, "default-bold-small") pilotAcceptButton = guiCreateButton(20, 156, 153, 34, "Accept!", false, pilotWindow) addEventHandler ( "onClientGUIClick", pilotAcceptButton, function () triggerServerEvent("onPilotAccept", localPlayer) lvMarker = createMarker(1477.40002, 1773.40002, 9.8, "cylinder", 20.0, 255, 100, 0) lvBlip = createBlip(1477.40002, 1773.40002, 10.8, 19) addEventHandler("onClientMarkerHit", lvMarker, function ( hitElement, matchingDimension) local elementType = getElementType( hitElement ) if elementType == "player" and matchingDimension then destroyElement(lvBlip) triggerServerEvent("onLVHit", source) end end ) guiSetVisible(pilotWindow, false) showCursor(false) end ) pilotCloseButton = guiCreateButton(227, 156, 153, 34, "Close", false, pilotWindow) addEventHandler ( "onClientGUIClick", pilotCloseButton, function () guiSetVisible(pilotWindow, false) showCursor(false) end ) pilotImage = guiCreateStaticImage(10, 24, 380, 56, "images/pilot.png", false, pilotWindow) guiSetVisible(pilotWindow, false) end ) addEvent("showPilotGUI", true) addEventHandler("showPilotGUI", root, function () guiSetVisible(pilotWindow, true) showCursor(true) end )
denny199 Posted January 2, 2014 Posted January 2, 2014 Must be a problem in the marker hit function, try this: GUIEditor = { button = {}, window = {}, staticimage = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() pilotWindow = guiCreateWindow(850, 570, 400, 200, "Pilot Job", false) guiWindowSetSizable(pilotWindow, false) pilotLabel = guiCreateLabel(10, 90, 380, 56, "Welcome, to start the Pilot job press accept! To leave press cancel.\n\n Your task: Fly to Las Venturas Airport!", false, pilotWindow) guiSetFont(pilotLabel, "default-bold-small") pilotAcceptButton = guiCreateButton(20, 156, 153, 34, "Accept!", false, pilotWindow) addEventHandler ( "onClientGUIClick", pilotAcceptButton, function () triggerServerEvent("onPilotAccept", localPlayer) lvMarker = createMarker(1477.40002, 1773.40002, 9.8, "cylinder", 20.0, 255, 100, 0) lvBlip = createBlip(1477.40002, 1773.40002, 10.8, 19) addEventHandler("onClientMarkerHit", lvMarker, function ( hitElement, matchingDimension) if (hitElement == localPlayer) and (matchingDimension == true) then -- I changed it here because this will do the trick on client side destroyElement(lvBlip) triggerServerEvent("onLVHit", source) -- you know that "source" is the marker right? end end ) guiSetVisible(pilotWindow, false) showCursor(false) end ) pilotCloseButton = guiCreateButton(227, 156, 153, 34, "Close", false, pilotWindow) addEventHandler ( "onClientGUIClick", pilotCloseButton, function () guiSetVisible(pilotWindow, false) showCursor(false) end ) pilotImage = guiCreateStaticImage(10, 24, 380, 56, "images/pilot.png", false, pilotWindow) guiSetVisible(pilotWindow, false) end ) addEvent("showPilotGUI", true) addEventHandler("showPilotGUI", root, function () guiSetVisible(pilotWindow, true) showCursor(true) end )
ViRuZGamiing Posted January 2, 2014 Author Posted January 2, 2014 Now I have only a problem with when I reach the end marker; CLIENT addEventHandler("onClientMarkerHit", lvMarker, function ( hitElement, matchingDimension) if (hitElement == localPlayer) and (matchingDimension == true) then triggerServerEvent("onLVHit", localPlayer) end end ) SERVER addEvent("onPilotAccept", true) addEventHandler("onPilotAccept", root, function () local thePlayer = source pilotPlane = createVehicle (577, -1641.5, -148.39999, 14.5, 0, 0, 314.25) warpPedIntoVehicle ( thePlayer, pilotPlane ) addEventHandler("onVehicleExit", pilotPlane, function (thePlayer) destroyElement(pilotPlane) setElementPosition(thePlayer, -1423.8000488281, -289.89999389648, 14.10000038147) setElementRotation(thePlayer, 0, 0, 138.004119) triggerClientEvent("destroyLVMarker", thePlayer) end ) addEvent("onLVHit", true) addEventHandler("onLVHit", root, function (thePlayer) destroyElement(pilotPlane) setElementPosition(thePlayer, -1423.8000488281, -289.89999389648, 14.10000038147) setElementRotation(thePlayer, 0, 0, 138.004119) givePlayerMoney(thePlayer, 1000) triggerClientEvent("destroyLVMarker", thePlayer) end ) end ) OnVehicleExit works fine
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