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

Wysłany: 2016-03-05, 13:28


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4045 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

ej mam jeszcze jedno pytanie jak zrobi? zeby jeden licznik wyswietla? si? do aut sportowych a 2 do normalnych

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:31


mati2409

Uczę się LUA!






Wiek: 33
Na forum: 3800 dni
Posty: 97
Nick w MP: mati2409

Piwa: 73

Respekt: 50

Aidis, Ekspertem lua to ja nie jestem ,ale b?dziesz musia? chyba zmieni? zmienn? aut sportowych oraz zwyk?ych lub stworzy? zmienn? licznika sportowego oraz zwyk?ego

Podpis
Mapping <3
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:33


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4045 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

Kod:

samochody = { [480]= true, [533]= true, [439]= true, [555]= true, [422]= true, [600]= true, [543]= true, [478]= true, [554]= true, [536]= true, [575]= true, [534]= true, [567]= true, [535]= true, [566]= true, [576]= true, [412]= true, [579]= true, [400]= true, [500]= true, [470]= true, [489]= true, [505]= true, [495]= true, [438]= true, [596]= true, [598]= true, [597]= true, [420]= true, [445]= true, [504]= true, [401]= true, [518]= true, [527]= true, [542]= true, [507]= true, [562]= true, [585]= true, [419]= true, [526]= true, [466]= true, [492]= true, [474]= true, [546]= true, [517]= true, [410]= true, [551]= true, [516]= true, [467]= true, [426]= true, [436]= true, [547]= true, [405]= true, [580]= true, [560]= true, [550]= true, [549]= true, [540]= true, [491]= true, [529]= true, [421]= true, [602]= true, [429]= true, [496]= true, [402]= true, [541]= true, [415]= true, [589]= true, [587]= true, [565]= true, [494]= true, [502]= true, [503]= true, [411]= true, [559]= true, [603]= true, [475]= true, [506]= true, [451]= true, [558]= true, [477]= true, [418]= true, [404]= true, [479]= true, [458]= true, [561]= true, [458]= true, [434]= true, [545]= true, [442]= true, [409]= true, [525]= true }


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:35


mati2409

Uczę się LUA!






Wiek: 33
Na forum: 3800 dni
Posty: 97
Nick w MP: mati2409

Piwa: 73

Respekt: 50

Aidis, No i co ja mam z tym zrobi? lub kto? inny ?

Podpis
Mapping <3
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:37


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4045 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

Co mam zrobi? tera?


Kod:

local auta = { [480]= true, [533]= true, [439]= true, [555]= true, [422]= true, [600]= true, [543]= true, [478]= true, [554]= true, [536]= true, [575]= true, [534]= true, [567]= true, [535]= true, [566]= true, [576]= true, [412]= true, [579]= true, [400]= true, [500]= true, [470]= true, [489]= true, [505]= true, [495]= true, [438]= true, [596]= true, [598]= true, [597]= true, [420]= true, [445]= true, [504]= true, [401]= true, [518]= true, [527]= true, [542]= true, [507]= true, [562]= true, [585]= true, [419]= true, [526]= true, [466]= true, [492]= true, [474]= true, [546]= true, [517]= true, [410]= true, [551]= true, [516]= true, [467]= true, [426]= true, [436]= true, [547]= true, [405]= true, [580]= true, [560]= true, [550]= true, [549]= true, [540]= true, [491]= true, [529]= true, [421]= true, [602]= true, [429]= true, [496]= true, [402]= true, [541]= true, [415]= true, [589]= true, [587]= true, [565]= true, [494]= true, [502]= true, [503]= true, [411]= true, [559]= true, [603]= true, [475]= true, [506]= true, [451]= true, [558]= true, [477]= true, [418]= true, [404]= true, [479]= true, [458]= true, [561]= true, [458]= true, [434]= true, [545]= true, [442]= true, [409]= true, [525]= true }
local w,h = guiGetScreenSize()
local rowery = {[509]=true,[481]=true,[510]=true,}

function hud()
local veh = getPedOccupiedVehicle(localPlayer)
if veh then
local sx,sy,sz = getElementVelocity(getPedOccupiedVehicle(localPlayer))
local kmhs = math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
local paliwo = getElementData(veh,"pojazd_paliwo") or 0
local przebieg = getElementData(veh,"pojazd_przebieg") or 0

