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

Wysłany: 2016-08-02, 12:50


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Witam mam problem z licznikiem pojazdu:

Licznik_c:
elektrytki = {
[507] = true,
[503] = true,
}
local screenW, screenH=guiGetScreenSize()
local dxfont0_tak= dxCreateFont("Czczionka.ttf",20)
function VGUI()
    local veh=getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    local vx, vy, vz = getElementVelocity(veh)
    local speed=((vx^2 + vy^2 + vz^2)^(0.5))*180
    local speedy= speed*0.97
    local fuel= getElementData(veh,"vehicle:fuel") or 0
    local mileage= getElementData(veh,"vehicle:mileage") or 0
    dxSetBlendMode('modulate_add')
    if getElementHealth(veh) < 301 then
    setElementHealth(veh,302)
    end
    dxSetAspectRatioAdjustmentEnabled( true ,1.68)
        dxDrawLine((screenW * 0.8169) - 1, (screenH * 0.9036) - 1, (screenW * 0.8169) - 1, screenH * 0.9375, tocolor(0, 0, 0, 255), 1, false)
        
        dxDrawLine(screenW * 0.9397, (screenH * 0.9036) - 1, (screenW * 0.8169) - 1, (screenH * 0.9036) - 1, tocolor(0, 0, 0, 255), 1, false)
        
        dxDrawLine((screenW * 0.8169) - 1, screenH * 0.9375, screenW * 0.9397, screenH * 0.9375, tocolor(0, 0, 0, 255), 1, false)
        
        dxDrawLine(screenW * 0.9397, screenH * 0.9375, screenW * 0.9397, (screenH * 0.9036) - 1, tocolor(0, 0, 0, 255), 1, false)
        
        dxDrawRectangle(screenW * 0.8169, screenH * 0.9036, screenW * 0.1228, screenH * 0.0339, tocolor(0, 0, 0, 227), false)
            if fuel > 10 and fuel <= 100 then
        if elektrytki[getElementModel(veh)] then
            dxDrawRectangle(screenW * 0.8169, screenH * 0.9036, screenW * 0.0620+ (fuel*0.83), screenH * 0.0339, tocolor(43, 188, 70, 255), false)
        else
            dxDrawRectangle(screenW * 0.8169, screenH * 0.9036, screenW * 0.0620+ (fuel*0.83), screenH * 0.0339, tocolor(43, 188, 70, 255), false)
        end
    elseif fuel > 100 then
        if elektrytki[getElementModel(veh)] then
            dxDrawRectangle(screenW * 0.8169, screenH * 0.9036, screenW * 0.1228, screenH * 0.0339, tocolor(255, 255, 255, 255), false)
        else
            dxDrawRectangle(screenW * 0.8169, screenH * 0.9036, screenW * 0.1228, screenH * 0.0339, tocolor(255, 255, 255, 255), false)
        end
    else
    dxDrawRectangle(screenW * 0.8169, screenH * 0.9036, screenW * 0.0102, screenH * 0.0339, tocolor(250, 0, 0, 255), false)
    end
    if ( getVehicleOverrideLights ( veh ) ~= 2 ) then  -- if the current state isnt 'force on'
        dxDrawText(('%01d'):format(math.floor(mileage)).." KM", screenW * 0.8300, screenH * 0.8500, screenW * 0.8949, screenH * 0.8685, tocolor(255, 255, 255, 255), 0.75, dxfont0_tak, "center", "center", false, false, false, false, false)
                  dxDrawImage(screenW * 0.7493, screenH * 0.6107, screenW * 0.2228, screenH * 0.3490, "img/cif.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
                 dxDrawImage(screenW * 0.7662, screenH * 0.5964, screenW * 0.1875, screenH * 0.3464, "img/arrow.png", 0+speedy, 0, 0, tocolor(255, 255, 255, 255), false)
    else
        dxDrawText(('%01d'):format(math.floor(mileage)).." KM", screenW * 0.8300, screenH * 0.8500, screenW * 0.8949, screenH * 0.8685, tocolor(255, 0, 0, 255), 0.75, dxfont0_tak, "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.7493, screenH * 0.6107, screenW * 0.2228, screenH * 0.3490, "img/cifn.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.7662, screenH * 0.5964, screenW * 0.1875, screenH * 0.3464, "img/arrow.png", 0+speedy, 0, 0, tocolor(255, 255, 255, 255), false)
    end
    if elektrytki[getElementModel(veh)] then
    end
    dxSetBlendMode('blend')
end

addEventHandler("onClientRender", root, function()
    --if not getElementData(localPlayer,"player:logged") then return end
    VGUI()
end)

paliwo:
local czas = getTickCount()

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

function odejmijPaliwo(pojazd)
    if getTickCount() - czas > 150 then
        czas = getTickCount()
        local paliwo = 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
            paliwo = paliwo-spd*2
            setElementData(pojazd, "vehicle:fuel", paliwo)
        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(pojazd) then return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    odejmijPaliwo(pojazd)
end)

function zgasSilnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
    local data = getElementData(v, "vehicle:fuel")
        if data then
        if tonumber(data) < 0 then
            setVehicleEngineState(v, false)
        end
end
    end
end
setTimer(zgasSilnik, 1000, 999999999) 

przebieg:
local czas = getTickCount()

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

function naliczPrzebieg(pojazd)
    if getTickCount() - czas > 300 then
        czas = getTickCount()
        local przebieg = 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
            przebieg = przebieg+spd*2
            setElementData(pojazd, "vehicle:mileage", przebieg)
        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(pojazd) then return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    naliczPrzebieg(pojazd)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 12:52


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

STOPseba, Nie masz pliku czcionka.ttf w folderze. A jest dodany do mety.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 13:30


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

W?a?nie jest ten plik
<meta>
             <file src="Czczcionka.ttf" />
             <file src="cif.png" />
             <file src="cifn.png" />
             <file src="arrow.png" />
    <script src="Licznik_c.lua" type="client" />
    <script src="paliwo.lua" type="client" />
    <script src="paliwo_s.lua" type="server" />
    <script src="przebieg.lua" type="client" />
</meta>


[ Dodano: 2016-08-02, 13:31 ]


Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 13:35


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

Nie widzisz liter?wki?
w mecie masz Czczcionka

a plik si? nazywa Czczionka w kodzie te? jest Czczionka

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 13:47


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

a teraz inny problem:


Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 13:48


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

STOPseba, Konkretnie ? ;-;

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 13:51


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"marcin778" napisał/a:

STOPseba, Konkretnie ? ;-;

no licznik sie nie pokazuje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 13:59


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

Jakie? b??dy w /debugscript 3 lub na F8 ?

[ Dodano: 2016-08-02, 14:00 ]
Podczas resetowania skryptu

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 14:04


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Brak

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 14:05


Brzysiek

Skrypter pralek






Wiek: 28
Na forum: 5339 dni
Posty: 488
Nick w MP: Brzysiek

Piwa: 1034

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360

W meta.xml masz pliki .png w g??wnym folderze a w skrypcie masz w folderze img.
Przenie? pliki do folderu img i zmie? w mecie:

             <file src="img/cif.png" />
             <file src="img/cifn.png" />
             <file src="img/arrow.png" />


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 14:05


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

<meta>
             <file src="Czczcionka.ttf" />
             <file src="img/cif.png" />
             <file src="img/cifn.png" />
             <file src="img/arrow.png" />
    <script src="Licznik_c.lua" type="client" />
    <script src="paliwo.lua" type="client" />
    <script src="paliwo_s.lua" type="server" />
    <script src="przebieg.lua" type="client" />
</meta>


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 14:25


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Dobra dzia?a dzi?ki.

[ Dodano: 2016-08-02, 14:57 ]
dobra juz chyba ostatnie pytanie jak usun?? ten poziom paliwa


Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 15:59


Podhal







Wiek: 25
Na forum: 3989 dni
Posty: 101

Piwa: 805

Respekt: 200
Respekt: 200Respekt: 200

STOPseba, usu? z mety

Kod:

<script src="paliwo.lua" type="client" />
<script src="paliwo_s.lua" type="server" />
<script src="przebieg.lua" type="client" />


I tak samo usu? z plik?w paliwo.lua paliwo_s.lua przebieg.lua i powinno dzia?a?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 16:02


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"Podhal" napisał/a:

STOPseba, usu? z mety

Kod:

<script src="paliwo.lua" type="client" />
<script src="paliwo_s.lua" type="server" />
<script src="przebieg.lua" type="client" />


I tak samo usu? z plik?w paliwo.lua paliwo_s.lua przebieg.lua i powinno dzia?a?.

Ale mi chodzi?o ?eby usuna? ta tabele

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-02, 16:17


Podhal







Wiek: 25
Na forum: 3989 dni
Posty: 101

Piwa: 805

Respekt: 200
Respekt: 200Respekt: 200

STOPseba, ta tabela to paliwo.

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