Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-07-05, 18:10


SamsungPLL

Programista lodówek






Wiek: 23
Na forum: 3805 dni
Posty: 123
Nick w MP: SamsungPLL

Piwa: 135

Respekt: 55,3

Witam mam problem z praca autobusu - Gdy w??czam salon panaPrezesa a na nast?pnie wejd? do markeru pracy autobusu to pojawia mi sie na chwile pojazd a pozniej znika + Gdy zniknie pojazd pojawia sie ze Zako?czy?em prace.
Prosze o szybk? pomoc postawiam piwko :piwo: :piwo:

Ostatnio zmieniony przez SamsungPLL 2016-07-06, 13:01, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-05, 18:17


Emm

***** ***






Wiek: 32
Na forum: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Poka? kod

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-05, 19:16


SamsungPLL

Programista lodówek






Wiek: 23
Na forum: 3805 dni
Posty: 123
Nick w MP: SamsungPLL

Piwa: 135

Respekt: 55,3

bus_c.lua
Kod:

local districtsBus = {
{-1735.86, 935.60, 24.74},
{-1856.70, 934.15, 35.02},
{-1976.56, 929.94, 45.30},
{-2010.05, 889.21, 45.30},
{-2007.90, 687.83, 45.49},
{-2009.29, 164.41, 27.73},
{-2008.72, -47.67, 35.36},
{-2024.01, -311.14, 35.52},
{-2181.06, -314.15, 35.43},
{-2205.83, -200.09, 35.47},
{-2338.28, -188.65, 35.36},
{-2371.03, -75.48, 35.44},
{-2017.15, -72.04, 35.36},
{-2005.12, 48.98, 31.51},
{-2001.05, 313.72, 35.21},
{-2000.35, 594.87, 35.22},
{-2000.49, 844.61, 45.49},
{-1902.01, 842.09, 35.21},
{-1897.27, 916.37, 35.21},
{-1795.58, 921.17, 24.93},
{-1766.85, 950.46, 24.93},

}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end

if jobTarget and isElement(jobTarget) then
destroyElement(jobTarget)
jobTarget = nil
jobTarget = 0

end

triggerServerEvent("destroyVeh", localPlayer)

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)
triggerServerEvent("givePlayerMoney", localPlayer, 50, 0)
end
end

function showMarker()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end

jobTarget = jobTarget + 1
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)

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("* Rozpocz??e?/a? prac?.")
jobVehicle = veh
jobTarget = 0
showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
if jobVehicle and getElementData(localPlayer, "gracz_praca") then
setElementData(localPlayer, "gracz_praca", false)
end
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
finishJob()
outputChatBox("* Zako?czy?e? prac?")
end
end
end)


bus.lua
Kod:

local m1 = createMarker(-1755.05, 951.73, 23.74, "cylinder", 4.0, 255, 0, 0)
vehs = {}


function removePreviousVehicles(plr)
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
local sby = getElementData(v, "zrespilGracz")
if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
destroyElement(v)
end
end
end

addEventHandler("onMarkerHit", m1, function(el, md)
if getElementData(el, "zrespilGracz") then
outputChatBox("praca w trakcie poprawek", el)
return
end

if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end

local x,y,z = getElementPosition(el)
local bus = createVehicle(437, -1755.05, 951.73, 25.74,0.0, 360.0, 269.9)

setElementData(bus, "zrespilGracz", el)
setElementData(bus, "pojazd_paliwo", 50)
setElementData(bus, "pojazd_przebieg", 100)

warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

vehs[el] = bus
end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)


[ Dodano: 2016-07-05, 23:47 ]
Noto pomo?e kto??

[ Dodano: 2016-07-07, 00:12 ]
Prosze o pomoc!

Podpis

1000 DNI NA FORUM: 28.09.2018r.
100 POSTÓW NA FORUM: 01.12.2017r.

Postaw piwo autorowi tego posta
 

 
Tagi: bug :: praca :: autobusu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » BUG - Praca Autobusu Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku