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

Wysłany: 2016-11-24, 18:28


Atroth







Wiek: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

Respekt: 540
Respekt: 540

Jak zrobi? przebieg za pomoc? dx.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 18:45


nanKy







Wiek: 22
Na forum: 3865 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

Zaczynasz od dodania locala czyli:
    
local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")

Teraz tworzymy dxDraw z przebiegiem

    if getElementData(veh,"ELEMENTDATYPRZEBIEGU"then
    dxDrawText(string.format(math.floor(mileage).. "Przebiegu"), -- po dodajemy wymiary screenW itd..
    end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 18:58


Atroth







Wiek: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

Respekt: 540
Respekt: 540

NankY., Ca?y skrypt wygl?da tak:


local screenWscreenH guiGetScreenSize()
addEventHandler("onClientRender"root,
    function()
        local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")
         if getElementData(veh,"ELEMENTDATYPRZEBIEGU"then
        dxDrawText("Przebieg:", (screenW 0.9219) - 1, (screenH 0.9241) - 1, (screenW 1.0448) - 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) + 1, (screenH 0.9241) - 1, (screenW 1.0448) + 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) - 1, (screenH 0.9241) + 1, (screenW 1.0448) - 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) + 1, (screenH 0.9241) + 1, (screenW 1.0448) + 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:"screenW 0.9219screenH 0.9241screenW 1.0448screenH 0.9463tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Pr?dko??:"screenW 0.9219screenH 0.8722screenW 1.0167screenH 0.9000tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        end
        local veh getPedOccupiedVehicle(localPlayer)
        if veh then
        local speedxspeedyspeedz getElementVelocity(veh)
        local predkosc = (speedx^speedy^speedz^2)^(0.5)
        local kmh predkosc 180
        dxDrawText(math.floor(kmh), screenW 0.9635screenH 0.8722screenW 1.0000screenH 0.8991tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        
    end
    end
)


I wyst?puj? warningi w linijce


local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")
if getElementData(veh,"ELEMENTDATYPRZEBIEGU"then


Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 19:02


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466


local screenWscreenH guiGetScreenSize()
addEventHandler("onClientRender"root,
    function()
        local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")
        dxDrawText("Przebieg: "..przebieg, (screenW 0.9219) - 1, (screenH 0.9241) - 1, (screenW 1.0448) - 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg, (screenW 0.9219) + 1, (screenH 0.9241) - 1, (screenW 1.0448) + 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg, (screenW 0.9219) - 1, (screenH 0.9241) + 1, (screenW 1.0448) - 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg, (screenW 0.9219) + 1, (screenH 0.9241) + 1, (screenW 1.0448) + 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:"screenW 0.9219screenH 0.9241screenW 1.0448screenH 0.9463tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Pr?dko??:"screenW 0.9219screenH 0.8722screenW 1.0167screenH 0.9000tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        end
        local veh getPedOccupiedVehicle(localPlayer)
        if veh then
        local speedxspeedyspeedz getElementVelocity(veh)
        local predkosc = (speedx^speedy^speedz^2)^(0.5)
        local kmh predkosc 180
        dxDrawText(math.floor(kmh), screenW 0.9635screenH 0.8722screenW 1.0000screenH 0.8991tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        
    end
    end
)


Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 19:02


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64

if getElementData(veh,"ELEMENTDATYPRZEBIEGU"then
to usu?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 19:20


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

amited, nie pomagaj poniewa? nie masz o tym widz? poj?cia.
Rookspack,
przenie? to:
   local veh getPedOccupiedVehicle(localPlayer)
        if veh then

pod to:
addEventHandler("onClientRender"root,
    function()


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 20:14


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

"luki123luki123" napisał/a:

amited, kolego nie r?b spamu. Pisz? o b??dach w linijkach a ty po raz 2 nie umiesz mu pom?c. Nie wiesz w czym le?y problem = nie pomagaj.


"Rookspack" napisał/a:

NankY.,
I wyst?puj? warningi w linijce


local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")
if getElementData(veh,"ELEMENTDATYPRZEBIEGU"then


Kolega na pewno mia? na my?li wy?wietlenie przebiegu pojazdu wi?c zrobi?em to. I prosi? tylko o to wi?c nie wiem o co si? pl?sasz... A ten if i tak jest nie potrzebny bo mo?na dopisa?
local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU") or "Brak danych. "


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 20:26


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

amited, kole? problem le?y po stronie argumentu nr. 1 bo go nie wyszukuje a jest on ni?ej i nie mo?e go znale??. Przeniesienie tego co poda?em na funkcje getElementData rozwi??e problem.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 20:51


Atroth







Wiek: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

Respekt: 540
Respekt: 540

luki123luki123, Ca?y kod obecnie wygl?da tak:


local screenWscreenH guiGetScreenSize()
addEventHandler("onClientRender"root,
    function()
    local veh getPedOccupiedVehicle(localPlayer)
        if veh then
        local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")
        dxDrawText("Przebieg:", (screenW 0.9219) - 1, (screenH 0.9241) - 1, (screenW 1.0448) - 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) + 1, (screenH 0.9241) - 1, (screenW 1.0448) + 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) - 1, (screenH 0.9241) + 1, (screenW 1.0448) - 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) + 1, (screenH 0.9241) + 1, (screenW 1.0448) + 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:"screenW 0.9219screenH 0.9241screenW 1.0448screenH 0.9463tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Pr?dko??:"screenW 0.9219screenH 0.8722screenW 1.0167screenH 0.9000tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        local speedxspeedyspeedz getElementVelocity(veh)
        local predkosc = (speedx^speedy^speedz^2)^(0.5)
        local kmh predkosc 180
        dxDrawText(math.floor(kmh), screenW 0.9635screenH 0.8722screenW 1.0000screenH 0.8991tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        
    end
    end
)


Chc? aby obok napisuje "Przebieg:" by? wy?wietlony obecny przebieg. Nie posiadam ?adnego skryptu na przebieg.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 20:55


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

"Rookspack" napisał/a:

luki123luki123, Ca?y kod obecnie wygl?da tak:


local screenWscreenH guiGetScreenSize()
addEventHandler("onClientRender"root,
    function()
    local veh getPedOccupiedVehicle(localPlayer)
        if veh then
        local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU")
        dxDrawText("Przebieg:", (screenW 0.9219) - 1, (screenH 0.9241) - 1, (screenW 1.0448) - 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) + 1, (screenH 0.9241) - 1, (screenW 1.0448) + 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) - 1, (screenH 0.9241) + 1, (screenW 1.0448) - 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:", (screenW 0.9219) + 1, (screenH 0.9241) + 1, (screenW 1.0448) + 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg:"screenW 0.9219screenH 0.9241screenW 1.0448screenH 0.9463tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Pr?dko??:"screenW 0.9219screenH 0.8722screenW 1.0167screenH 0.9000tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        local speedxspeedyspeedz getElementVelocity(veh)
        local predkosc = (speedx^speedy^speedz^2)^(0.5)
        local kmh predkosc 180
        dxDrawText(math.floor(kmh), screenW 0.9635screenH 0.8722screenW 1.0000screenH 0.8991tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        
    end
    end
)


Chc? aby obok napisuje "Przebieg:" by? wy?wietlony obecny przebieg. Nie posiadam ?adnego skryptu na przebieg.



W takim razie co ma si? wy?wietla? , je?eli nie posiadasz przebiegu to nie mo?e go wy?wietla? . Polecam u?y? ci przebiegu z gamemode XyzzyRP , kt?ry bez problemu znajdziesz w internecie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-24, 20:58


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

Rookspack,

local screenWscreenH guiGetScreenSize()
addEventHandler("onClientRender"root,
    function()
    local veh getPedOccupiedVehicle(localPlayer)
        if veh then
        local przebieg=getElementData(veh,"ELEMENTDATYPRZEBIEGU") or "Brak danych."
        dxDrawText("Przebieg: "..przebieg.. " KM", (screenW 0.9219) - 1, (screenH 0.9241) - 1, (screenW 1.0448) - 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg.. " KM", (screenW 0.9219) + 1, (screenH 0.9241) - 1, (screenW 1.0448) + 1, (screenH 0.9463) - 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg.. " KM", (screenW 0.9219) - 1, (screenH 0.9241) + 1, (screenW 1.0448) - 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg.. " KM", (screenW 0.9219) + 1, (screenH 0.9241) + 1, (screenW 1.0448) + 1, (screenH 0.9463) + 1tocolor(000255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Przebieg: "..przebieg.. " KM"screenW 0.9219screenH 0.9241screenW 1.0448screenH 0.9463tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Pr?dko??: "screenW 0.9219screenH 0.8722screenW 1.0167screenH 0.9000tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        local speedxspeedyspeedz getElementVelocity(veh)
        local predkosc = (speedx^speedy^speedz^2)^(0.5)
        local kmh predkosc 180
        dxDrawText(math.floor(kmh), screenW 0.9635screenH 0.8722screenW 1.0000screenH 0.8991tocolor(255255255255), 1.40"default""left""top"falsefalsefalsefalsefalse)
        
    end
    end
)

Je?eli chcesz naliczac przebieg to albo mo?esz wgra? z jakiego? GM ale sam nie potrafi? go napisa?

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-25, 17:38


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Rookspack, funkcja na przebieg:
local lu=getTickCount()

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

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

addEventHandler("onClientRender"rootupdatePrzebieg)    


Postaw piwo autorowi tego posta
 

 
Tagi: jak :: zrobić :: przebieg?
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