eqFoxim Posted September 18, 2021 Share Posted September 18, 2021 addEventHandler("onClientPlayerVehicleEnter", getRootElement(), function(vehicle, seat) setVehicleGhost(vehicle, hasDriverGhost(vehicle)) end ) addEventHandler("onClientVehicleExit", getRootElement(), function(vehicle, seat) setVehicleGhost(vehicle, hasDriverGhost(vehicle)) end ) function onStreamIn() if getElementType(source) ~= "vehicle" then return end setVehicleGhost(source, hasDriverGhost(source)) end addEventHandler("onClientElementStreamIn", root, onStreamIn) function setVehicleGhost(target, value) for _,vehicle in ipairs(getElementsByType("vehicle")) do local vehicleGhost = hasDriverGhost(vehicle) if isElement(target) and isElement(vehicle) then setElementCollidableWith(target, vehicle, not value) setElementCollidableWith(vehicle, target, not value) end if value == false and vehicleGhost == true and isElement(target) and isElement(vehicle) then setElementCollidableWith(target, vehicle, not vehicleGhost) setElementCollidableWith(vehicle, target, not vehicleGhost) end end for _,player in ipairs(getElementsByType("player")) do if isElement(target) and isElement(player) then setElementCollidableWith(target, player, not value) setElementCollidableWith(player, target, not value) end end end function hasDriverGhost(vehicle) if not isElement(vehicle) then return end if getElementType(vehicle) ~= "vehicle" then return end local driver = getVehicleController(vehicle) if ( driver ) then if ( getElementData(driver, "Foxim.ModoJogoPassivo") ) then return true end end return false end Estou Fazendo um sistema de passivo e ativo, quando ele esta no passivo, se o player entrar em um veiculo ele não ira colidir com outros veiculos ate aqui tudo certo O PROBLEMA é que quando um player entra e sai de um veiculo aleatorio este veiculo recebe sua colisão novamente, assim o player passivo ira colidir com este veiculo em veiculos que o player não entrou e saiu, esta funcionando normalmente. Link to comment
Other Languages Moderators androksi Posted September 19, 2021 Other Languages Moderators Share Posted September 19, 2021 Olá! Altere este evento onClientVehicleExit para onClientPlayerVehicleExit. Pois eles têm diferença. E também, é o que você tá usando no outro, com o player sendo o source, e o veículo como parâmetro. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now