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

Wysłany: 2020-07-05, 19:27


NorbiTTT

Nbi#1824






Wiek: 27
Na forum: 3207 dni
Posty: 193
Nick w MP: Nbi

Piwa: 698

Respekt: 60

Mam problem, poniewa? po d?ugiej je?dzie ani nie ro?nie przebieg ani nie maleje bak, paczka eclipse, wie ktos moze co jest nie tak?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 19:29


Szypki_exe







Wiek: 21
Na forum: 3239 dni
Posty: 172

Piwa: 1426

Respekt: 150
Respekt: 150Respekt: 150

Podaj kod z kt?rym masz problem, upewnij si? ?e skrypt kt?ry za to odpowiada jest uruchomiony

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 20:04


NorbiTTT

Nbi#1824






Wiek: 27
Na forum: 3207 dni
Posty: 193
Nick w MP: Nbi

Piwa: 698

Respekt: 60

W?asnie w tym problem ze nie wiem od ktorego skryptu to zalezy :O

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 20:42


Szypki_exe







Wiek: 21
Na forum: 3239 dni
Posty: 172

Piwa: 1426

Respekt: 150
Respekt: 150Respekt: 150

Je?li u?ywany przez Ciebie gm bazuje na ogrpg to prawdopodobnie system paliwa i przebiegu znajduje si? w skrypcie od stacji - sprawd? go. Bez kodu nikt nie jest w stanie Ci pom?c.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 21:27


NorbiTTT

Nbi#1824






Wiek: 27
Na forum: 3207 dni
Posty: 193
Nick w MP: Nbi

Piwa: 698

Respekt: 60


--[[
        ResourceOURGame
    DevelopersSplit <split.programista@gmail.com>
    Copyright <split.programista@gmail.com2015-2016
    You have no right to use this code without my permission.
]]

-- Kod odpowiadaj?cy za odejmowanie paliwa oraz dodawanie paliwa
-- Wszelkie inne rzeczy sw systemie pojazd?// Split
local time=getTickCount()
local isBike={[509]=true,[481]=true,[510]=true}
local x1,y1,z1



local oXoYoZ
local function naliczaj(veh)
    if(isPedInVehicle(localPlayer)) then
        local pojazd getPedOccupiedVehicle(localPlayer)
        if getElementData(pojazd'vehicle:id'then 
            
            local x,y,getElementPosition(pojazd)
            local thisTime  getDistanceBetweenPoints3D(x,y,z,oX,oY,oZ)
            local dst getElementData(pojazd"vehicle:mileage") or 0
            local dystans_add thisTime
            oX x
            oY y
            oZ z
            local przebiegAdd=dystans_add/100
            local fuelAdd=dystans_add/600
            setElementData(pojazd"vehicle:mileage"getElementData(pojazd"vehicle:mileage")+przebiegAdd)
            setElementData(pojazd,"vehicle:fuel",getElementData(pojazd,"vehicle:fuel") - fuelAdd )
        end
    end
end
addEventHandler('onClientVehicleEnter',root,function()
    local xygetElementPosition(localPlayer)
    oXoYoZ xyz
end)
addEventHandler("onClientRender"root, function()
    local vehicle getPedOccupiedVehicle(localPlayer)
    if not vehicle then return end


    if isBike[getElementModel(vehicle)] then return end
    if not getVehicleEngineState(vehiclethen return end
    if getElementData(vehicle"vehicle:lpg") == 0 then
    if getElementData(vehicle,"vehicle:fuel") and getElementData(vehicle,"vehicle:fuel") or getElementData(vehicle,"vehicle:mileage") and getElementData(vehicle,"vehicle:mileage"then
        naliczaj(vehicle)
        if getElementData(vehicle,"vehicle:fuel")<1 then
            setVehicleEngineState(vehiclefalse)
        end
    end
    end
end)




local czas getTickCount()

isBike = {
    [509]=true, --Bike
    [481]=true, --BMX
    [510]=true, --Mountain bike
}

function odejmijPaliwo(pojazd)
    if getElementData(pojazd"lpg:on"truethen return end
    if getElementData(pojazd"lpg:off"truethen
    if getTickCount() - czas 150 then
        czas getTickCount()
        local paliwo getElementData(pojazd"vehicle:fuel") or 0
        local vx,vy,vz getElementVelocity(pojazd)
        local spd = ((vx^2+vy^2+vz^2)^(0.5)/150)
        if spd 0 then
            paliwo paliwo-spd*2
            setElementData(pojazd"vehicle:fuel"paliwo)
        end
    end
end
end

addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if not pojazd then return end
    if getElementData(pojazd"lpg:on"then return end
    if getElementData(pojazd"lpg:off"then
    if isBike[getElementModel(pojazd)] then return end
    if not getVehicleEngineState(pojazdthen return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    odejmijPaliwo(pojazd)
end
end)

addEvent("TANKUJ",true)
addEventHandler("TANKUJ",root,function()
    if getPlayerMoney(source)>= 5000 then
        takePlayerMoney(source5000)
        triggerClientEvent("TANKUJ",source)
    end
end)

function zgasSilnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
    local data getElementData(v"vehicle:fuel")
        if data then
        if getElementData(v"lpg:off"then
        if tonumber(data) < 0 then
            setVehicleEngineState(vfalse)
        end
    end
end
    end
end
setTimer(zgasSilnik10000) 

function koniecpaliwa()
    vehicle getPedOccupiedVehicle(localPlayer)
    if getElementData(vehicle"lpg:on"then return end
    if vehicle and (not getElementData(vehicle,"vehicle:fuel") == false ) and getElementData(vehicle,"vehicle:fuel") <= 0 then
        if getElementData(vehicle"lpg:off"then
        setElementData(vehicle,"vehicle:fuel",0)
        setElementData(vehicle,"koniecpaliwa",true)
        setVehicleEngineState(vehicle,false)
    end
end
end
addEventHandler("onClientRender",root,koniecpaliwa)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 21:41


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3061 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

Podaj r?wnie? b??dy z db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 21:42


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pojazd posiada wszystkie wymagane elementdaty? Oba kody s? po kliencie czy co to, w jednym pliku?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 21:44


NorbiTTT

Nbi#1824






Wiek: 27
Na forum: 3207 dni
Posty: 193
Nick w MP: Nbi

Piwa: 698

Respekt: 60

B?ed?w z db3 brak,
g?rny kod to strona clienta
dolny servera

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-05, 22:00


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Mo?e ogarnij najpierw ten kod, po serwerze masz event 'onClientRender' i u?ywasz zmiennych 'localPlayer'? Zr?b porz?dek i wklej kod na nowo.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-12, 15:45


NorbiTTT

Nbi#1824






Wiek: 27
Na forum: 3207 dni
Posty: 193
Nick w MP: Nbi

Piwa: 698

Respekt: 60

problem rozwi?zany, mozna zamknac

Postaw piwo autorowi tego posta
 

 
Tagi: paliwo :: 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 » paliwo i przebieg 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