Wysłany: 2016-11-17, 13:59
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
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 tzn . auta ..
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 gownopaliwo , jak masz 0 to ci nie odpali czy jak to tam
if predkosc < 0 then return end
local screenW , screenH = guiGetScreenSize ()
dxDrawRectangle ( screenW * 0.8075 , screenH * 0.8000 , screenW * 0.0049 , screenH * 0.2409 , tocolor ( 255 , 255 , 0 , 255 ), false )
dxDrawRectangle ( screenW * 0.8125 , screenH * 0.8000 , screenW * 0.1917 , screenH * 0.3294 , tocolor ( 0 , 0 , 0 , 255 ), false ) -- Czarne gowno
dxDrawRectangle ( screenW * 0.9963 , screenH * 0.8000 , screenW * 0.0049 , screenH * 0.2409 , tocolor ( 1255 , 255 , 0 , 255 ), false )
ddxDrawText (( '%01d' ): format ( math . floor ( mileage )).. "km" , screenW * 0.8613 , screenH * 0.8878 , screenW * 0.9539 , screenH * 0.8424 , tocolor ( 255 , 255 , 255 , 255 ), 3.00 , "Bebas" , "center" , "center" , false , false , false , false , false )
dxDrawRectangle ( screenW * 0.8075 , screenH * 0.8000 , screenW * 0.3000 , screenH * 0.0052 , tocolor ( 255 , 255 , 0 , 255 ), false )
dxDrawText ( string . format ( "%.0f" , predkosc ).. " KM/H" , screenW * 0.8613 , screenH * 0.8878 , screenW * 0.9539 , screenH * 0.8424 , tocolor ( 255 , 255 , 255 , 255 ), 3.00 , "Bebas" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Paliwo : " .. paliwo .. " L" , screenW * 0.8513 , screenH * 0.9685 , screenW * 0.9539 , screenH * 0.9531 , tocolor ( 255 , 255 , 255 , 255 ), 2.00 , "Bebas" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "© yGame" , screenW * 0.8161 , screenH * 0.8090 , screenW * 1.0531 , screenH * 1.0716 , tocolor ( 255 , 255 , 0 , 255 ), 0.80 , "Bebas" , "left" , "top" , false , false , false , false , false )
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 ( auto ) then 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 ( v , false )
end
end
end
end
setTimer ( silnik , 1000 , 2500 )
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 ( auto ) then 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 ( v , false )
end
end
end
end
setTimer ( silnik , 1000 , 2500 )
--- przebieg z neta .. bo moj nie dzialal
Wysłany: 2016-11-17, 14:04
PapaSmerf
Wiek: 25 Na forum: 3526 dni Posty: 237
Piwa : 3857
Wysłany: 2016-11-17, 14:07
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
ddxDrawText (( '%01d' ): format ( math . floor ( mileage )).. "km" , screenW * 0.8613 , screenH * 0.8878 , screenW * 0.9539 , screenH * 0.8424 , tocolor ( 255 , 255 , 255 , 255 ), 3.00 , "Bebas" , "center" , "center" , false , false , false , false , false )
Wysłany: 2016-11-17, 14:11
PapaSmerf
Wiek: 25 Na forum: 3526 dni Posty: 237
Piwa : 3857
dxDrawText ( "Przebieg : " .. mileage .. " KM " , screenW * 0.8513 , screenH * 0.9685 , screenW * 0.9539 , screenH * 0.9531 , tocolor ( 255 , 255 , 255 , 255 ), 2.00 , "Bebas" , "center" , "center" , false , false , false , false , false )
spr?buj tak tylko kordy pozmieniaj
Wysłany: 2016-11-17, 14:15
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
Dalej nic
[ Dodano : 2016-11-17, 14:16 ]
Bo ja nie mam zrobionej funkcji na przebieg, dlatego chyba :\
Wysłany: 2016-11-17, 14:16
PapaSmerf
Wiek: 25 Na forum: 3526 dni Posty: 237
Piwa : 3857
Wysłany: 2016-11-17, 14:23
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
Dobra, mam ju? i teraz sprawa z moim licznikiem i ogrpg_cpny
Tagi: licznik
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: