--[[
Praca dostawcy
Skrypt napisany dla: gtao.pl
Autor: xMaXeRx
Prosz?™ o nie zmienianie autora.
W razie jakichkolwiek problemĂłw napisz do mnie:
Skype: Filip.Szulc85
GG: 60152565
--]]
ladowanie = createMarker (2494.43,-1667.23,13.34-1, "cylinder", 5, 255,255,100, 100) --Marker do za?‚adowania pojazdu skrzynkami.
-- Pojazdy
local vehicles = { -- x,y,z, rotx, roty, rotz, id
{2490.50854,-1680.10181,13.33654,0,0,0, 1},
{2495.44263,-1681.39758,13.33895,0,0,0, 2},
--{x,y,z,rx,ry,rz},
--{x,y,z,rx,ry,rz}
}
--Liczba 440 to id pojazdu - moĹĽesz zamieni?‡ sobie na w?‚asn?….
for i,v in ipairs(vehicles) do
woz = createVehicle(440, v[1],v[2],v[3],v[4],v[5],v[6], v[7])
setElementData(woz, "dostawczak", true)
end
--Miejsca roz?‚adunku skrzy?„.
local markery = {
{-302.51,1508.92,75.35},
{-490.30,-556.37,25.52},
{2228.13,-2222.40,13.54},
{-170.75,-324.31,1.42},
{2791.18,912.81,10.75},
{-1567.79,395.08,7.18},
{-2126.96,-88.05,35.32},
{-1987.60,-1034.48,32.02},
{-2465.56,2238.66,4.79},
{-1967.44,-2436.49,30.62},
{2597.02,-2426.39,13.49},
{1574.33,1672.08,10.82},
{2072.34,-2284.84,13.10},
{-1240.57,-93.24,14.14},
{848.88,-1208.38,16.97},
{2370.08,2740.72,10.82},
{1139.08,1946.88,10.82},
{1041.67,2115.72,10.82},
{1635.37,718.51,10.82},
{2867.67,2613.79,10.87},
{1454.70,2824.22,10.82},
{-754.21,1587.95,26.96},
{-1092.01,-1644.98,76.37},
{660.14,1261.65,11.46 },
{2276.60,-83.53,26.52 },
{-26.23,-2508.93,36.66 }
}
function funkcja(he)
local v=getPedOccupiedVehicle(he)
local m=getElementModel(v)
if not getElementData (he, "ladunek", 6) then
if not getElementData (he, "pracujesz") then
if m== 440 then
local vehicle = getPedOccupiedVehicle(he)
setVehicleFrozen ( vehicle, true )
outputChatBox("Trwa za?‚adunek pojazdu.",he,255,255,255)
setTimer(function()
setVehicleFrozen ( vehicle, false )
local rnd = math.random ( 1, #markery )
cels = createMarker(markery[rnd][1], markery[rnd][2], markery[rnd][3], "cylinder", 1, 156,104,255)
blipCelu = createBlipAttachedTo ( cels, 41)
setElementData(cels, "dostawa", true)
setElementData(he, "dostawczak", true)
setElementData(he, "pracujesz", true)
setElementData(he, "ladunek", 6)
setElementData(cels, "kogo:marker", getPlayerName(he))
outputChatBox("Dostarcz zamĂłwienie do wyznaczonego miejsca na mapie.",he,255,255,255)
end, 3000, 1)
end
else
outputChatBox("Dostarcz najpierw poprzednie zamĂłwienie!",he,255,255,255)
end
end
end
addEventHandler("onMarkerHit", ladowanie, funkcja )
addEventHandler("onVehicleExit",root,function()
if getElementModel(source) == 440 then
if not isElement(pole) then
pole = createMarker(0,0,0,"cylinder",2,255,255,255, 0)
attachElements(pole, source, 0, -2.3, -1.1)
if not otwarte then
setVehicleDoorOpenRatio(source, 4, 1, 5000)
setVehicleDoorOpenRatio(source, 5, 1, 5000)
otwarte = true
end
end
end
end)
addEventHandler("onVehicleEnter",root,function()
if getElementModel(source) == 440 then
if otwarte then
setVehicleDoorOpenRatio(source, 4, 0, 5000)
setVehicleDoorOpenRatio(source, 5, 0, 5000)
otwarte = false
end
end
end)
addEventHandler("onMarkerHit",root, function(he)
if source == pole then
if getElementType(he) == "player" then
if not getElementData(he, "pracujesz") then
outputChatBox("Nie pracujesz.",he,255,255,255)
return end
local veh = getPedOccupiedVehicle(he)
if veh then
if getElementModel(veh) == 440 then
if getElementData(veh, "naladowany") then
local number = getElementData(he, "ladunek") or 0
if tonumber(number) >= 6 then
outputChatBox("Pojazd jest juĹĽ za?‚adowany",he,255,255,255)
return end
detachElements(skrzyn)
destroyElement(skrzyn)
setElementData(veh, "naladowany", false)
local ilosc = getElementData(he, "ladunek") or 0
setElementData(he, "ladunek", ilosc + 1)
end
end
else
if getElementData(he, "skrzynka") then
outputChatBox("Masz juĹĽ na r?™kach skrzynk?™",he,255,255,255)
return end
--setElementData(he, "skrzynka", true)
local number2 = getElementData(he, "ladunek")
if tonumber(number2) <= 0 then
outputChatBox("Pojazd jest pusty",he,255,255,255)
return end
setElementFrozen(he, true)
setTimer(function()
skrzyneczka = createObject(1271, 0,0,0)
attachElements(skrzyneczka, he, 0, 0.8, 0)
setElementData(he, "skrzynka", true)
setPedAnimation(he, "CARRY", "crry_prtial", 1, true)
local ilosc2 = getElementData(he, "ladunek") or 0
setElementData(he, "ladunek", ilosc2 - 1)
setElementFrozen(he, false)
outputChatBox("Zanie?› skrzynke do odpowiedniego punktu",he,255,255,255)
end, 1*1000, 1)
outputChatBox("Odczekaj chwil?™, bierzesz skrzynk?™.",he,255,255,255)
setElementFrozen(he, true)
setPedAnimation(he, "CARRY", "putdwn", 1, true)
setElementData(he, "skrzynka", true)
end
end
elseif source == cels then
if getElementType(he) == "player" then
if not getElementData(he, "pracujesz") then
outputChatBox("Nie pracujesz.",he,255,255,255)
return end
if not getElementData(he, "skrzynka") then
if not isPedInVehicle(he) then
outputChatBox("Nie masz skrzynki na r?™kach",he,255,255,255)
end
return end
if getElementData(cels, "kogo:marker") == getPlayerName(he) then
setTimer(function(he)
--if skrzyneczka then
detachElements(skrzyneczka)
destroyElement(skrzyneczka)
setElementFrozen(he, false)
setPedAnimation(he, false)
setElementData(he, "skrzynka", false)
--triggerClientEvent(he, "zaplac", he)
setElementFrozen(he, true)
if getElementData(he, "ladunek") <= 0 then
destroyElement(cels)
triggerClientEvent(plr, "destroyBlip", he)
outputChatBox("Masz 10 sekund aby wsi?…?›?‡ do pojazdu by zako?„czy?‡ zlecenie.",he,255,255,255)
setTimer(function(he)
local yh2 = getPedOccupiedVehicle(he)
if yh2 then
if getElementModel(yh2) == 440 then
if getElementData(yh2, "dostawczak") then
for i,v in pairs(vehicles) do
if v[7] == 1 then
setElementPosition(yh2, 2490.50854,-1680.10181,13.33654)
elseif v[7] == 2 then
setElementPosition(yh2, 2495.44263,-1681.39758,13.33895)
end
end
--local price = getElementData(he, "money") or 0
--givePlayerMoney(he, tonumber(price))
setElementData(he, "money", nil)
destroyElement(blipCelu)
outputChatBox("Zako?„czy?‚e?› zlecenie pomy?›lnie, otrzymujesz 500$.",255,255,255)
givePlayerMoney(he, 500) -- Ilo?›?‡ pieni?™dzy dawanych za wykonanie zlecenia.
setElementData(he, "skrzynka", false)
setElementData(he, "ladunek", 0)
setElementData(he, "pracujesz", false)
end
end
end
end, 20*1000, 1, he)
setElementData(he, "skrzynka", false)
setElementFrozen(he, false)
setPedAnimation(he, false)
end
end, 1*1000, 1, he)
outputChatBox("Odczekaj chwil?™, odk?‚adasz skrzynk?™.",he,255,255,255)
setElementFrozen(he, true)
--setPedAnimation(he, "CARRY", "putdwn", 1, true)
setPedAnimation (he,"CARRY","putdwn",1000,false,false,nil,false)
setTimer(function(he)
setElementFrozen(he, false)
end, 1*1000, 1, he)
end
end
end
end)
addEventHandler("onVehicleExit",root,function(plr)
if getElementModel(he) == 440 then
if getElementData(he"maj:laf:bi:lajk") then
-- if getElementData(plr, "ladunek") then
if tonumber(getElementData(plr, "ladunek")) >= 1 then
setTimer(function(he)
destroyElement(he)
destroyElement(skrzyn)
end, 10*1000, 1, he)
return end
setTimer(function(he)
if not getVehicleController(he) then
destroyElement(cels)
-- destroyElement(blips)
triggerClientEvent(he, "destroyBlip", he)
destroyElement(skrzyn)
setElementData(he, "naladowany", false)
setElementData(he, "maj:laf:bi:lajk", false)
destroyElement(he)
setElementData(he, "pracujesz", false)
outputChatBox("Przerwa?‚e?›/a?› prac?™.",plr,255,255,255)
end
end, 30*1000, 1, he)
outputChatBox("Masz 30 sekund aby powrĂłci?‡ do pojazdu.",he,255,255,255)
end
end
end)
--Gdy co?› si?™ zbuguje i chcesz zrestartowa?‡ skrypt to zamiast reconnectac wpisz /zeruj
addCommandHandler("zeruj",function(plr)
setElementData(plr, "skrzynka", false)
setElementData(plr, "ladunek", 0)
setElementData(plr, "pracujesz", false)
end)