Lergen Posted October 3, 2019 Share Posted October 3, 2019 Hello. I've had a bit of trouble trying to figure out how to do something. I'm trying to make it so when a player enters water (swimming) it drains his health until he exits it. What's the best way to go about doing this? I've looked around but haven't been able to find any reference points for this. I'd greatly appreciate any help! Link to comment
alexaxel705 Posted October 3, 2019 Share Posted October 3, 2019 function checkwater() if(isPedDoingTask(localPlayer, "TASK_COMPLEX_IN_WATER")) then setElementHealth(localPlayer, getElementHealth(localPlayer)-0.5) end end addEventHandler("onClientPreRender", root, checkwater) in client 1 Link to comment
Lergen Posted October 3, 2019 Author Share Posted October 3, 2019 2 hours ago, alexaxel705 said: function checkwater() if(isPedDoingTask(localPlayer, "TASK_COMPLEX_IN_WATER")) then setElementHealth(localPlayer, getElementHealth(localPlayer)-0.5) end end addEventHandler("onClientPreRender", root, checkwater) in client That was exactly what I needed. Thank you. 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