local czas = getTickCount()
isBike = {
[509]=true, --Bike
[481]=true, --BMX
[510]=true, --Mountain bike
[405]=true, --santiniel
[431]=true, --busik
[437]=true, --busiczek
[524]=true, --betonek
}
function odejmijPaliwo(pojazd)
if getTickCount() - czas > 150 then
czas = getTickCount()
local paliwo = getElementData(pojazd, "pojazd_paliwo") or 0
local vx,vy,vz = getElementVelocity(pojazd)
local spd = ((vx^2+vy^2+vz^2)^(0.5)/300)
if spd > 0 then
paliwo = paliwo-spd*2
setElementData(pojazd, "pojazd_paliwo", paliwo)
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
odejmijPaliwo(pojazd)
end)
function zgasSilnik()
for i,v in ipairs(getElementsByType("vehicle")) do
local data = getElementData(v, "pojazd_paliwo")
if data then
if tonumber(data) < 0 then
setVehicleEngineState(v, false)
end
end
end
end
setTimer(zgasSilnik, 1000, 999999999)
Sprawd? to
i To:
local czas = getTickCount()
isBike = {
[509]=true, --Bike
[481]=true, --BMX
[510]=true, --Mountain bike
[405]=true, --santiniel
[431]=true, --busik
[437]=true, --busiczek
[524]=true, --betonek
}
function odejmijPaliwo(pojazd)
if getTickCount() - czas > 150 then
czas = getTickCount()
local paliwo = getElementData(pojazd, "pojazd_paliwo") or 0
local vx,vy,vz = getElementVelocity(pojazd)
local spd = ((vx^2+vy^2+vz^2)^(0.5)/50)
if spd > 0 then
paliwo = paliwo-spd*2
setElementData(pojazd, "pojazd_paliwo", paliwo)
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
odejmijPaliwo(pojazd)
end)
function zgasSilnik()
for i,v in ipairs(getElementsByType("vehicle")) do
local data = getElementData(v, "pojazd_paliwo")
if data then
if tonumber(data) < 0 then
setVehicleEngineState(v, false)
end
end
end
end
setTimer(zgasSilnik, 1000, 999999999)
local czas = getTickCount()
isBike = {
[509]=true, --Bike
[481]=true, --BMX
[510]=true, --Mountain bike
[405]=true, --santiniel
[431]=true, --busik
[437]=true, --busiczek
[524]=true, --betonek
}
function odejmijPaliwo(pojazd)
if getTickCount() - czas > 150 then
czas = getTickCount()
local paliwo = getElementData(pojazd, "pojazd_paliwo") or 0
local vx,vy,vz = getElementVelocity(pojazd)
local spd = ((vx^2+vy^2+vz^2)^(0.5)/300)
if spd > 0 then
paliwo = paliwo-spd*2
setElementData(pojazd, "pojazd_paliwo", paliwo)
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
odejmijPaliwo(pojazd)
end)
function zgasSilnik()
for i,v in ipairs(getElementsByType("vehicle")) do
local data = getElementData(v, "pojazd_paliwo")
if data then
if tonumber(data) < 0 then
setVehicleEngineState(v, false)
end
end
end
end
setTimer(zgasSilnik, 1000, 999999999)
Sprawd? to
i To:
local czas = getTickCount()
isBike = {
[509]=true, --Bike
[481]=true, --BMX
[510]=true, --Mountain bike
[405]=true, --santiniel
[431]=true, --busik
[437]=true, --busiczek
[524]=true, --betonek
}
function odejmijPaliwo(pojazd)
if getTickCount() - czas > 150 then
czas = getTickCount()
local paliwo = getElementData(pojazd, "pojazd_paliwo") or 0
local vx,vy,vz = getElementVelocity(pojazd)
local spd = ((vx^2+vy^2+vz^2)^(0.5)/50)
if spd > 0 then
paliwo = paliwo-spd*2
setElementData(pojazd, "pojazd_paliwo", paliwo)
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
odejmijPaliwo(pojazd)
end)
function zgasSilnik()
for i,v in ipairs(getElementsByType("vehicle")) do
local data = getElementData(v, "pojazd_paliwo")
if data then
if tonumber(data) < 0 then
setVehicleEngineState(v, false)
end
end
end
end
setTimer(zgasSilnik, 1000, 999999999)
Nic to nie robi, nawet jak to na 9999999 ustawi?em to nic si? nie dzia?o xd
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