-- Settings
local thePed
local missionBlip
local missionMarker
local missionVehicle
local money = 3500 -- Ile za zrzut sie dostaje $$$$$$$$$$$$$$$$$$
local code="Transport spadochroniarzy"
local missionPoints={
{-1708.89,-508.21,140.34},
{-2154.34,-302.58,73.34},
{-2506.44,-467.21,124.24},
{-2734.23,-180.91,55.24},
{-2568.56,500.52,94.24},
{-1824.01,544.56,302.44},
{-1938.02,655.46,154.64},
{-2050.03,1058.08,111.44},
{-1647.69,1386.32,30.54},
{-1031.71,478.77,84.54},
{-750.09,-163.96,84.54},
}
local missionZaladunek=createMarker(-1175.07,26.94,12.15,"cylinder",5,0,128,128)
local jobText=createElement("text")
setElementPosition(jobText, -1227.53,47.71,14.13)
setElementData(jobText, "name", "Praca Dorywcza Zrzut Spadochroniarzy")
function finishJob(plr,value1,value2)
if plr ~= getLocalPlayer() then return end
if getElementData(localPlayer,"player:job") ~= code then return end
if value1 == true then
if isElement(missionMarker) and missionMarker then
destroyElement(missionMarker)
missionMarker=nil
end
if isElement(missionBlip) and missionBlip then
destroyElement(missionBlip)
missionBlip=nil
end
if isElement(thePed) and thePed then
destroyElement(thePed)
thePed=nil
end
end
if value2 == true then
if isElement(missionVehicle) and missionVehicle then
triggerServerEvent("destroyVehicle", root, missionVehicle)
missionVehicle=nil
end
end
end
function showNextPoint(el,md)
if not md or el~=localPlayer then return end
local veh=getPedOccupiedVehicle(el)
if not veh then return end
if getVehicleController(veh) ~= localPlayer then return end
finishJob(el,true,false)
outputChatBox("* Spadochroniarz skacz?...")
triggerServerEvent("DropPed",resourceRoot,veh)
setTimer(function()
playSound(":ogrpg-misc/misc/success.flac")
finishJob(el,true,false)
outputChatBox("* Dostarczy?e?(a?) spadochroniarza na miejsce zrzutu.")
addEventHandler("onClientRender",root,render1)
triggerServerEvent("givePlayerMoney", el, money, 5)
outputChatBox("* Otrzymujesz 60 PLN za zrzut, wracaj na lotnisko po kolejnych spadochroniarza.")
end, 5000, 1)
end
function showMarker()
local losuj = math.random(2, #missionPoints)
rnd=missionPoints
missionMarker=createMarker(rnd[losuj][1], rnd[losuj][2], rnd[losuj][3]-1, "checkpoint", 5, 255, 255, 255)
missionBlip=createBlipAttachedTo(missionMarker, 12)
addEventHandler("onClientMarkerHit", missionMarker, showNextPoint)
end
addEventHandler("onClientMarkerHit", missionZaladunek, function(el,md)
if not md or el~=localPlayer then return end
local veh=getPedOccupiedVehicle(el)
if not veh then return end
if getVehicleController(veh) ~= localPlayer then return end
if getElementModel(veh) ~= 593 then return end
if isElement(missionMarker) or isElement(missionBlip) then
outputChatBox("* Nie mo?esz za?adowa? spadochroniarzy, posiadasz pe?n? kabine", 255, 0, 0)
return
end
setElementFrozen(veh,true)
outputChatBox("* ?adujesz spadochroniarza.")
triggerServerEvent("CreatePed",resourceRoot,veh)
setTimer(function()
playSound(":ogrpg-misc/misc/point.wav")
showMarker()
setElementFrozen(veh,false)
outputChatBox("* Za?adowa?e?(a?) spadochroniarza,punkt zrzutu zosta? oznaczony blipem (C) na radarze.")
end, 1000, 1)
end)
addEventHandler("onClientPlayerQuit", root, function()
finishJob(source,false,true)
end)
addEventHandler("onClientPlayerWasted", root, function()
finishJob(source,true,true)
end)
addEventHandler("onClientVehicleExit", resourceRoot, function(plr,seat)
if seat~=0 then return end
if plr~=localPlayer then return end
finishJob(plr, true,true)
--triggerServerEvent("DestroyPed",root,source)
setElementData(plr,"player:job",false)
outputChatBox("* Zako?czy?e?(a?) prac?.", 255, 0, 0)
end)
addEventHandler("onClientVehicleExplode", resourceRoot, function()
if getElementModel(source) ~= 593 then return end
local plr=getVehicleController(source)
if plr~=localPlayer then return end
finishJob(plr, true,true)
setElementData(plr,"player:job",false)
outputChatBox("* Zako?czy?e?(a?) prac?.", 255, 0, 0)
end)
addEvent("startJob", true)
addEventHandler("startJob", resourceRoot, function(veh)
missionVehicle=veh
setElementData(localPlayer,"player:job",code)
outputChatBox("* Rozpocz??e?(a?) prac?, za?aduj spadochroniarza.")
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
if getElementData(localPlayer, "player:job")==code then
setElementFrozen(localPlayer, false)
setElementData(localPlayer, "player:job", false)
end
end,false,"high")
addCommandHandler("rozpocznij", function(cmd)
plr=localPlayer
if isPedInVehicle(plr) then return end
if not isElementWithinMarker(plr,jobMarker) then return end
if jobOnline == false then
outputChatBox("* Praca jest wy??czona.", 255, 0, 0)
return
end
if getElementData(plr,"player:job") then
outputChatBox("* Ju? posiadasz aktywn? prac?.", 255, 0, 0)
return
end
setElementData(plr,"player:job", code)
triggerServerEvent("startJobS", root,localPlayer)
end)
addEventHandler("onClientMarkerHit", jobMarker, function(el,md)
if el~=localPlayer then return end
if getElementType(el) == "player" then
if isPedInVehicle(el) then return end
outputChatBox("* Rozpocz??e?.")
end
end)