Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function pojazdPusty(veh)
- -- local occupants = getVehicleOccupants(veh)
- -- local seats = getVehicleMaxPassengers(veh)
- -- if (not seats) then return true end
- -- for i=0,seats do
- -- local occupant = occupants[i]
- -- if occupant and (getElementType(occupant)=="player" or getElementType(occupant)=="ped") then
- -- return false
- -- end
- -- end
- -- return true
- local occupant=getVehicleOccupant(veh, 0)
- if occupant and isElement(occupant) then
- if (getElementType(occupant)=="player") then
- return false
- end
- end
- return true
- end
- setTimer(function()
- for i,v in ipairs(getElementsByType("vehicle")) do
- --if getElementData(v, "dbid") then -- jeżeli ma działać tylko na pojazdy prywatne to
- if (pojazdPusty(v)) then
- setVehicleDamageProof(v,true)
- else
- if not getElementData(v,"pojazdy:zniszczonyWrak") then setVehicleDamageProof(v,false) end
- end
- --end
- end
- end, 1000, 1)
- addEventHandler ( "onVehicleEnter", root, function(plr,seat)
- if seat~=0 then
- return
- end
- if not getElementData(source,"pojazdy:zniszczonyWrak") then setVehicleDamageProof(source, false) end
- end)
- addEventHandler ( "onVehicleExit", root, function(plr,seat)
- if seat~=0 then
- return
- end
- -- if (pojazdPusty(source)) then
- if source and isElement(source) then
- if (not getVehicleController(source)) then
- setVehicleDamageProof(source, true)
- setVehicleOverrideLights(source, 1)
- else
- if getElementData(source,"pojazdy:zniszczonyWrak") then return end
- setVehicleDamageProof(source, false)
- end
- end
- end)
- addEventHandler("onPlayerQuit", root,
- function()
- local veh=getPedOccupiedVehicle(source)
- if not veh then
- return
- end
- if getElementData(veh,"dbid") then
- if (getPedOccupiedVehicleSeat(source)==0) then
- setVehicleDamageProof(veh, true)
- setVehicleEngineState(veh, false)
- setElementFrozen(veh, true)
- end
- end
- end
- )
Add Comment
Please, Sign In to add comment