teraz mam taki problem ze po wiechaniu w punk roz?adunku wyskakuje znow? ?adowanie prosz? jeszcze z tym o pomoc
stona clienta
destinationMarker = nil
destBlip = nil
addEvent("ladunek", ladunek)
function ladunek ()
triggerServerEvent ( "zaladujek", resourceRoot)
end
unloadingPos = {
{-2734.32,820.22,53.21},
{-2672.17,269.63,3.95},
{-2592.43,59.72,3.95},
{-2655.98,-133.58,3.65},
{-2314.70,-155.81,34.93},
{-2029.54,157.96,28.45},
{-2081.72,773.69,69.17},
{-2053.12,146.63,27.84},
{-1929.06,275.68,40.05},
{-2418.97,960.39,44.30},
{-2425.96,1030.55,49.39},
{-2345.91,991.95,49.70},
{-1674.98,438.14,6.18},
}
function endOfWork()
if destinationMarker and isElement(destinationMarker) then
destroyElement(destinationMarker)
destinationMarker = nil
end
if destBlip and isElement(destBlip) then
destroyElement(destBlip)
destBlip = nil
end
end
function takeFurniture(he, md, plr)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end
local car = getPedOccupiedVehicle(he)
if getElementData(car, "vopis") == "Dostawca Gazu - Firma GAZOL" then
if getElementData(he, "zaladowany") == false then
setElementFrozen(car,true)
outputChatBox("[INFO] Ladujesz Butle z gazem na pake. Prosze Czekac!", 0, 240, 255)
setTimer(function()
setElementData(car, "vopis", "Dostawca Gazu - Firma GAZOL")
setElementFrozen(car,false)
outputChatBox("[INFO] Zaladowales Pojazd Butlami z Gazem, Jedz Do klienta, punkt jest oznaczony Blipem 'C' na mapie", 0, 240, 255)
setElementData(he, "zaladowany", true)
showDestination()
end, 5000, 1)
else
outputChatBox("[INFO] Nie mo?esz kilka razy ?adowa? pojazdu", plr, 255, 0, 0)
end
end
end
addEventHandler("onClientMarkerHit", getRootElement(), takeFurniture)
function showDestination()
local rand = math.random(1, #unloadingPos)
local destMarker = unloadingPos[rand]
destinationMarker = createMarker(destMarker[1], destMarker[2], destMarker[3], "cylinder", 3.0, 255, 0, 0, 130)
destBlip = createBlipAttachedTo(destinationMarker, 12)
addEventHandler("onClientMarkerHit", destinationMarker, unloadFurniture)
end
function unloadFurniture(plr, md)
if plr ~= localPlayer then return end
if not getPedOccupiedVehicle(plr) then return end
local carr = getPedOccupiedVehicle(plr)
if getElementData(carr, "vopis") == "Dostawca Gazu - Firma GAZOL" then
if getElementData(plr, "zaladowany") == true then
outputChatBox("[INFO] Dojechales Do klienta i zainstalowales mu butle z gazem w kuchni!", 0, 240, 255)
setElementData(plr, "zaladowany", false)
setElementData(carr, "vopis", "Dostawca Gazu - Firma GAZOL")
local kasa = givePlayerMoney ( math.random(40,90) )
setElementPosition (carr, -2473.81,777.43,35.16 )
outputChatBox("[INFO] Dostajesz" ..kasa.. "Z? za dostarczenie butli dla klientow.", 0, 240, 255)
endOfWork()
else
outputChatBox("[INFO] Brak butli na pace, twoje auto nie jest zaladowane butlami!", 255, 0, 0)
end
end
end
addEvent("kurier_praca", true)
addEventHandler("kurier_praca", resourceRoot, function()
takeFurniture(plr, md)
end)
addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
triggerServerEvent ( "checkCars", resourceRoot)
destroyElement(destBlip)
setElementData(plr, "graczPraca", false)
setElementData(plr, "zaladowany", false)
setElementPosition ( plr, -2470.14,774.66,35.17 )
outputChatBox("[INFO] Praca dostawczy gaz zaosta?a zako?czona!", 255, 0, 0)
endOfWork()
end
end
end)
addEventHandler("onClientPlayerQuit", resourceRoot, function(plr)
setElementData(source, "graczPraca", false)
setElementData(plr, "zaladowany" ,false)
end)
addEventHandler("onClientPlayerWasted", resourceRoot, function(plr)
setElementData(source, "graczPraca", false)
setElementData(plr, "zaladowany", false)
outputChatBox("* Zginales podczas dorywczej pracy! Musisz zaczac od nowa!", 255, 0, 0)
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
setElementData(source, "graczPraca", false)
setElementData(plr, "zaladowany", false)
end)
i strona serwera
reloadMarker = {
{-2460.45,779.61,34.17},
{-2460.45,786.63,34.17},
{-2460.45,793.69,34.17},
}
addEventHandler("onResourceStart", resourceRoot, function()
for k,v in ipairs(reloadMarker) do
ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,255)
end
end)
addEvent( "zaladujek", true )
Pojazdy = {
{-2479.94,794.45,35.16,0,0,-90},
{-2479.94,790.45,35.16,0,0,-90},
{-2479.94,786.10,35.16,0,0,-90},
{-2479.94,782.10,35.16,0,0,-90},
{-2479.94,777.45,35.16,0,0,-90},
}
for i,v in ipairs(Pojazdy) do
local Pojazd = createVehicle(478, v[1], v[2], v[3], v[4], v[5], v[6])
setElementData(Pojazd, "vopis", "Dostawca Gazu - Firma GAZOL")
setVehiclePlateText(Pojazd,"GAZOL")
setVehicleColor (Pojazd, 0, 255, 84 )
setVehicleHandling(Pojazd,"maxVelocity",80)
setElementData(Pojazd, "pojazdy_przebieg", math.random(500, 1000))
setElementData(Pojazd, "pojazdy_paliwo", 50)
setElementFrozen(Pojazd, true)
setVehicleEngineState(Pojazd, false)
end
addEventHandler("onVehicleEnter", resourceRoot, function(plr, seat)
if seat == 0 then
if getElementData(plr, "graczPraca") == false then
setElementData(plr, "graczPraca", true)
setElementFrozen(source, false)
outputChatBox("[INFO] Rozpoczales Prace Jako Dostawca Butli z Gazem, Jedz Zaladowac butle z gazem na pake!", plr, 0, 240, 255)
triggerClientEvent(plr, "kurier_praca", resourceRoot)
else
end
end
end)
function respawnVehicles()
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
if not getVehicleOccupant(v) then
respawnVehicle(v)
setElementFrozen(v, true)
setElementData(v, "vopis", "Dostawca Gazu - Firma GAZOL")
setVehicleColor (v, 0, 255, 255 )
setVehicleHandling(v,"maxVelocity",100)
setElementData(v, "pojazdy_przebieg", math.random(500, 1000))
setElementData(v, "pojazd_paliwo", 50)
setVehicleEngineState(v, false)
end
end
end
--setTimer(respawnVehicles, 5000, 0)
addEvent("checkCars", true)
addEventHandler("checkCars", resourceRoot, respawnVehicles)
addEventHandler("onResourceStart", resourceRoot, function()
for k,v in ipairs(reloadMarker) do
ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,255)
addEventHandler("onMarkerHit", ladunek, function()
triggerClientEvent(source, "wjechalwmarkerMalentaska", source)
end)
end
end)
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach