Make your K9 units and wildlife look natural in water.
This lightweight standalone script lets animal peds (like dogs) swim and float without drowning or ragdolling. Ideal for K9 RP or nature-themed servers!
Features
Detects if player is using an animal ped
Applies floating logic when in water
Restores health to avoid drowning
Disables ragdoll in water (re-enables on land)
Works automatically when player loads in
Fully client-side, no server performance impact
Supports QBCore but can be made for standalone or ESX with a quick edit
How It Works
When a player joins, the script checks if theyโre using an animal ped (GetPedType(ped) == 28).
If true, it applies gentle upward force while in water, prevents drowning, and disables ragdoll for a clean, natural animal swimming effect.
If you go to the readme page it tells you what event to change out you just need to change the qb core player loaded name to the one for esx player loaded.
I will make a push when I get home later and add a option at the top of the client to set qb or esx.
yes you just need to replace the event at the bottom I am not 100% sure how standalone is you need to have the animal ped skin loaded on the character before calling the script to check so im not sure which of these 2 options will work best test out both options and see which is best for you. If you need any help working on it further my discord is on the readme
AddEventHandler('playerSpawned', function()
print("^6Debug^7: ^2Loading ^3Animal Swim ^2module^7...")
Wait(3000)
if IsPlayerAnimal() then
HandleAnimalSwim()
else
print("^6Debug^7: ^2Player is ^1not ^2animal^7, ^2stopping ^3Animal Swim ^2module^7...")
end
end)
or
CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Wait(500)
end
print("^6Debug^7: ^2Loading ^3Animal Swim ^2module^7...")
Wait(3000)
if IsPlayerAnimal() then
HandleAnimalSwim()
else
print("^6Debug^7: ^2Player is ^1not ^2animal^7, ^2stopping ^3Animal Swim ^2module^7...")
end
end)
Is it just the one ped? If so could be something in the peds meta that it isnโt listed as ped type 28 which are animals it could have another identifier in that place.
Or
if itโs all animals it is a problem with the place that the script is checking for the ped. The player needs to have the ped skin already on there character when they spawn in.
Lastly
If itโs for one person try changing the wait timer longer I noticed with one player when they were on a bad connection the script wouldnโt detect them as a animal in time when they first loaded and they would drown
Hope that helps. Anymore questions discord is in the readme and I can help in more detail there.