-- ogolne
dxDrawImage(w * 0.8177, h * 0.7685, w * 0.1823, h * 0.2315, "images/spdmeter1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(w * 0.8625, h * 0.8231, w * 0.1448, h * 0.1296, "images/wskaznik.png", kmhs+320, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(w * 0.8250, h * 0.9324, w * 0.0510, h * 0.0454, "images/wskaznik.png", paliwo+30, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText(('%.1f'):format(przebieg).."km", w * 0.9161, h * 0.9194, w * 0.9542, h * 0.9352, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)

-- kontrolki
if paliwo < 30 then
r1,g1,b1 = 254,107,3
else
r1,g1,b1 = 255,255,255
end

if isElementFrozen(veh) then
r2,g2,b2 = 255,0,0
else
r2,g2,b2 = 255,255,255
end

local silnik = getVehicleEngineState(veh)
if silnik == false then
r3,g3,b3 = 255,0,0
else
r3,g3,b3 = 255,255,255
end

if getVehicleOverrideLights(veh) ~= 2 then
r4,g4,b4 = 255,255,255
else
r4,g4,b4 = 70,184,73
end

dxDrawImage(w * 0.8432, h * 0.9630, w * 0.0156, h * 0.0278, "images/paliwo.png", 0, 0, 0, tocolor(r1, g1, b1, 200), false)
dxDrawImage(w * 0.9266, h * 0.9630, w * 0.0156, h * 0.0278, "images/reczny.png", 0, 0, 0, tocolor(r2, g2, b2, 200), false)
dxDrawImage(w * 0.9057, h * 0.9537, w * 0.0156, h * 0.0278, "images/silnik.png", 0, 0, 0, tocolor(r3, g3, b3, 200), false)
dxDrawImage(w * 0.9474, h * 0.9537, w * 0.0156, h * 0.0278, "images/swiatla.png", 0, 0, 0, tocolor(r4, g4, b4, 200), false)
end
end

addEventHandler("onClientVehicleEnter",root,function(plr)
if plr ~= localPlayer then return end
local veh = getPedOccupiedVehicle(localPlayer)
if rowery[getElementModel(v)] 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 lu=getTickCount()

local function naliczPrzebieg(veh)
if (getTickCount()-lu>250) then
local przebieg=getElementData(veh,"pojazd_przebieg") or 0
lu=getTickCount()
local vx,vy,vz=getElementVelocity(veh)
local spd=((vx^2 + vy^2 + vz^2)^(0.5)/100)
if (spd>0) then
przebieg=przebieg+(spd*2)
setElementData(veh, "pojazd_przebieg", przebieg)
end
end
end

function updatePrzebieg()
local veh=getPedOccupiedVehicle(localPlayer)
if (not veh) then return end
if (not getVehicleEngineState(veh)) then return end
if (getVehicleController(veh)~=localPlayer) then return end
naliczPrzebieg(veh)
end

addEventHandler("onClientRender", root, updatePrzebieg)
--[[
Author: AteX<atexprogramming@gmail.com>
]]--]]--


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:42


mati2409

Uczę się LUA!






Wiek: 33
Na forum: 3800 dni
Posty: 97
Nick w MP: mati2409

Piwa: 73

Respekt: 50

No jak wykluczy?e? auta te kt?re nie maj? mie? tego licznika to dodaj teraz te kt?re go maj? mie? :)

Podpis
Mapping <3
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:46


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4045 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

nie rozumiem. to s? te kt?re maj? by?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-05, 13:55


marcin778

Krytyk serwerów MTA






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

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8


Więcej informacji znajdziesz w Wikipedii MTA:

onVehicleStartEnter
Dodajesz do tego, te tablice, i dodajesz, ?e w tych pojazdach ma pojawia? si? ten licznik.

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

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

 
Wysłany: 2016-03-05, 14:05


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4045 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

a mam do zamieni? czy doda? do skryptu

Postaw piwo autorowi tego posta
 

 
Tagi: przebieg :: liczniku :: nie :: działa
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 W Liczniku Nie Działa 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