[FREE] [Standalone] K9 script with menu

Description :spiral_notepad: :

:wave: Hey guys, I’ve always wanted to Roleplay as a police officer with a K9, unfortunately, I never found THE script that has no bugs, and is easy to use and for free ! So I decided to make my own script, and here it is !

(note that some functions were inspired by other scripts, but I tried to make it as much as possible as standalone as possible)

Usage :hammer_and_wrench: :

To use the resource, download it, put the mth-K9 folder in your main resources folder.

Add start mth-K9 to your server.cfg

Then, once you’re in game, press O to toggle the menu.

Features :sparkles: :

  • STANDALONE : this means that you don’t need any dependencies to start this script on your server

  • Easy to use

  • Give your K9 a name

  • Multiple animations for your K9

  • Attack a target (you can choose between the K9 attacking the player in front of him, or the player you’re selecting)

  • The K9 can follow you, or stay in a specific place

  • The K9 can be called back to you

  • The K9 can be put in the car

  • The K9 can bark

Demo :eyes: :

Video

Link to the resource : mathu-lmn/mth-K9 (github.com)

Feel free to open an Issue or make a PR to help me improve this resource !

16 Likes

Great release, thanks!

woooow nice work man

1 Like

This is awesome! Is there any way I could put the K-9 in the rear left seat?

1 Like

Yes, you can change the line 375 and then instead of “seat_pside_r” you put “seat_pside_l”

V 1.0.1 released : fixed the K9 attacking the owner when he was shooting + fixed blips removing on dog death

I think the dogs animations may be too fast, you could also add entry and exit animations, for example, the dog is laying down sleeping, and when you stop that animation or click another animation, it plays an exit animation before cancelling or switching.

Here’s some that I used:

Small dog getting up from sitting down (pug, poodle, etc)

creatures@pug@amb@world_dog_sitting@exit,

 exit

Duration = 1000

This you can use for all big dogs (rottweiler, shepherd, etc)

creatures@rottweiler@amb@world_dog_sitting@exit

exit

Duration = 1000

And you can use this one for the big dog breeds waking up from sleeping

creatures@rottweiler@amb@sleep_in_kennel@

exit_kennel

 Duration = 5000

Maybe set a blend in and out speeds of about 2.0 or 3.0 :thinking: Hope this helps :slightly_smiling_face:

1 Like

Thanks for the advices, I’ll use this to make something probably !

Can you add a job and jobgrade restriction to open the menu? That would be nice to add this menu to a police menu. Would it also be possible to make a version with ox_lib context menu? There are a lot of people who use this.

For the job check, you can easily add a check around line 190 to check the player’s job / duty !
I never really worked with ox_lib context menu but I’ll take a look, if you manage to do it, feel free to add a pull request

Unfortunately I can’t script but i develop a server based on ox_lib. This script has a lot of potential and since many people use ox_lib I thought it would be awesome and fit the serverstyle of many people. However, it is your script and I think you could get a lot more out of this script and possibly charge money for it.

Here’s an example we did with RPEmotes :slightly_smiling_face:

2 Likes

Thank you, but now he seems to be sitting in between the two front seats?

Well the script attaches the dog entity to the “seat_pside_r” bone so just check where he is

This is nice, thank you for this! and I have a question, Can only PD workers open the menu? :o

Alright, I’ll try and figure it out. Thanks!

For the job check, you can easily add a check around line 190 to check the player’s job / duty !

Great script.
I have one question:
What code should be added on line 190 for job check?

depends on your framework :
You should have an export that either gets the player job or that checks if the player is a cop :
Let’s say your export exports.core:checkCop() returns true when the player is a cop then the code will be something like :

Keys.Register('O', 'O', 'Menu K9', function()
    if exports.core:checkCop() then
        openK9Menu()
    else
        ShowNotification("You are not a cop!")
    end
end)
1 Like

Awesome I’ll try that
Thank you very much

2 Likes