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

Wysłany: 2016-11-17, 13:59


macieq.

Grafik






Wiek: 28
Na forum: 3513 dni
Posty: 42
Nick w MP: 1Macieq



Respekt: 50

Mam problem, bo chcia?bym doda? do liczniku nabijanie km, ale co? mi nie dzia?a
i ss :

local rowery={[509]=true,[481]=true,[510]=true}

addEventHandler("onClientRender"root, function()

    local veh=getPedOccupiedVehicle(localPlayer) 
    
    if not veh then return end
    if rowery[getElementModel(veh)] then return end -- rowery nie ma ja gownolicznika
    if getVehicleController(veh) ~= localPlayer then return end -- sterownosc gownolicznika tznauta..
    
    local vx,vy,vz=getElementVelocity(veh)
    predkosc=(vx^2+vy^2+vz^2)^0.45*1.55*100  
    
    local paliwo string.format "%01.0f"getElementData(veh"paliwo") or 0) -- tutaj gownopaliwojak masz 0 to ci nie odpali czy jak to tam
    if predkosc 0 then return end 
    
    local screenWscreenH guiGetScreenSize()
    
      
        dxDrawRectangle(screenW 0.8075screenH 0.8000screenW 0.0049screenH 0.2409tocolor(2552550255), false)
        dxDrawRectangle(screenW 0.8125screenH 0.8000screenW 0.1917screenH 0.3294tocolor(000255), false) --Czarne gowno
        dxDrawRectangle(screenW 0.9963screenH 0.8000screenW 0.0049screenH 0.2409tocolor(12552550255), false)
        ddxDrawText(('%01d'):format(math.floor(mileage)).."km"screenW 0.8613screenH 0.8878screenW 0.9539screenH 0.8424tocolor(255255255255), 3.00"Bebas""center""center"falsefalsefalsefalsefalse)
        dxDrawRectangle(screenW 0.8075screenH 0.8000screenW 0.3000screenH 0.0052tocolor(2552550255), false)
        dxDrawText(string.format("%.0f",predkosc).." KM/H"screenW 0.8613screenH 0.8878screenW 0.9539screenH 0.8424tocolor(255255255255), 3.00"Bebas""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Paliwo : "..paliwo.." L"screenW 0.8513screenH 0.9685screenW 0.9539screenH 0.9531tocolor(255255255255), 2.00"Bebas""center""center"falsefalsefalsefalsefalse)
        dxDrawText("© yGame"screenW 0.8161screenH 0.8090screenW 1.0531screenH 1.0716tocolor(2552550255), 0.80"Bebas""left""top"falsefalsefalsefalsefalse)
       

end
)



 
local time getTickCount()
function zabiera_paliwo(auto)

    if getTickCount() - time 100 then
    time getTickCount()
    local vx,vy,vz getElementVelocity(auto)
    local predkosc = ((vx^2+vy^2+vz^2)^(0.5)/100)
    local paliwo getElementData(auto"paliwo") or 0
    if predkosc 0 then -- je?eli samoch?d stoi w miejscu paliwa nie bedzie zabierac
    paliwo paliwo-predkosc*2
    setElementData(auto"paliwo"paliwo)
    
end
end
end

addEventHandler("onClientRender"root, function()

    local auto getPedOccupiedVehicle(localPlayer)
    if not auto then return end
    if not getVehicleEngineState(autothen return end
    if getVehicleController(auto) ~= localPlayer then return end
    zabiera_paliwo(auto)
    
end
)


function silnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
    local pal getElementData(v"paliwo")
        if pal then
        if tonumber(pal) < 0 then
            setVehicleEngineState(vfalse)
        end
end
    end
end
setTimer(silnik10002500) 




 
local time getTickCount()
function zabiera_paliwo(auto)

    if getTickCount() - time 100 then
    time getTickCount()
    local vx,vy,vz getElementVelocity(auto)
    local predkosc = ((vx^2+vy^2+vz^2)^(0.5)/100)
    local paliwo getElementData(auto"paliwo") or 0
    if predkosc 0 then -- je?eli samoch?d stoi w miejscu paliwa nie bedzie zabierac
    paliwo paliwo-predkosc*2
    setElementData(auto"paliwo"paliwo)
    
end
end
end

addEventHandler("onClientRender"root, function()

    local auto getPedOccupiedVehicle(localPlayer)
    if not auto then return end
    if not getVehicleEngineState(autothen return end
    if getVehicleController(auto) ~= localPlayer then return end
    zabiera_paliwo(auto)
    
end
)

function silnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
    local pal getElementData(v"paliwo")
        if pal then
        if tonumber(pal) < 0 then
            setVehicleEngineState(vfalse)
        end
end
    end
end
setTimer(silnik10002500) 
--- przebieg z neta.. bo moj nie dzialal





Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-17, 14:04


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64

Podaj 24 linijk?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-17, 14:07


macieq.

Grafik






Wiek: 28
Na forum: 3513 dni
Posty: 42
Nick w MP: 1Macieq



Respekt: 50

ddxDrawText(('%01d'):format(math.floor(mileage)).."km"screenW 0.8613screenH 0.8878screenW 0.9539screenH 0.8424tocolor(255255255255), 3.00"Bebas""center""center"falsefalsefalsefalsefalse


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-17, 14:11


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64

dxDrawText("Przebieg : "..mileage.." KM "screenW 0.8513screenH 0.9685screenW 0.9539screenH 0.9531tocolor(255255255255), 2.00"Bebas""center""center"falsefalsefalsefalsefalse)



spr?buj tak tylko kordy pozmieniaj

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-17, 14:15


macieq.

Grafik






Wiek: 28
Na forum: 3513 dni
Posty: 42
Nick w MP: 1Macieq



Respekt: 50

Dalej nic

[ Dodano: 2016-11-17, 14:16 ]
Bo ja nie mam zrobionej funkcji na przebieg, dlatego chyba :\

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-17, 14:16


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64

No to musisz zrobi??:D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-17, 14:23


macieq.

Grafik






Wiek: 28
Na forum: 3513 dni
Posty: 42
Nick w MP: 1Macieq



Respekt: 50

Dobra, mam ju? i teraz sprawa z moim licznikiem i ogrpg_cpny

Postaw piwo autorowi tego posta
 

 
Tagi: licznik
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