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

Wysłany: 2019-02-27, 20:53


Karolowatyy







Wiek: 25
Na forum: 3286 dni
Posty: 117
Nick w MP: Ripley

Piwa: 826

Respekt: 90

Ostrzeżeń: 20%
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 R* oraz :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-27, 21:33


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8


Więcej informacji znajdziesz w Wikipedii MTA:

getElementSpeed


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
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-27, 21:36


Karolowatyy







Wiek: 25
Na forum: 3286 dni
Posty: 117
Nick w MP: Ripley

Piwa: 826

Respekt: 90

Ostrzeżeń: 20%
[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(theElementunit)
    -- 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) == or tonumber(unit) == 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/if no unit specified and 'ignore' argument type if the string contains a number
    unit unit == nil and or ((not tonumber(unit)) and unit or tonumber(unit))
    -- Setup our multiplier to convert the velocity to the specified unit
    local mult = (unit == or unit == "m/s") and 50 or ((unit == or unit == "km/h") and 180 or 111.84681456)
    -- Return the speed by calculating the length of the velocity vectorafter converting the velocity to the specified unit
    return (Vector3(getElementVelocity(theElement)) * mult).length
end

function drawSpeed()
    local vehicle getPedOccupiedVehicle(getLocalPlayer())
    local speedmsspeedkmhspeedmph getElementSpeed(vehicle), getElementSpeed(vehicle1), getElementSpeed(vehicle2)
    local roundedSpeedmsroundedSpeedkmhroundedSpeedmph 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(speedoText10235881138661tocolor(255255255255), 0.30dxfont0_ForzaBookItalic"left""top"falsefalsefalsefalsefalse)
end
addEventHandler("onClientPreRender"getRootElement(), drawSpeed)


Postaw piwo autorowi tego posta
 

 
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

Respekt: 47,3

function drawSpeed()
    local vehicle getPedOccupiedVehicle(getLocalPlayer())
    local speedmsspeedkmhspeedmph getElementSpeed(vehicle), getElementSpeed(vehicle1), getElementSpeed(vehicle2)
    local roundedSpeedmsroundedSpeedkmhroundedSpeedmph 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), 10235881138661tocolor(255255255255), 0.30dxfont0_ForzaBookItalic"left""top"falsefalsefalsefalsefalse)
end


Podpis
Aktualny projekt:


AntoriaMTA
Discord: https://discord.gg/TVrAddp3Wu

Najszybszy kontakt (discord): Malentas#2091
Postaw piwo autorowi tego posta
 

 
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

Respekt: 90

Ostrzeżeń: 20%
[quote="Malentas"][/quote]

Dzi?ki dzia?a! Piwko i respekt leci!

Do zamkni?cia

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 » Licznik 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