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

Wysłany: 2019-04-14, 00:41


AkossPL







Wiek: 25
Na forum: 4221 dni
Posty: 140
Nick w MP: AkossPL

Piwa: 3

Respekt: 50

Tak jak w temacie

Client:

destinationMarker = nil
destBlip = nil
reloadMarker = createMarker(76.48, -258.01, 1.58-0.9, "cylinder", 5.0, 255, 0, 0, 130)
local Blip = createBlip(76.48, -258.01, 1.58, 46)  

unloadingPos = {
{306.94, -246.45, 1.58},
{250.76, 1421.38, 10.59},
{1124.21, 1960.75, 10.82},
{1693.04, 2292.91, 10.82},
{1417.82, 1035.91, 10.82},
{1367.40, 1155.02, 10.82},
}

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)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end

local car = getPedOccupiedVehicle(he)

if getElementData(car, "pojazd_opis") == "Za�adowane Meble : 0%" then
        setElementFrozen(car,true)
        outputChatBox("* Ladujesz paczki, prosze czekac!", 255, 255, 255)
        setTimer(function()
    setElementData(car, "pojazd_opis", "Za�adowane Meble : 100%")
        setElementFrozen(car,false)
    outputChatBox("* Zaladowales paczki, jedz do blipu 'C'", 255, 255, 255)
    showDestination()
     end, 5000, 1)
end
end
addEventHandler("onClientMarkerHit", reloadMarker, takeFurniture)

function showDestination()
local rand = math.random(1, #unloadingPos)
local destMarker = unloadingPos[rand]
destinationMarker = createMarker(destMarker[1], destMarker[2], destMarker[3], "checkpoint", 2.7, 255, 0, 0, 130)
destBlip = createBlipAttachedTo(destinationMarker, 12)
addEventHandler("onClientMarkerHit", destinationMarker, unloadFurniture)
end

function unloadFurniture(he, md)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end

local carr = getPedOccupiedVehicle(he)

if getElementData(carr, "pojazd_opis") == "Za�adowane Meble : 100%" then
    outputChatBox("*Dojechales do celu, jedz po nowa paczke!", 255, 255, 255)
    setElementData(carr, "pojazd_opis", "Za�adowane Meble : 0%")
    triggerServerEvent("givePlayerMoney", localPlayer, 6000000)
        outputChatBox("* Dostajesz 6000000 PLN.", 55, 146, 0)
    endOfWork()
else
    outputChatBox("* Twoje auto nie jest zaladowane!", 255, 0, 0)
end
end



addEvent("kurier_praca", true)
addEventHandler("kurier_praca", resourceRoot, function()
takeFurniture(he, md)
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            setElementData(plr, "graczPraca", false)
            outputChatBox("* Zakonczyles prace!", 255, 255, 255)
            endOfWork()
        end
    end
end)

addEventHandler("onClientPlayerQuit", resourceRoot, function()
setElementData(source, "graczPraca", false)
end)

addEventHandler("onClientPlayerWasted", resourceRoot, function()
setElementData(source, "graczPraca", false)
outputChatBox("* Zginales podczas dorywczej pracy! Musisz zaczac od nowa!", 255, 0, 0)
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
setElementData(localPlayer, "graczPraca", false)
end)


Server:

Pojazdy = {
{165.74, -275.48, 1.53-0.2, 358.1, 0.0, 87.6},
{165.74, -270.16, 1.52-0.2, 358.0, 360.0, 88.8},
{165.74, -265.24, 1.53-0.2, 358.2, 360.0, 89.1},
{165.74, -260.47, 1.52-0.2, 358.1, 0.1, 88.8},
{165.74, -255.96, 1.53-0.2, 358.1, 359.9, 87.2},
{165.74, -251.12, 1.52-0.2, 358.0, 360.0, 89.3},
{150.98, -229.54, 1.53-0.2, 358.3, 360.0, 178.8},
{146.26, -229.54, 1.50-0.2, 358.0, 360.0, 178.0},
{141.06, -229.54, 1.52-0.2, 358.2, 359.9, 179.1},
{135.75, -229.54, 1.51-0.2, 358.0, 0.0, 177.9},
{131.08, -229.54, 1.51-0.2, 358.0, 0.0, 178.7},
{125.70, -229.54, 1.52-0.2, 358.1, 0.0, 176.4},
{120.84, -229.54, 1.53-0.2, 358.2, 360.0, 178.3},
{115.85, -229.54, 1.53-0.2, 358.2, 0.0, 178.1},
{110.94, -229.54, 1.53-0.2, 358.1, 0.0, 179.3},
}

for i,v in ipairs(Pojazdy) do
    local Pojazd = createVehicle(414, v[1], v[2], v[3]+0.3, v[4], v[5], v[6])
    setElementData(Pojazd, "pojazd_opis", "Za�adowane Meble : 0%")
    setVehicleColor (Pojazd, 0, 0, 0 )
    setVehicleHandling(Pojazd,"maxVelocity",100)
    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("* Rozpoczales prace jako kurier, jedz po paczki!", plr, 255, 255, 255)
            triggerClientEvent(plr, "kurier_praca", resourceRoot)
        else
            outputChatBox("* Posiadasz Ju� Aktywn� Prace!", plr, 255, 0, 0)
        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, "pojazd_opis", "Za�adowane Meble : 0%")
            setVehicleColor (v, 0, 0, 0 )
            setVehicleHandling(v,"maxVelocity",150)
            setElementData(v, "pojazdy_przebieg", math.random(500, 1000))
            setElementData(v, "pojazd_paliwo", 100)
            setVehicleEngineState(v, false)
        end
    end
