[Free][Release] Police K9 Script

It’s not ox-target by default its called ox_target. As per my previous reply I provided you the correct way to spell it in the config.

@angelicxs when I run the dog walks all the time. Isn’t there a place to edit this?
I would like it if when my cop runs, the dog runs too. When he walks, the dog walks well ^^
thx

yeah i have this problem also
when I run the dog walks all the time. Isn’t there a place to edit this?
I would like it if when my cop runs, the dog runs too. When he walks, the dog walks well ^^
thx

when i aiming at someone the dogs automatticly attack that person random

image

I just pushed V1.7 which should have the dog automatically swap between running and walking based on distance from the handler.

Unable to duplicate, dog does not seem to auto retaliate

You can only search players, that error occurs if you try to search a random ped.

so the update is already out of swapping on running and walking? my english is bad srry

@angelicxs the race is not good. The dog as soon as I take it out is next to me and when I start running it goes in the opposite direction from my character and doesn’t come back.

when I come towards him he goes in the opposite direction


de dogs runs automatticly in the v1.7 update idk if this is normal he runs auto away


i have the samen problem @angelicxs

I was unable to replicate your issue. This may be due to your MLO. Have you tried outside buildings?

we have the same problem me and @Aeroxul and we have different mlo

As per the previous comment try outside your MLO as I was unable to replicate your issues.

I’ve been using a good amount of your scripts and I love them. With this one, curious if it’s possible- and this may sound weird but…having the option to instead of using third eye on vehicles for the K9 to search, perhaps option to press E when standing at it?

I do not have any 3D text capability built into the K9 script so you would need the third eye to even get the dog out.

Regardless I thought I would do a thing so I wrote this; you can add it to the bottom of the client.lua results not guaranteed.

CreateThread(function()
	while true do
		Wait(5000)
		while DoesEntityExist(Dog) do
			local sleep = 1000
			local dist = nil 
			local dump = nil
			if Config.UseESX then
				dump, dist = ESX.Game.GetClosestVehicle()
			elseif Config.UseQBCore then
				dump, dist = QBCore.Functions.GetClosestVehicle()
			end
			if dist <= 10 then
				sleep = 500
				if dist <= 5 then
					local coord = GetEntityCoords(dump)
					DrawText3Ds(coords.x,coords.y,coords.z, "Press ~r~H~w~ to have dog search vehicle")
					if IsControlJustReleased(0,104) then
						TriggerEvent('angelicxs-k9script:searchingcar')
						sleep = 5000
					end
				end
			end
			Wait(sleep)
		end
	end
end)

function DrawText3Ds(x,y,z, text)
	local onScreen,_x,_y=World3dToScreen2d(x,y,z)
	local px,py,pz=table.unpack(GetGameplayCamCoords())
	SetTextScale(0.30, 0.30)
	SetTextFont(4)
	SetTextProportional(1)
	SetTextColour(255, 255, 255, 215)
	SetTextEntry('STRING')
	SetTextCentre(1)
	AddTextComponentString(text)
	DrawText(_x,_y)
	local factor = (string.len(text)) / 370
	DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 41, 11, 41, 68)
end
1 Like

ah but can u fix that inside the building it works also?

As noted before in my previous replies to you I am unable to replicate your issue. I also requested to have you check if you had the same issue outside of any buildings or in other MLOs. This is most likely an issue with the interaction between the MLO and my script and it is not something that will be fixed as my script is working as indicated in the images below.

As proof my scripts works both inside and outside buildings see the images below, in both cases I had the dog in the SIT command and moved away before utilizing the FOLLOW command. As demonstrated below the dog went to the player in both cases.

OUTSIDE


INSIDE

I really like it, some bugs by MLO’s inside the dog can’t follow. Maybe instering a chatcommand “teleport dog to me or in my car” as idea.

Thx :wink:

Why does all my traffic and peds disappear when i activate this script?