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

Wysłany: 2019-07-07, 02:15


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Siema
Przychodz? do was z pytaniem jak zrobi? aby po przekroczeniu pr?dko?ci w aucie np. 70km/h wykonywa?o dan? funkcj? jak? chce zrobi??
Ma kto? jaki? pomys??

Za pomoc daje ka?demu :piwo: oraz R*

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-07, 16:19


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Przyk?ad kodu z mojego serwera :


speedxspeedyspeedz getElementVelocity getPedOccupiedVehicle(hit) )
                    actualspeed = (speedx^speedy^speedz^2)^(0.5)
                    kmh actualspeed 180
                    if tonumber(math.floor(kmh))>tonumber(getElementData(source,"predkosc")) then

--tu dana akcja


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-08, 06:48


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

A jak to przerobi? aby dzia?a?o u mnie?
Nwm czy potrzebne ale mo?e si? przyda?, kod licznika z mojego serwera:

sxsy guiGetScreenSize(  )
me localPlayer

addEventHandler"onClientRender"root, function()
    veh getPedOccupiedVehicleme )
    if not veh then return end
    speed getElementSpeedveh"km/h" )
    fuel getElementDataveh"vehicle:fuel" ) if not fuel then setElementDataveh"vehicle:fuel"100 fuel 100 end
    mileage getElementDataveh"vehicle:mileage" ) if not mileage then setElementDataveh"vehicle:mileage"100 mileage 100 end
    dxDrawImagesx 350sy 105350105"licznik.png" )
    xsx 268sy 8
    dxDrawTextmath.floor(speed) .. "km"x16x16tocolor2551101255 ), 1.5"default-bold""center""center" )
    xsx 156sy 8
    dxDrawTextround(fuel1) .. "l"x16x16tocolor2551101255 ), 1.5"default-bold""center""center" )
    xsx 53sy 8
    dxDrawTextround(mileage1) .. "km"x16x16tocolor2551101255 ), 1.5"default-bold""center""center" )
end )

function getElementSpeed(theElementunit)
    local elementType getElementType(theElement)
    unit unit == nil and or ((not tonumber(unit)) and unit or tonumber(unit))
    local mult = (unit == or unit == "m/s") and 50 or ((unit == or unit == "km/h") and 180 or 111.84681456)
    return (Vector3(getElementVelocity(theElement)) * mult).length
end

function round(numnumDecimalPlaces)
  local mult 10^(numDecimalPlaces or 0)
  return math.floor(num mult 0.5) / mult
end 


Nie chce tego dawa? do tego kodu ale chce ?eby to dzia?a?o bo teraz nie dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-08, 07:04


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Yy normalnie?
if?tonumber(math.floor(speed)) > 70 then
--kod


Postaw piwo autorowi tego posta
 

 
Tagi: prędkość
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