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

Wysłany: 2014-12-19, 15:17


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Mam taki ma?y problem. Mam skrypt na prace kierowcy autobusu(nie sko?czony). Gdy wyjd? z pojazdu pojazd z znika ale chcia?bym jeszcze aby markery pokazuj?ce drog? tez znika?y. Czyli ze jak wyjd? z pojazdu to trzeba prace zacz?? od nowa. Poniewa? jak wychodz? teraz to pojazd znika ale pierwszy marker itd nie znikaj?. Kod.





local punkty = {
    {1325.49780, -1730.17029, 14.51921},
--    {1314.17029, -1700.40894, 14.51843},
--    {1314.36633, -1577.04871, 14.51880},
}

local punkty2 = {}

for i,v in ipairs(punkty) do
        punkty2[i] = createMarker(v[1], v[2], v[3], "checkpoint", 5)
        setMarkerSize(punkty2[i], 0)
        setElementData(punkty2[i], "punkty:nr", i)
        addEventHandler("onMarkerHit", punkty2[i], function(el)
        givePlayerMoney(el,20)
            p_autobusu(el)
        end)
end
    
function p_autobusu(plr)
    
    local ilosc = #punkty
    cel = cel+1
    for k,v in ipairs(punkty2) do
        if cel == #punkty+1 then
            setMarkerSize(m2, 5)
            setMarkerSize(punkty2[k], 0)
        elseif k == cel then
            setMarkerSize(punkty2[k], 5)
            setMarkerSize(punkty2[k-1], 0)
            return
        end
    end
end

m1 = createMarker(1357.87549, -1753.26013, 13.36378-1.3, "cylinder", 4, 50, 204, 57, 255)

function start(player)
autobus = createVehicle (437, 1343.65674, -1745.90417, 14.51040, 0, 0, 0)
setElementData(autobus, "pojazd_opis", "Autobus publiczny.\n Los Santos\n Paolimo Creak\n Las Venturas")
warpPedIntoVehicle( player, autobus )
    setMarkerSize(m1, 0)
    cel = 0
    p_autobusu(el)
    end
addEventHandler("onMarkerHit", m1, start)



m2 = createMarker(1314.17029, -1700.40894, 14.51843, "checkpoint", 5, 50, 204, 57, 255)
setMarkerSize(m2, 0)

addEventHandler("onMarkerHit", m2, function(el,theVehicle)
    setMarkerSize(m2, 0)
    setMarkerSize(m1, 2)
    cel = 0
    givePlayerMoney(el,20)
  end)
  
  addEventHandler("onPlayerVehicleExit",root,
function (theVehicle) 
    local id=  getElementModel ( theVehicle )
    if id== 437 then
        if isElement( theVehicle ) then 
            destroyElement( theVehicle ) 
            setMarkerSize(m1, 4)
            setMarkerSize(m2, 0)
        end 
    end 
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-19, 15:21


Terr9909

Skrypter LUA






Wiek: 27
Na forum: 4376 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

Spr?buj doda? podczas ko?czenia pracy
Więcej informacji znajdziesz w Wikipedii MTA:

removeElementData


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-22, 10:09


piotr172







Wiek: 27
Na forum: 4558 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Ju? sobie sam poradzi?em. Ale za ch?ci stawiam ci Split piwko.

Do zamkni?cia.

Postaw piwo autorowi tego posta
 

 
Tagi: marker.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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