Wysłany: 2019-02-27, 20:53
Karolowatyy
Wiek: 25 Na forum: 3286 dni Posty: 117
Nick w MP: Ripley
Piwa : 826
Cze??, chcia?bym zrobi? sw?j licznik i nie wiem jakie b?d? mi potrzebne funckje
Chcia?bym bardziej zrobi?, ?e mam obrotomierz a po prawej stronie mam ile jad? km/h
Za pomoc dam oraz
Wysłany: 2019-02-27, 21:33
Gravgor
Wiek: 22 Na forum: 3620 dni Posty: 380
Nick w MP: 1944
Piwa : 702
Więcej informacji znajdziesz w Wikipedii MTA: dxDrawImage
Musisz teraz w dxDrawImage manipulowa? wskaz?wk?, uzywaj?c pr?dko?ci pojazdu
Podpis
Portfolio marceliborowczak.me
Wysłany: 2019-02-27, 21:36
Karolowatyy
Wiek: 25 Na forum: 3286 dni Posty: 117
Nick w MP: Ripley
Piwa : 826
[quote="Gravgor"][/quote] Dzi?ki zaraz zobacz?!
[ Dodano : 2019-02-27, 22:45 ]
Mam taki problem poniewa? pokazuje mi kilka liczb po kropce. Jak to zmieni??
local dxfont0_ForzaBookItalic = dxCreateFont ( "ForzaBookItalic.ttf" , 150 )
local sx = guiGetScreenSize ()
function getElementSpeed ( theElement , unit )
-- Check arguments for errors
assert ( isElement ( theElement ), "Bad argument 1 @ getElementSpeed (element expected, got " .. type ( theElement ) .. ")" )
assert ( getElementType ( theElement ) == "player" or getElementType ( theElement ) == "ped" or getElementType ( theElement ) == "object" or getElementType ( theElement ) == "vehicle" , "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType ( theElement ) .. ")" )
assert (( unit == nil or type ( unit ) == "string" or type ( unit ) == "number" ) and ( unit == nil or ( tonumber ( unit ) and ( tonumber ( unit ) == 0 or tonumber ( unit ) == 1 or tonumber ( unit ) == 2 )) or unit == "m/s" or unit == "km/h" or unit == "mph" ), "Bad argument 2 @ getElementSpeed (invalid speed unit)" )
-- Default to m / s if no unit specified and 'ignore' argument type if the string contains a number
unit = unit == nil and 0 or (( not tonumber ( unit )) and unit or tonumber ( unit ))
-- Setup our multiplier to convert the velocity to the specified unit
local mult = ( unit == 0 or unit == "m/s" ) and 50 or (( unit == 1 or unit == "km/h" ) and 180 or 111.84681456 )
-- Return the speed by calculating the length of the velocity vector , after converting the velocity to the specified unit
return ( Vector3 ( getElementVelocity ( theElement )) * mult ). length
end
function drawSpeed ()
local vehicle = getPedOccupiedVehicle ( getLocalPlayer ())
local speedms , speedkmh , speedmph = getElementSpeed ( vehicle ), getElementSpeed ( vehicle , 1 ), getElementSpeed ( vehicle , 2 )
local roundedSpeedms , roundedSpeedkmh , roundedSpeedmph = math . floor ( speedms ) == speedms and speedms or string . format ( speedms , "%.1f" ), math . floor ( speedkmh ) == speedkmh and speedkmh or string . format ( speedkmh , "%.1f" ), math . floor ( speedmph ) == speedmph and speedmph or string . format ( speedmph , "%.1f" )
local speedoText = "" .. speedkmh .. ""
dxDrawText ( speedoText , 1023 , 588 , 1138 , 661 , tocolor ( 255 , 255 , 255 , 255 ), 0.30 , dxfont0_ForzaBookItalic , "left" , "top" , false , false , false , false , false )
end
addEventHandler ( "onClientPreRender" , getRootElement (), drawSpeed )
Wysłany: 2019-02-28, 16:04
Malentas
Koder mirofali w lua
Wiek: 24 Na forum: 3681 dni Posty: 146
Nick w MP: Malentas
Piwa : 1626
function drawSpeed ()
local vehicle = getPedOccupiedVehicle ( getLocalPlayer ())
local speedms , speedkmh , speedmph = getElementSpeed ( vehicle ), getElementSpeed ( vehicle , 1 ), getElementSpeed ( vehicle , 2 )
local roundedSpeedms , roundedSpeedkmh , roundedSpeedmph = math . floor ( speedms ) == speedms and speedms or string . format ( speedms , "%.1f" ), math . floor ( speedkmh ) == speedkmh and speedkmh or string . format ( speedkmh , "%.1f" ), math . floor ( speedmph ) == speedmph and speedmph or string . format ( speedmph , "%.1f" )
local speedoText = "" .. speedkmh .. ""
dxDrawText ( math . floor ( speedoText ), 1023 , 588 , 1138 , 661 , tocolor ( 255 , 255 , 255 , 255 ), 0.30 , dxfont0_ForzaBookItalic , "left" , "top" , false , false , false , false , false )
end
Więcej szczegółów
Wystawiono 1 piw(a):Karolowatyy
Wysłany: 2019-03-02, 00:22
Karolowatyy
Wiek: 25 Na forum: 3286 dni Posty: 117
Nick w MP: Ripley
Piwa : 826
[quote="Malentas"][/quote]
Dzi?ki dzia?a! Piwko i respekt leci!
Do zamkni?cia
Tagi: licznik
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: