local code = "StreetView"
local districtsBus = {
{1416.53, -1875.61, 13.48, 0.45, 359.93, 271.49},
{1501.19, -1875.40, 13.48, 0.16, 359.53, 272.46},
{1570.74, -1863.40, 13.48, 0.01, 0.63, 0.48},
{1571.57, -1797.50, 13.48, 359.83, 0.25, 0.25},
{1597.21, -1735.37, 13.48, 0.23, 0.25, 270.22},
{1691.00, -1723.36, 13.48, 359.85, 0.22, 342.00},
{1691.69, -1634.30, 13.48, 359.63, 0.01, 0.51},
{1640.53, -1590.08, 13.54, 359.90, 0.07, 89.83},
{1530.89, -1589.76, 13.48, 0.42, 0.00, 89.83},
{1433.35, -1562.85, 13.44, 0.31, 359.80, 352.55},
{1457.36, -1460.57, 13.45, 359.96, 0.00, 354.19},
{1422.54, -1422.09, 13.48, 0.13, 359.84, 357.34},
{1370.00, -1393.06, 13.55, 359.45, 358.20, 90.77},
{1330.72, -1474.85, 13.48, 359.68, 0.10, 162.36},
{1296.38, -1564.30, 13.48, 0.18, 359.77, 176.66},
{1295.04, -1677.35, 13.48, 359.70, 359.98, 179.22},
{1295.11, -1783.90, 13.48, 359.46, 0.00, 180.08},
{1329.21, -1855.82, 13.48, 359.96, 0.02, 262.14},
{1369.73, -1893.91, 13.60, 359.9, 359.7, 178.2},
}
local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus
function finishJob()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end
if isElement(blip) then
destroyElement(blip)
end
if jobTarget and isElement(jobTarget) then
destroyElement(jobTarget)
jobTarget = nil
jobTarget = 0
end
if getElementData(localPlayer,"player:job") == code then
setElementData(localPlayer,"player:job",false)
end
triggerServerEvent("destroyVeh", localPlayer)
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(),finishJob)
addEvent("finishJob",true)
addEventHandler("finishJob",root,function(plr)
if plr ~= localPlayer then return end
finishJob()
end)
function getVehicleLicense(plr,type)
if getElementData(plr,"player:license:pj"..type.."") ~= 1 then
outputChatBox("* Nie posiadasz prawa jazdy kategorii "..type..", zdaj je w urz?dzie miasta", plr, 255, 0, 0)
return true
end
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE serial=? AND type=? AND active=1 AND time>NOW()", getPlayerSerial(plr), tostring(type))
if result and #result > 0 then
v=result[1]
outputChatBox("* Posiadasz zawieszone prawo jazdy do "..v.time.." za "..v.reason, plr)
return true
else
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE serial=? AND type=? AND active=1 AND time<NOW()", getPlayerSerial(plr), tostring(type))
return false
end
end
function busDriver(el, md)
if el ~= localPlayer or not md then return end
if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
if jobTarget == #districtsBus then
finishJob()
playSoundFrontEnd(5)
outputChatBox("* Zako?czy?e?/a? prac?.")
else
showMarker()
playSoundFrontEnd(12)
premium = math.random(685,710)
zwykly = math.random(620,645)
if getElementData(localPlayer,"player:premium") then
triggerServerEvent("givePlayerMoney", localPlayer, premium, 0)
outputChatBox("[Premium]Otrzymujesz "..premium.." PLN za zidentyfikowanie punktu.")
else
triggerServerEvent("givePlayerMoney", localPlayer, zwykly, 0)
outputChatBox("Otrzymujesz "..zwykly.." PLN za zidentyfikowanie punktu.")
end
end
end
function showMarker()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end
if isElement(blip) then
destroyElement(blip)
end
jobTarget = jobTarget + 1
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "corona", 4, 255, 255, 255)
blip = createBlip(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3],12)
if districtsBus[jobTarget+1] then
ile = districtsBus[jobTarget+1]
setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
end
addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end
addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
outputChatBox("* Rozpocze?e?/a? prace.")
jobVehicle = veh
jobTarget = 0
showMarker()
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
if jobVehicle and getElementData(localPlayer, "player:job") then
setElementData(localPlayer, "player:job", false)
end
end)
addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
finishJob()
setElementPosition(localPlayer, 1382.58, -1896.57, 13.49)
outputChatBox("Praca przerwana. Wracasz na miejsce gdzie zaczyna si? praca Street View")
end
end
end)