Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: nienaliczanie
1. Nienaliczanie przebiegu
Witam, posiadam system prywatnych pojazd?w od PanaPrezesa (nieco przerobiony przeze mnie), do tego system licznika wy?wietlaj?cy ID i przebieg. Z ID jest wszystko dobrze, s?k w tym, ?e przebieg ca?y czas wskazuje 0. Jakie? pomys?y?

Licznik: http://i.imgur.com/zAN3FvU.png

Kod server:
[lua]local czas = getTickCount()

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

function naliczPrzebieg(pojazd)
if getTickCount() - czas > 300 then
czas = getTickCount()
local przebieg = getElementData(pojazd, "przebieg") or 0
local vx,vy,vz = getElementVelocity(pojazd)
local spd = ((vx^2+vy^2+vz^2)^(0.5)/100)
if spd > 0 then
przebieg = przebieg+spd*2
setElementData(pojazd, "przebieg", przebieg)
end
end
end


addEventHandler("onClientRender", root, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if not pojazd then return end
if isBike[getElementModel(pojazd)] then return end
if not getVehicleEngineState(pojazd) then return end
if getVehicleController(pojazd) ~= localPlayer then return end
naliczPrzebieg(pojazd)
end)[/lua]

Kod client (cz???):
[lua]sw,sh = guiGetScreenSize()

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

addEventHandler("onClientRender", root, function()
if isPlayerMapVisible() then...