Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local startMarkersPositions = {
- LosSantos = Vector3(1591.5, -2283.6, -2.25),
- BoneCountry = Vector3(423.8, 2536.5, 15.2),
- SanFierro = Vector3(-1422.5, -286.6, 13.2),
- LasVenturas = Vector3(1673.6, 1447.8, 9.8)
- }
- local planes = {}
- local startMarkers = {}
- local startMarkersBlips = {}
- local planeStartPositions = {
- LosSantos = {
- Andromada = {
- xyz = Vector3(2017.7998, -2493.7998, 13.8),
- rotation = Vector3(0, 0, 90)
- },
- AT400 = {
- xyz = Vector3(2017.7998, -2493.7998, 13.8),
- rotation = Vector3(0, 0, 90)
- },
- Shamal = {
- xyz = Vector3(2017.7998, -2493.7998, 15),
- rotation = Vector3(0, 0, 90)
- },
- Dodo = {
- xyz = Vector3(2017.7998, -2493.7998, 15),
- rotation = Vector3(0, 0, 90)
- }
- },
- BoneCountry = {
- Andromada = {
- xyz = Vector3(414.62067, 2502.25415, 17),
- rotation = Vector3(0, 0, 90)
- },
- Shamal = {
- xyz = Vector3(414.62067, 2502.25415, 17),
- rotation = Vector3(0, 0, 90)
- },
- Dodo = {
- xyz = Vector3(414.62067, 2502.25415, 17),
- rotation = Vector3(0, 0, 90)
- }
- },
- LasVenturas = {
- Andromada = {
- xyz = Vector3(1423.1381, 1261.9676, 11.7),
- rotation = Vector3(359, 359, 266)
- },
- AT400 = {
- xyz = Vector3(1423.1381, 1261.9676, 11.7),
- rotation = Vector3(359, 359, 266)
- },
- Shamal = {
- xyz = Vector3(1423.1381, 1261.9676, 11.7),
- rotation = Vector3(359, 359, 266)
- },
- Dodo = {
- xyz = Vector3(1423.1381, 1261.9676, 11.7),
- rotation = Vector3(359, 359, 266)
- }
- },
- SanFierro = {}
- }
- for location, vector in pairs(startMarkersPositions) do
- startMarkers[location] = Marker(vector, "cylinder", 1.3, 255, 255, 0, 200)
- startMarkersBlips[location] = Blip.createAttachedTo(startMarkers[location], 5, 1)
- end
- function onStartMarkerHit(hitMarker)
- for location, marker in pairs(startMarkers) do
- if marker == hitMarker then
- triggerClientEvent("create:pilotTab", source, location)
- end
- end
- end
- addEventHandler("onPlayerMarkerHit", getRootElement(), onStartMarkerHit)
- function createFlightPlane(startLocation, model)
- local modelID = Vehicle.getModelFromName(model)
- local position = planeStartPositions[startLocation][model]["xyz"]
- local rotation = planeStartPositions[startLocation][model]["rotation"]
- local plane = Vehicle(modelID, position, rotation)
- planes[source:getName()] = plane
- source:warpIntoVehicle(plane)
- addEventHandler("onVehicleExit", plane, onPlayerLeaveOrDead)
- addEventHandler("onPlayerWasted", source, onPlayerLeaveOrDead)
- addEventHandler("give:salary", source, giveSalary)
- end
- addEvent("make:plane", true)
- addEventHandler("make:plane", getRootElement(), createFlightPlane)
- function onPlayerLeaveOrDead(player)
- if not isElement(player) then
- player = source
- local handler = getEventHandlers("onPlayerWasted", source)
- removeEventHandler("onPlayerWasted", player, handler[1])
- removeEventHandler("onVehicleExit", planes[player:getName()], handler[1])
- removeEventHandler("give:salary", player, giveSalary)
- else
- local handler = getEventHandlers("onVehicleExit", source)
- removeEventHandler("onVehicleExit", source, handler[1])
- removeEventHandler("onPlayerWasted", player, handler[1])
- removeEventHandler("give:salary", player, giveSalary)
- end
- planes[player:getName()]:destroy()
- planes[player:getName()] = nil
- triggerClientEvent("stop:flight", player)
- outputChatBox("You have abondand the flight", player, 255, 0, 0)
- end
- function giveSalary(income)
- player = source
- local handler = getEventHandlers("give:salary", player)
- removeEventHandler("give:salary", player, handler[1])
- removeEventHandler("onPlayerWasted", player,onPlayerLeaveOrDead)
- removeEventHandler("onVehicleExit", planes[player:getName()], onPlayerLeaveOrDead)
- player:giveMoney(tonumber(income))
- planes[player:getName()]:destroy()
- planes[player:getName()] = nil
- end
- addEvent("give:salary", true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement