Hello everyone
I am trying to make a global timer that checks every vehicle on the server every 10 seconds and despawns every vehicle that is in water and not a boat.
I have a little problem with this part of the code:
if isElementInWater(vehicle) then
outputChatBox("you shouldn't despawn!")
if checkBoat == false then
destroyElement(vehicle)
end
else
outputChatBox("much better")
end
My problem is, that, while I am sitting in the vehicle, I get the message "much better" every 10 seconds. BUT, if I stand outside of the vehicle (no player is in it anymore!), the message "you shouldn't despawn" appears when the timer triggers and the vehicle despawns (the vehicle is still on the street, not in water !)
It doesn't make any sense to me why the outcome of "isElementInWater" would change if there's a player in the car or not.
I can only explain it to myself by saying that the function itself is bugged.
Thanks in advance for the help,
Koella