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

Wysłany: 2016-11-20, 22:42


EvilXmik







Wiek: 28
Na forum: 3620 dni
Posty: 148
Nick w MP: EvilXmik

Piwa: 399

Respekt: 50

Witam mam taki problem i? znikaj? mi markery jak jestem w jakie? odleg?o?ci od nich WTF ?? Jest to praca ?egla?a..kto? mo?e mi powiedzie? o co cho ??

Praca_s.lua
Kod:


local m1 = createMarker(-1480.97,686.76,1.32, "cylinder", 2.0, 0, 0, 255,255)
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

addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", resourceRoot, function(ile)
givePlayerMoney (client, ile)
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(472,-1471.85,695.17,1.39,359.5,360.0,358.6)

setElementData(bus, "zrespilGracz", el)
setElementData(bus, "pojazd_paliwo", 50)
setElementData(bus, "pojazd_przebieg", 100)
setElementData(bus, "vopis", "Praca Kierowcy Autobusu")
setVehiclePlateText(bus,"Autobus")



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)



Praca_c.lua
Kod:


local districtsBus = {
{-1452.58,722.25,1.35},
{-1413.20,821.01,1.45},
{-1400.80,998.05,1.50},
{-1362.86,1211.05,1.52},
{-1343.37,1400.87,1.48},
{-1378.91,1527.95,1.30},
{-1507.65,1590.58,1.52},
{-1672.35,1690.63,1.48},
{-1799.09,1807.52,1.50},
{1987.23,2004.28,1.50},
{-2151.80,2109.85,1.44},
{-2315.31,2245.99,1.53},
{-2396.70,2266.15,1.20},
{-2363.30,2226.03,1.42},
{-2330.91,2100.67,1.60},
{-2397.53,1919.36,1.50},
{-2465.35,1758.64,1.50},
{-2533.73,1559.90,1.30},
{-2458.28,1476.47,1.35},
{-2255.90,1515.78,1.49},
{-2082.99,1543.37,1.49},
{-1848.87,1565.46,1.54},
{-1684.59,1537.80,1.34},
{-1576.64,1414.09,1.48},
{-1469.46,1252.59,1.63},
{-1410.78,1083.26,1.53},
{-1402.31,884.31,1.50},
{-1470.77,737.22,1.15},

}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
triggerServerEvent("givePlayerMoney",resourceRoot,5)
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
triggerServerEvent("givePlayerMoney",resourceRoot,20)

if jobTarget == #districtsBus then
finishJob()
playSoundFrontEnd(5)
outputChatBox("* Zako?czy?e?/a? prac?.")
else
showMarker()
playSoundFrontEnd(12)
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", 2, 198, 3, 140)

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)
[/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-20, 23:04


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Wydaje mi si? , ?e problem mo?e by? w tym , ?e marker jest w z?ym kszta?cie , marker typu "checkpoint" , zaczyna si? od ziemi (mo?esz sprawdzi?) wi?c pojawia si? on na dnie wody i w tym wypadku kamera si? buguje i znikaj? ci te markery (mo?esz sprawi? ruszaj?c kamer? i zobaczysz, ze wko?cu ci si? pojawi) oczywi?cie tak mi si? wydaje , lecz gdy zmienisz kszta?t markera (np. na "cylinder" ) wtedy unikniesz tego problemu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 12:24


EvilXmik







Wiek: 28
Na forum: 3620 dni
Posty: 148
Nick w MP: EvilXmik

Piwa: 399

Respekt: 50

Zmieni?em i dzia?a (na dodatek ?adniej to wygl?da :D ) dzi?ki za pomoc ;) mo?na zamkn?? ^^

Postaw piwo autorowi tego posta
 

 
Tagi: znikające :: markery :: ???
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Znikające markery ??? 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