Jump to content

Help Script


Sr.black

Recommended Posts

Hi, can someone help me with the script? So that if a car falls into the sea, it will automatically destroy the vehicle after a minute has passed until the vehicles stuck in the water spawn again. I hope that there is a code that makes the boats not destroy because they are already spawned in the sea

 

 

Tnx

Link to comment

Not sure what's the right way to detect when the vehicle drowns - I've been thinking about isElementInWater, but I don't know what exactly that function does. Perhaps it returns true when the vehicle merely touches the water, which isn't enough to count as drowning. If that function doesn't work, then testLineAgainstWater should do the thing. You can check a line from vehicle's position to some point above or something like that. Use getVehicleType to check if the vehicle is a boat or getElementModel in case you want to exclude model IDs, because checking the vehicle type may not be accurate enough - for example, as far as I know, the game considers Vortex a plane (which allows you to control it while in the air). After detecting that a vehicle has drowned, you can make a timer to destroy the vehicle using setTimer and destroyElement.

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...