[Release] AnchorBoat V1.3


#1

AnchorBoat

A little anchor script for your boat. Very simple :rp: release :see_no_evil:
Press “L” to throw the anchor, and press “L” to pull it up again.

Requirements

Instal
/Like any other resourse

  • Download the latest version from here.
  • Extract into it’s own folder (i.e. resources/AnchorBoat, can be wherever you like) Case sensitive btw.
  • Configure the server.cfg file
  • Start the server
Video

https://youtu.be/QTEgVzwq9yA

Version
  • 1.0 Everything works as intended
  • 1.1 Can’t throw anchor when you are in a submarine or on jetski
  • 1.2 Changed the plan. Now you don’t freeze the entity but using another more relastic native. Big Thanks to @Jager_Bom
To do
  • Can’t throw anchor when more than 10 units away from veh
  • Play an anchor look a like animation

Credits


#2

the button would be nice to know


#3

Oh well. Press U to throw the anchor, and press Y to pull it up again


#4

This could be a use full release…(some might say)



#5

Just a thought, you could try tossing in something like…

GetEntityHeightAboveGround(entity)

Then use something like…

if GetEntityHeightAboveGround(veh) > 10 then
pNotifyThing("You can't anchor mid air.")
end```

#6

Yeah but the problem with that one is. The “aboveground” is the seabottom, which is different from all around the ocean in GTA V. So sadly that does not work


#7

Alright so swap over and use GetEntityHeight, then just try to figure out what the trigger point could be during testing.


#8

Updated to version 1.01

  • Can’t throw anchor when you are in a submarine or on jetski

#9

What do you mean by that?


#10

mate please use correct natives instead of freezing an entity, here is the correct native:

SET_BOAT_ANCHOR #
// 0x75DBEC174AEEAD10 0xA3906284
// SetBoatAnchor
void SET_BOAT_ANCHOR(Vehicle vehicle, BOOL toggle);

and

IS_PED_IN_ANY_BOAT #
// 0x2E0E1C2B4F6CB339 0x1118A947
// IsPedInAnyBoat
BOOL IS_PED_IN_ANY_BOAT(Ped ped);

and

_GET_BOAT_ANCHOR #
// 0x26C10ECBDA5D043B 
// GetBoatAnchor
BOOL _GET_BOAT_ANCHOR(Vehicle vehicle);

#11

Are you sure those anchor natives work? They’ve never worked for me whenever i tried to keep a boat from moving…


#12

“Mate” I tried with these natives. If you can improve the script, feel free to do that instead :slight_smile: mate


#13

if you ask it nicely, i can do that here you go :stuck_out_tongue:

local anchored = false
Citizen.CreateThread(function()
	while true do

		Wait(0)
		local ped = GetPlayerPed(-1)
		if IsControlJustPressed(1, 182) and not IsPedInAnyVehicle(ped)  then
			local boat  = GetVehiclePedIsIn(ped, true)
			if not anchored then
				SetBoatAnchor(boat, true)
			else
				SetBoatAnchor(boat, false)
			end
			anchored = not anchored
		end
	end
end)

EDIT: 182 is “L” key


#14

ofc they do :slight_smile: see my code above :hugs:

tha anchor only works if you’re out of the boat / motor not running


#15

Just tested it. Does not seem to work at all.


#16

for me it does work, i did put it close to the boat for more then 15 min and did not move an inch lol (well did move but did not get away :stuck_out_tongue:


#17

Try to “park” it out in the open. Then it just fly away. It’s a week anchor with this native i think. Thats why i choose to freeze the entity instead


#18

you got discord ? i can show you live version :slight_smile:
i did try middle in the sea does stay on its place


#19

here i made little video, here you can see clearly when not anchored boat moves alot, when anchored not anymore, i did put text so you can see when i puch the L button
proof video anchor :slight_smile:


#20

Looks like an awesome resource, I love that you have 2 jobs, i want that in my server so bad