end
setTimer(respawnVehicles, 5000, 0)
addEvent("checkCars", true)
addEventHandler("checkCars", resourceRoot, respawnVehicles)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 02:03


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3349 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

AkossPL, db3 co? pokazuje?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 09:58


_jvneczek







Wiek: 22
Na forum: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

mo?e daj kod licznika?
W liczniku pewnie masz ?e w poje?dzie kurierskim nie wy?wietla go.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 16:26


AkossPL







Wiek: 25
Na forum: 4221 dni
Posty: 140
Nick w MP: AkossPL

Piwa: 3

Respekt: 50

SataN., Skrypt na licznik:
local x, y = guiGetScreenSize()
local px, py= (x/1024), (y/768)
local sp = dxCreateTexture("licznik.png", "argb", false)
local sp2 = dxCreateTexture("wskazowka.png", "argb", false)
local sp3 = dxCreateTexture("bar.png", "argb", false)
local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", root, function()
    if not getPedOccupiedVehicle(localPlayer) then return end
    local speedx, speedy, speedz = getElementVelocity(getPedOccupiedVehicle(localPlayer))
    local fuel = getElementData(getPedOccupiedVehicle(localPlayer), "vehicle:fuel")
    local speed = (speedx^2 + speedy^2 + speedz^2)^(0.5) * 130
    local przeb = getElementData(getPedOccupiedVehicle(localPlayer), "vehicle:mileage")
    local txt = math.floor(speed*1.37)
    local txt2 = math.floor(przeb)
    if speed > 220 then
        dxDrawText(txt.." km/h", 900*px, 680*py)
        speed = 220
    end
    dxDrawImage(814*px, 538*py, 200*px, 220*py, sp)
    dxDrawImage(838*px, 580*py, 150*px, 180*py, sp2, speed-13.5)
    dxDrawImage(890*px, 730*py, 100*px, 20*py, sp3)
    dxDrawRectangle(892*px, 732*py, ((fuel*100/105))*px, 16*py, tocolor(220, 220, 200, 200))
    dxDrawText(txt2.." KM", 900*px, 710*py)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 18:01


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3349 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

AkossPL, Powinno dzia?a?:
Server

Pojazdy = {
{165.74, -275.48, 1.53-0.2, 358.1, 0.0, 87.6},
{165.74, -270.16, 1.52-0.2, 358.0, 360.0, 88.8},
{165.74, -265.24, 1.53-0.2, 358.2, 360.0, 89.1},
{165.74, -260.47, 1.52-0.2, 358.1, 0.1, 88.8},
{165.74, -255.96, 1.53-0.2, 358.1, 359.9, 87.2},
{165.74, -251.12, 1.52-0.2, 358.0, 360.0, 89.3},
{150.98, -229.54, 1.53-0.2, 358.3, 360.0, 178.8},
{146.26, -229.54, 1.50-0.2, 358.0, 360.0, 178.0},
{141.06, -229.54, 1.52-0.2, 358.2, 359.9, 179.1},
{135.75, -229.54, 1.51-0.2, 358.0, 0.0, 177.9},
{131.08, -229.54, 1.51-0.2, 358.0, 0.0, 178.7},
{125.70, -229.54, 1.52-0.2, 358.1, 0.0, 176.4},
{120.84, -229.54, 1.53-0.2, 358.2, 360.0, 178.3},
{115.85, -229.54, 1.53-0.2, 358.2, 0.0, 178.1},
{110.94, -229.54, 1.53-0.2, 358.1, 0.0, 179.3},
}

for i,v in ipairs(Pojazdy) do
    local Pojazd = createVehicle(414, v[1], v[2], v[3]+0.3, v[4], v[5], v[6])
    setElementData(Pojazd, "pojazd_opis", "Za�adowane Meble : 0%")
    setVehicleColor (Pojazd, 0, 0, 0 )
    setVehicleHandling(Pojazd,"maxVelocity",100)
    setElementData(Pojazd, "vehicle:mileage", math.random(500, 1000))
    setElementData(Pojazd, "vehicle:fuel", 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("* Rozpoczales prace jako kurier, jedz po paczki!", plr, 255, 255, 255)
            triggerClientEvent(plr, "kurier_praca", resourceRoot)
        else
            outputChatBox("* Posiadasz Ju� Aktywn� Prace!", plr, 255, 0, 0)
        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, "pojazd_opis", "Za�adowane Meble : 0%")
            setVehicleColor (v, 0, 0, 0 )
            setVehicleHandling(v,"maxVelocity",150)
            setElementData(v, "vehicle:mileage", math.random(500, 1000))
            setElementData(v, "vehicle:fuel", 100)
            setVehicleEngineState(v, false)
        end
    end
end
setTimer(respawnVehicles, 5000, 0)
addEvent("checkCars", true)
addEventHandler("checkCars", resourceRoot, respawnVehicles)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-15, 12:45


AkossPL







Wiek: 25
Na forum: 4221 dni
Posty: 140
Nick w MP: AkossPL

Piwa: 3

Respekt: 50

AmaMa., Nie dzia?a nie ?aduje paczek

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-15, 13:03


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3349 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

AkossPL, Zmieni?em tylko elementdaty pojazdu. Twoja praca jest popsuta. DB3 co? pokazuje?

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: widać :: licznika :: kurierze
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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