[Release] AnchorBoat V1.3

how do we implement that into the code to work correctly…

Copy paste my little code somewhere clientsided and Will normally work

Very glitchy, put some more time into this and might convert it into esx and force all players to purchase an anchor before they’ll be able to use this.

I tried exactly that before, even with engine on/off and also both inside and outside the boat but it always kept moving…

Whenever you call it, does that have to be when you’re outside the boat? Or can the anchor be set when you’re still inside the boat and it will “properly anchor” as soon as you’re out of it?

Wondering what the “anchor” effect the yachts in gta:o use, where your boat drifts to the proper parking spot before it gets anchored.

well as soon as you get out your boat and you take last vehicle, then you set anchor true, well then boat will stay at it’s place (will move a bit like real anchor) but waves wont take your boat 10m further lol :slight_smile:

Were is the glitchy part? I will implement the code from @Jager_Bom later today and give him credits. I also thought making it into a vRP thing. If you are making the ESX thing just send me an PM

I think i just misunderstood how to handle the native. The first thing i used what that, but did not know how to trigger it. The engine seems to be the problem. I’ll implement your code and give you the needed credits :slight_smile:

2 Likes

no problem :slight_smile: we learn everyday! nobody is perfect i do have some questions too sometimes. sounds great if you andyou got it working yet ?

here i did make the code even better :slight_smile:

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

		Wait(0)
		local ped = GetPlayerPed(-1)
		if IsPedInAnyBoat(ped) then
			boat  = GetVehiclePedIsIn(ped, true)
		end
		if IsControlJustPressed(1, 182) and not IsPedInAnyVehicle(ped) and boat ~= nil  then
			if not anchored then
				SetBoatAnchor(boat, true)
				Notify("Boat is anchored")
			else
				SetBoatAnchor(boat, false)
				Notify("Boat is not anchored")
			end
			anchored = not anchored
		end
		if IsVehicleEngineOn(boat) then
			anchored = false
		end
	end
end)

function Notify(text)
    SetNotificationTextEntry('STRING')
    AddTextComponentString(text)
    DrawNotification(false, true)
end

Updated and changed the whole plan of the release.

VERSION 1.3 IS AVAILABLE NOW

Thx again to @Jager_Bom for the help

you need to remove line 27 client file from your github

Just a derp from me. New to this Github thing haha. Fixed it now :+1:

Love it, i would love to see more!

1 Like

UPDATED TO VERSION 1.3

  • Added an animation for when you anchor you boat. Find the update here:

I can’t get this to work would anyone be able to help me?

I downloaded both pNotify and this and followed the (limited) instructions perfectly and got no working result, except one time after some fiddling i got locked into the animation while on land.

  • extracted the original and named resource “anchorboat”, and tried “AnchorBoat”
  • tried deleting pNotify from anchorboat
  • tried using pNotify from anchorboat in replacement of original pNotify
  • tried having pNotify from anchorboat in the resource and in place of the original

I’m on an FX server, appreciate any help, thanks!

EDIT: So I just discovered that scrollwheel down triggers the animation and the notification but it only says “Boat Anchored!” not removed anchor or whatever it would be, and I can just drive the boat away once the animation finishes.
Also, using scrollwheel outside of a boat still works and does the same thing.

EDIT 2: After a bit of testing, I think the boat does stop moving once i drop the anchor, but i’m still able to drive it away, and using scrollwheel again doesn’t toggle it, just says “Boat Anchored!” again.

1 Like

You can use the “.” Or “l” look how to trigger it in the video

I tried virtually every key on the keyboard, only thing that worked was scrollwheel down.

Also, i’m not able to do it while sitting in the driver seat as you did in the video, and i’m not able to undo it accept by getting in the driver seat (maybe that is intended?)

If that is intended, then all I need to do is figure out why the keybinds are so off on my version, and why I can do it on land not even near a boat :confused:

The keybind is “.” look in the code at line 26

if IsControlJustPressed(1, 81)

Maybe you have og had switched your keys in GTA so it’s another else you can change the key to what you like.

Yup thats intended, you need to get off the driverseat before you can release the anchor.

You could just make a check if you are near any boat maybe. If i get any time maybe i could make that later today and update

Alright that clears things up,
Last thing I looked up a chart of keyboard event values to try to change those keybinds but…

https://css-tricks.com/snippets/javascript/javascript-keycodes/

but 86 is not “.” or “L” so i was a bit confused and didn’t want to change anything.
Is there a different list for GTA?

Here you go else you could also google it