Jump to content

function isElementInWater bugged?


Koella

Recommended Posts

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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...