Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local startMarkerPositions = {}
- local startMarkers = {}
- local startMarkersBlips = {}
- local onVehicleLeaveOrWasted
- startMarkerPositions["LosSantos"] = Vector3(1591.5, -2283.6, -2.25)
- startMarkerPositions["BoneCountry"] = Vector3(423.8, 2536.5, 15.2)
- startMarkerPositions["LasVenturas"] = Vector3(1673.6, 1447.8, 9.8)
- startMarkerPositions["SanFierro"] = Vector3(-1422.5, -286.6, 13.2)
- for k, vector in pairs(startMarkerPositions) do
- startMarkers[k] = Marker(vector, "cylinder", 1.3, 255, 255, 0, 200)
- startMarkersBlips[k] = Blip.createAttachedTo(startMarkers[k], 5, 2, 255, 255, 0)
- end
- local models = {
- Andromada = 592,
- AT400 = 577,
- Shamal = 519,
- Dodo = 593
- }
- local planePositions = {
- LosSantos = {
- Andromada = {x = 2017.7998, y = -2493.7998, z = 13.8, rx = 0, ry = 0, rz = 90},
- AT400 = {x = 2017.7998, y = -2493.7998, z = 13.8, rx = 0, ry = 0, rz = 90},
- Shamal = {x = 2017.7998, y = -2493.7998, z = 15, rx = 0, ry = 0, rz = 90},
- Dodo = {x = 2017.7998, y = -2493.7998, z = 15, rx = 0, ry = 0, rz = 90}
- },
- BoneCountry = {
- Andromada = {x = 414.62067, y = 2502.25415, z = 17, rx = 0, ry = 0, rz = 90},
- Shamal = {x = 414.62067, y = 2502.25415, z = 17, rx = 0, ry = 0, rz = 90},
- Dodo = {x = 414.62067, y = 2502.25415, z = 17, rx = 0, ry = 0, rz = 90}
- },
- LasVenturas = {
- Andromada = {x = 1423.1381, y = 1261.9676, z = 11.7, rx = 359, ry = 359, rz = 266},
- AT400 = {x = 1423.1381, y = 1261.9676, z = 11.7, rx = 359, ry = 359, rz = 266},
- Shamal = {x = 1423.1381, y = 1261.9676, z = 11.7, rx = 359, ry = 359, rz = 266},
- Dodo = {x = 1423.1381, y = 1261.9676, z = 11.7, rx = 359, ry = 359, rz = 266}
- },
- SanFierro = {}
- }
- function getDistance(vector1, vector2)
- local distance = getDistanceBetweenPoints3D(vector1, vector2)
- return distance
- end
- function createPanel(hitMarker)
- for location, marker in pairs(startMarkers) do
- if marker == hitMarker then
- local distances = {}
- for k, v in pairs(startMarkerPositions) do
- if k ~= location then
- distances[k] = getDistance(v, startMarkerPositions[location])
- end
- end
- triggerClientEvent("openPilotTab", source, location, distances)
- distances = nil
- end
- end
- end
- addEventHandler("onPlayerMarkerHit", getRootElement(), createPanel)
- function makeVehicle(player, model, location, arrivalLocation, income)
- for _index, value in pairs(startMarkerPositions) do
- startMarkers[_index]:setVisibleTo(player, false)
- startMarkersBlips[_index]:setVisibleTo(player, false)
- end
- local position =
- Vector3(
- planePositions[location][model]["x"],
- planePositions[location][model]["y"],
- planePositions[location][model]["z"]
- )
- local rotation =
- Vector3(
- planePositions[location][model]["rx"],
- planePositions[location][model]["ry"],
- planePositions[location][model]["rz"]
- )
- local plane = Vehicle(models[model], position, rotation)
- player:warpIntoVehicle(plane)
- triggerClientEvent("start:job", player, arrivalLocation)
- function onVehicleLeaveOrWasted()
- if plane then
- plane:destroy()
- triggerClientEvent("stop:mission", player)
- end
- end
- addEventHandler("onVehicleExit", plane, onVehicleLeaveOrWasted)
- addEventHandler("onPlayerWasted", player, onVehicleLeaveOrWasted)
- function givingsalary()
- removeEventHandler("onVehicleExit", root, onVehicleLeaveOrWasted)
- removeEventHandler("onPlayerWasted", root, onVehicleLeaveOrWasted)
- plane:destroy()
- outputChatBox("congratz")
- player:giveMoney(tonumber(income))
- player:setPosition(startMarkerPositions[arrivalLocation])
- end
- addEvent("getSalary", true)
- addEventHandler("getSalary", player, givingsalary)
- addCommandHandler(
- "takeme",
- function()
- setElementPosition(plane, 15.865191459656, 2504.4108886719, 16.951555252075)
- end
- )
- end
- addEvent("makePlane", true)
- addEventHandler("makePlane", getRootElement(), makeVehicle)
Advertisement
Add Comment
Please, Sign In to add comment