local czas = getTickCount()
isBike = {
[509]=true, --Bike
[481]=true, --BMX
[510]=true, --Mountain bike
}
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)/150)
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)
Tutaj masz paliwo, teraz powinno dzialac.
Podpis
Jedyny kontakt ze mną to PW forum
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
--[[
@author Split <yourworld.pl>
@copyright 2011-2013 Split
Wszelkie prawa zastrze?one.
]]--
isBike = {[509]=true, [481]=true, [510]=true} -- rowery
addEvent("onChooseInteractionV1", true)
addEventHandler("onChooseInteractionV1", root, function()
local vehicle = getPedOccupiedVehicle(source)
if vehicle then
if isBike[getElementModel(vehicle)] then return end
if getElementData(vehicle, "pojazd_paliwo") == 0 then
outputChatBox("* Nie mo?na odpali? silnika, brak paliwa.", plr)
return
end
if getElementData(vehicle, "vehicle_mileage") == 10000 then
outputChatBox("* Nie mo?na odpali? silnika, zbyt du?y przebieg.", plr)
return
end
local engine = getVehicleEngineState(vehicle)
if engine == false then
setVehicleEngineState( vehicle, true)
outputChatBox("* Uruchomi?e? silnik.", source)
else
setVehicleEngineState( vehicle, false)
outputChatBox("* Zgasi?e? silnik.", source)
end
end
end)
addEvent("onChooseInteractionV2", true)
addEventHandler("onChooseInteractionV2", root, function()
local vehicle = getPedOccupiedVehicle(source)
if vehicle then
if isBike[getElementModel(vehicle)] then return end
if getVehicleOverrideLights(vehicle) ~= 2 then
setVehicleOverrideLights(vehicle, 2)
outputChatBox("* Zapali?e? ?wiat?a", source)
else
setVehicleOverrideLights(vehicle, 1)
outputChatBox("* Zgasi?e? ?wiat?a.", source)
end
end
end)
addEvent("onChooseInteractionV3", true)
addEventHandler("onChooseInteractionV3", root, function()
local vehicle = getPedOccupiedVehicle(source)
if vehicle then
if isBike[getElementModel(vehicle)] then return end
outputChatBox("* Zamykanie pojazdu w budowie", source)
end
end)
addEvent("onChooseInteractionV4", true)
addEventHandler("onChooseInteractionV4", root, function()
local vehicle = getPedOccupiedVehicle(source)
if vehicle then
--if not getElementData(vehicle, "pojazd_zrespiony") then return end
if isBike[getElementModel(vehicle)] then return end
local sx,sy,sz = getElementVelocity(vehicle)
local aspeed = (sx^2 + sy^2 + sz^2)^(0.5)
local kmh = aspeed * 180
if kmh < 2 then
if isElementFrozen(vehicle) then
setElementFrozen(vehicle, false)
outputChatBox("* Spu?ci?e? r?czny.", source)
else
setElementFrozen(vehicle, true)
outputChatBox("* Zaci?gn??e? r?czny.", source)
end
end
end
end)
To jest ten kod od interakcji, sprobuj.
Podpis
Jedyny kontakt ze mną to PW forum
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
function brakpaliwa()
veh = getPedOccupiedVehicle(localPlayer)
if veh and (not getElementData(veh,"pojazd_paliwo") == false ) and getElementData(veh,"pojazd_paliwo") <= 0 then
setElementData(veh,"pojazd_paliwo",0)
setVehicleEngineState(veh,false)
end
end
addEventHandler("onClientRender",root,brakpaliwa)
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