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

Wysłany: 2016-04-28, 17:30


amama5







Wiek: 39
Na forum: 4745 dni
Posty: 57
Nick w MP: kamiloooswas

Piwa: 2

Respekt: 40,5

Ostrzeżeń: 100%
Witam mam problem przebiegiem by atex, ot?? pozamiania?em wszystkie elementdaty pod m?j system i wywala mi takie co?.... http://imgur.com/FjuMMeo Jak naprawi? ?eby przebieg ograniczy? si? do : np. 11.5km?

Kod :

local w,guiGetScreenSize()
local rowery = {[509]=true,[481]=true,[510]=true,}

function math.round(numberdecimalsmethod)
    decimals decimals or 0
    local factor 10 decimals
    if (method == "ceil" or method == "floor"then return math[method](number factor) / factor
    else return tonumber(("%."..decimals.."f"):format(number)) end
end

function hud()
    local v getPedOccupiedVehicle(localPlayer)
    if v then
        local sx,sy,sz getElementVelocity(getPedOccupiedVehicle(localPlayer))
        local kmhs math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
        local fuel=getElementData(v,"vehicle:fuel") or 0
        local mileage=getElementData(v,"vehicle:mileage") or 0
        
        -- ogolne
        dxDrawImage(0.81770.76850.18230.2315"images/spdmeter1.png"000tocolor(255255255255), false)
        dxDrawImage(0.86250.82310.14480.1296"images/wskaznik.png"kmhs+32000tocolor(255255255255), false)
        dxDrawImage(0.82500.93240.05100.0454"images/wskaznik.png"fuel+3000tocolor(255255255255), false)
        dxDrawText(mileage.."km"0.91610.91940.95420.9352tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
        
        -- kontrolki
        if fuel 30 then
            r1,g1,b1 254,107,3
        else
            r1,g1,b1 255,255,255
        end
        
        if isElementFrozen(vthen
            r2,g2,b2 255,0,0
        else
            r2,g2,b2 255,255,255
        end
        
        local silnik getVehicleEngineState(v)
        if silnik == false then
            r3,g3,b3 255,0,0
        else
            r3,g3,b3 255,255,255
        end
        
        if getVehicleOverrideLights(v) ~= 2 then
            r4,g4,b4 255,255,255
        else
            r4,g4,b4 70,184,73
        end
        
        dxDrawImage(0.84320.96300.01560.0278"images/paliwo.png"000tocolor(r1g1b1200), false)
        dxDrawImage(0.92660.96300.01560.0278"images/reczny.png"000tocolor(r2g2b2200), false)
        dxDrawImage(0.90570.95370.01560.0278"images/silnik.png"000tocolor(r3g3b3200), false)
        dxDrawImage(0.94740.95370.01560.0278"images/swiatla.png"000tocolor(r4g4b4200), false)
    end
end

addEventHandler("onClientVehicleEnter",root,function(plr)
    if plr ~= localPlayer then return end
    local v getPedOccupiedVehicle(localPlayer)
    if rowery[getElementModel(v)] then return end
    if getElementData(v,"dokupienia"then return end
    addEventHandler("onClientRender",root,hud)
end)

addEventHandler("onClientVehicleExit",root,function(plr,seat)
    if plr ~= localPlayer then return end
    if seat ~= 0 then return end
    removeEventHandler("onClientRender",root,hud)
end)

local czas getTickCount()

isBike = {
    [509]=true, --Bike
    [481]=true, --BMX
    [510]=true, --Mountain bike
    
}

function odejmijfuel(pojazd)
    if getTickCount() - czas 150 then
        czas getTickCount()
        local fuel=getElementData(pojazd,"vehicle:fuel") or 0
        local vx,vy,vz getElementVelocity(pojazd)
        local spd = ((vx^2+vy^2+vz^2)^(0.5)/150)
        if spd 0 then
            fuel fuel-spd*2
        local fuel=getElementData(pojazd,"vehicle:fuel") or 0
        end
    end
end

addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if not pojazd then return end
    if isBike[getElementModel(pojazd)] then return end
    if not getVehicleEngineState(pojazdthen return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    odejmijfuel(pojazd)
end)

function zgasSilnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
        local fuel=getElementData(v,"vehicle:fuel") or 0
        if data then
        if tonumber(data) <= 0 then
            setVehicleEngineState(vfalse)
        end
end
    end
end
setTimer(zgasSilnik10000local czas getTickCount()

isBike = {
    [509]=true, --Bike
    [481]=true, --BMX
    [510]=true, --Mountain bike
}

function naliczmileage(pojazd)
    if getTickCount() - czas 300 then
        czas getTickCount()
        local mileage=getElementData(pojazd,"vehicle:mileage") or 0
        local vx,vy,vz getElementVelocity(pojazd)
        local spd = ((vx^2+vy^2+vz^2)^(0.5)/100)
        if spd 0 then
            mileage mileage+spd*2
            setElementData(pojazd"vehicle:mileage"mileage)
        end
    end
end

addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if not pojazd then return end
    if isBike[getElementModel(pojazd)] then return end
    if not getVehicleEngineState(pojazdthen return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    naliczmileage(pojazd)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-28, 21:37


_Wicek_

Majstersztyk






Wiek: 25
Na forum: 4260 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1841

Respekt: 360,5
Respekt: 360,5Respekt: 360,5Respekt: 360,5Respekt: 360,5

Ostrzeżeń: 40%
        dxDrawText(math.floor(mileage).."km"0.91610.91940.95420.9352tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)


Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Tagi: przebieg :: atex
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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