Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local beginningMarker = {
- {x = 2518.23706, y = -2270.74927, z = -0.55000},
- {x = 2698.90576, y = -2310.06494, z = -0.55000},
- {x = 2309.20703, y = -2417.13794, z = -0.55000},
- {x = 2351.62012, y = -2522.45435, z = -0.55000},
- {x = 2614.61987, y = -2479.15967, z = -0.55000},
- {x = 2730.23950, y = -2587.99219, z = -0.55000}
- }
- local isMissionActive = false
- local timers = {}
- function enableStartMissionOption(plr, seat)
- if (plr ~= localPlayer) then
- return false
- end
- if (getElementMode(source) ~= 430 or seat ~= 0) then
- return false
- end
- if (getElementData(plr, "o") ~= "Police Officer") then
- return false
- end
- exports.CIThelp:modTextBar("boatMission", "Press N to start the Predator Mission.")
- bindKey(plr, "N", "down", startBoatMission)
- end
- function startBoatMission()
- local veh = getPedOccupiedVehicle(localPlayer)
- local seat = getPedOccupiedVehicleSeat(localPlayer)
- if (not veh or seat ~= 0) then
- return false
- end
- if (isMissionActive) then
- return false
- end
- unbindKey("N", "down", startBoatMission)
- isMissionActive = true
- local pos = beginningMarker[math.random(1,#beginningMarker)]
- firstMarker = createMarker(pos.x, pos.y, pos.z, "cylinder", 6, 0, 0, 210)
- firstBlip = createBlip(pos.x, pos.y, pos.z, 43)
- addEventHandler("onClientMarkerHit", firstMarker, missionStarting)
- timers["distanceCheck"] = setTimer(checkDistance ,1000, 0, veh)
- addEventHandler("onClientPlayerWasted", localPlayer, failMission)
- addEventHandler("onClientPlayerResign", localPlayer, failMission)
- addEventHandler("onClientElementDestroy", veh, failMission)
- end
- function checkDistance(veh)
- if (not veh or not isElement(veh)) then
- failMission()
- return false
- end
- local px, py, pz = getElementPosition(localPlayer)
- local vx, vy, vz = getElementPosition(veh)
- if (getDistanceBetweenPoints2D(px, py, vx, vy) > 100) then
- failMission("dist")
- return true
- end
- end
- addEventHandler("onClientVehicleEnter", root, enableStartMissionOption)
- function missionStarting()
- local veh = getPedOccupiedVehicle(localPlayer)
- setElementSpeed(veh, 1, 0)
- outputChatBox("Some drug smugglers are escaping with tons of drugs, stop them before they escape!", 0, 0, 110)
- destroyElement(firstMarker)
- destroyElement(firstBlip)
- firstMarker = nil
- firstBlip = nil
- firstBoat = createVehicle(446, x, y, z)
- firstBoatPed1 = exports.CITpeds:newPed(15, 0, 0, 0)
- firstBoatPed2 = exports.CITpeds:newPed(22, x, y, z)
- exports.CITpeds:pedOptions(firstBoatPed2, 5, 31)
- attachElements(firstBoatPed2, firstBoat)
- warpPedIntoVehicle(firstBoatPed1, firstBoat)
- setPedControlState(firstBoatPed1, "accelerate", true)
- tick1 = getTickCount()
- if (getElementHealth(firstBoat) <= 0 and getElementHealth(firstBoatPed2) <= 0) then
- removePedFromVehicle(firstBoatPed1)
- setElementPosition(firstBoatPed1, x, y, z)
- exports.CITpeds:pedOptions(firstBoatPed1, 5, 31)
- else
- return false
- end
- if (getElementHealth(firstBoatPed1) <= 0) then
- drugCrate1 = createMarker(x, y, z, "cylinder", 1, 0, 0, 255)
- outputChatBox("You killed the drug smugglers, remove the drugs from the crate", 0, 255, 0)
- end
- addEventHandler("onClientMarkerHit", drugCrate1, workFirstDrugCrate)
- end
- function workFirstDrugCrate()
- destroyElement(drugCrate1)
- drugCrate1 = nil
- outputChatBox("You have got the drugs, but there are still more drug smugglers, stop them!", 0, 0, 160)
- end
- function turnFirstBoat()
- if (getTickCount - tick1 >= 6000) then
- setPedControlState(firstBoatPed1, "vehicle_left", true)
- tick2 = getTickCount()
- end
- end
Add Comment
Please, Sign In to add comment