Git Product home page Git Product logo

keep-companion's Introduction

keep-companion

  • qbcore pet script

Features

  • XP and leveling system
  • Food system
  • thirst sytem
  • Health system (heal and revive)
  • Auto naming (At first usage) & Renaming
  • pet variation
  • Control pet's actions
  • Pet shop
  • Pet animation
  • ...

WIP status:

  • Pls, note this project is a work in progress.

Usage

  • open the menu with "o"
  • menu keybind can be customized inside settings and Fivem keybinds

Previews

shop petshop tooltip spawn menu commands pets

installation

  • The installation may seem a bit longer than it should be, but it's just a lot of text

step 1: Dependencies

step 2: add items

-- Add this code at end of qb-core\shared\items.lua

    -- ================ Keep-companion ================
    ["keepcompanionhusky"] = {
        ["name"] = "keepcompanionhusky",
        ["label"] = "Husky",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Husky.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Husky is your royal companion!"
    },
    ["keepcompanionpoodle"] = {
        ["name"] = "keepcompanionpoodle",
        ["label"] = "Poodle",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Poodle.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Poodle is your royal companion!"
    },
    ["keepcompanionrottweiler"] = {
        ["name"] = "keepcompanionrottweiler",
        ["label"] = "Rottweiler",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_Rottweiler.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Rottweiler is your royal companion!"
    },
    ["keepcompanionwesty"] = {
        ["name"] = "keepcompanionwesty",
        ["label"] = "Westy",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Westy.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Westy is your royal companion!"
    },
    ["keepcompanionmtlion"] = {
        ["name"] = "keepcompanionmtlion",
        ["label"] = "MtLion",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_MtLion.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "MtLion is your royal companion!"
    },
    ["keepcompanionmtlion2"] = {
        ["name"] = "keepcompanionmtlion2",
        ["label"] = "Panter",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_MtLion.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Panter is your royal companion!"
    },
    ["keepcompanioncat"] = {
        ["name"] = "keepcompanioncat",
        ["label"] = "Cat",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Cat_01.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Cat is your royal companion!"
    },
    ["keepcompanionpug"] = {
        ["name"] = "keepcompanionpug",
        ["label"] = "Pug",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Pug.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Pug is your royal companion!"
    },
    ["keepcompanionretriever"] = {
        ["name"] = "keepcompanionretriever",
        ["label"] = "Retriever",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Retriever.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Retriever is your royal companion!"
    },
    ["keepcompanionshepherd"] = {
        ["name"] = "keepcompanionshepherd",
        ["label"] = "Shepherd",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_shepherd.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Shepherd is your royal companion!"
    },
    -- new pets
    ["keepcompanioncoyote"]     = {
		["name"] = "keepcompanioncoyote",
		["label"] = "Coyote",
		["weight"] = 500,
		["type"] = "item",
		["image"] = "A_C_Coyote.png",
		["unique"] = true,
		["useable"] = true,
		["shouldClose"] = true,
		["combinable"] = nil,
		["description"] = "Coyote is your royal companion!"
	},
	["keepcompanionrabbit"]     = {
		["name"] = "keepcompanionrabbit",
		["label"] = "Rabbit",
		["weight"] = 500,
		["type"] = "item",
		["image"] = "A_C_Rabbit_01.png",
		["unique"] = true,
		["useable"] = true,
		["shouldClose"] = true,
		["combinable"] = nil,
		["description"] = "Rabbit is your royal companion!"
	},
	["keepcompanionhen"]        = {
		["name"] = "keepcompanionhen",
		["label"] = "Hen",
		["weight"] = 500,
		["type"] = "item",
		["image"] = "A_C_Hen.png",
		["unique"] = true,
		["useable"] = true,
		["shouldClose"] = true,
		["combinable"] = nil,
		["description"] = "Hen is your royal companion!"
	},
    ["keepcompanionrat"] = {
        ["name"] = "keepcompanionrat",
        ["label"] = "Rat",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "A_C_Rat.png",
        ["unique"] = true,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Your royal companion!"
    },
    ---
    ["petfood"] = {
        ["name"] = "petfood",
        ["label"] = "pet food",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "petfood.png",
        ["unique"] = false,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "food for your companion!"
    },
    ["collarpet"] = {
        ["name"] = "collarpet",
        ["label"] = "Pet collar",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "collarpet.png",
        ["unique"] = false,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = true,
        ["description"] = "Rename your pets!"
    },
    ["firstaidforpet"] = {
        ["name"] = "firstaidforpet",
        ["label"] = "First aid for pet",
        ["weight"] = 500,
        ["type"] = "item",
        ["image"] = "firstaidforpet.png",
        ["unique"] = false,
        ["useable"] = true,
        ["shouldClose"] = true,
        ["combinable"] = nil,
        ["description"] = "Revive your pet!"
    },
	["petnametag"]              = {
		["name"] = "petnametag",
		["label"] = "Name tag",
		["weight"] = 500,
		["type"] = "item",
		["image"] = "petnametag.png",
		["unique"] = false,
		["useable"] = true,
		["shouldClose"] = true,
		["combinable"] = nil,
		["description"] = "Rename your pet"
	},
    ["petwaterbottleportable"]  = {
		["name"] = "petwaterbottleportable",
		["label"] = "Portable water bottle",
		["weight"] = 1000,
		["type"] = "item",
		["image"] = "petwaterbottleportable.png",
		["unique"] = true,
		["useable"] = true,
		["shouldClose"] = true,
		["combinable"] = nil,
		["description"] = "Flask to store water for your pets"
	},
    ["petgroomingkit"]  = {
		["name"] = "petgroomingkit",
		["label"] = "Pet Grooming Kit",
		["weight"] = 1000,
		["type"] = "item",
		["image"] = "petgroomingkit.png",
		["unique"] = true,
		["useable"] = true,
		["shouldClose"] = true,
		["combinable"] = nil,
		["description"] = "Pet Grooming Kit"
	},

step 3: qb-shop

  • Here is tables qb-shops/config.lua
-- add it at end of Config.Products table
    ["petshop"] = {
        [1] = {
            name = 'keepcompanionwesty',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 1
        },
        [2] = {
            name = 'keepcompanionshepherd',
            price = 150000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 2
        },
        [3] = {
            name = 'keepcompanionretriever',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 3
        },
        [4] = {
            name = 'keepcompanionrottweiler',
            price = 75000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 4
        },
        [5] = {
            name = 'keepcompanionpug',
            price = 95000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 5
        },
        [6] = {
            name = 'keepcompanionpoodle',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 6
        },

        [7] = {
            name = 'keepcompanionmtlion2',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 7
        },
        [8] = {
            name = 'keepcompanioncat',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 8
        },
        [9] = {
            name = 'keepcompanionmtlion',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 9
        },
        [10] = {
            name = 'keepcompanionhusky',
            price = 50000,
            amount = 5,
            info = {},
            type = 'item',
            slot = 10
        },
        [11] = {
            name = 'petfood',
            price = 500,
            amount = 1000,
            info = {},
            type = 'item',
            slot = 11
        },
        [12] = {
            name = 'collarpet',
            price = 50000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 12
        },
        [13] = {
            name = 'firstaidforpet',
            price = 5000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 13
        },
        [14] = {
            name = 'petnametag',
            price = 5000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 14
        },
        [15] = {
            name = 'petwaterbottleportable',
            price = 5000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 15
        },
        [16] = {
            name = 'petgroomingkit',
            price = 5000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 16
        },
        [17] = {
            name = 'keepcompanionrabbit',
            price = 15000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 17
        },
        [18] = {
            name = 'keepcompanionhen',
            price = 5000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 18
        },
        [19] = {
            name = 'keepcompanioncoyote',
            price = 50000,
            amount = 50,
            info = {},
            type = 'item',
            slot = 19
        },
    }
-- add it at end of Config.Locations table
    ["petshop"] = {
        ["label"] = "Pet Shop",
        ["coords"] = vector4(561.18, 2741.51, 42.87, 199.08), --or vector4(-659.87, -936.46, 21.83, 130.04), --  for mlo https://www.gta5-mods.com/maps/
        ["ped"] = 'S_M_M_StrVend_01',
        ["scenario"] = "WORLD_HUMAN_COP_IDLES",
        ["radius"] = 1.5,
        ["targetIcon"] = "fas fa-paw",
        ["targetLabel"] = "Open Pet Shop",
        ["products"] = Config.Products["petshop"],
        ["showblip"] = true,
        ["blipsprite"] = 267,
        ["blipcolor"] = 5
    },

step 4: tooltip

  • i'm using lj-inventory just find where tooltip codes are!
  • in inventory\js\app.js find FormatItemInfo() there is if statement like: if (itemData.name == "id_card")
  • track where all of elseif statments ends then add else if below at there
else if (
    itemData.name == "keepcompanionhusky" ||
    itemData.name == "keepcompanionrottweiler" ||
    itemData.name == "keepcompanionmtlion" ||
    itemData.name == "keepcompanionmtlion2" ||
    itemData.name == "keepcompanioncat" ||
    itemData.name == "keepcompanionpoodle" ||
    itemData.name == "keepcompanionpug" ||
    itemData.name == "keepcompanionretriever" ||
    itemData.name == "keepcompanionshepherd" ||
    itemData.name == "keepcompanionwesty" ||
    itemData.name == "keepcompanioncoyote" ||
    itemData.name == "keepcompanionrabbit" ||
    itemData.name == "keepcompanionhen"
) {
    let gender = itemData.info.gender;
    gender ? (gender = "male") : (gender = "female");
    $(".item-info-title").html("<p>" + itemData.info.name + "</p>");
    $(".item-info-description").html(
        "<p><strong>Owner Phone: </strong><span>" +
        itemData.info.owner.phone +
        "</span></p><p><strong>Variation: </strong><span>" +
        `${itemData.info.variation}` +
        "</span></p><p><strong>Gender: </strong><span>" +
        `${gender}` +
        "</span></p><p><strong>Health: </strong><span>" +
        itemData.info.health +
        "</span></p><p><strong>Xp/Max: </strong><span>" +
        `${itemData.info.XP} / ${maxExp(itemData.info.level)}` +
        "</span></p><p><strong>Level: </strong><span>" +
        itemData.info.level +
        "</span></p><p><strong>Age: </strong><span>" +
        callAge(itemData.info.age) +
        "</span></p><p><strong>Food: </strong><span>" +
        itemData.info.food +
        "</span></p>" +
        "</span></p><p><strong>Thirst: </strong><span>" +
        itemData.info.thirst +
        "</span></p>"
    );
}
else if (itemData.name == "petwaterbottleportable") {
    $(".item-info-title").html("<p>" + itemData.label + "</p>");
    $(".item-info-description").html("<p>capacity(L): " + itemData.info.liter + "</p>");
}
  • and add this codes at end of inventory\js\app.js
function callAge(age) {
  let max = 0;
  let min = 0;
  if (age === 0) {
    return 0;
  }
  for (let index = 1; index < 10; index++) {
    max = 60 * 60 * 24 * index;
    min = 60 * 60 * 24 * (index - 1);
    if (age >= min && age <= max) {
      return index - 1;
    }
  }
}

function maxExp(level) {
  let xp = Math.floor(
    (1 / 4) * Math.floor((level + 300) * Math.pow(2, level / 7))
  );
  return xp;
}

function currentLvlExp(xp) {
  let maxExp = 0;
  let minExp = 0;

  for (let index = 0; index <= 50; index++) {
    maxExp = Math.floor(Math.floor((i + 300) * (2 ^ (i / 7))) / 4);
    minExp = Math.floor(Math.floor((i - 1 + 300) * (2 ^ ((i - 1) / 7))) / 4);
    if (xp >= minExp && xp <= maxExp) {
      return i;
    }
  }
}

#K9

  • important steps for k9 to work
  • first open you inventory script qb-inventory/server/main.lua
  • find this event
RegisterNetEvent('inventory:server:SetIsOpenState')
  • add code below after or before this event (not inside it!) shop

  • then go to script confing file find Config.inventory_name and change it to your inventory's name

keep-companion's People

Contributors

subhampro avatar swkeep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keep-companion's Issues

Cow companion

i was wondering if you could add a rideable cow companion it would be really cool and i know i would love to have one

medkit doest work

hello i really love youre script thhanks a lot !! i need some help when i use medkit it doesnt work with no errors need some explanations pleas

Menu and Shop

Shop hasn't all Pets (Lions not there)

When I press "O" first time it will show the cursor then i must press and hold again and the menu will show... maybe it possible to use the normal QB-radialmenu to fix this error

Sorry for my bad english. =)

pets
.

app.js error

It seems i cannot see or look where to post the step 4 stuff

Iam just using qb-inventory
so i went to qb-inventory/html/js/app.js

open the file and it confused me what line where to add i tried all stuff but i end up with errors
see attachment the app.js file

hope you guys can help me out with
to add the code and post the app.js back

flip car don't work

i see in the c_util you have a clip car, but it dont work lots of errors.

fli

add this
local QBCore = exports['qb-core']:GetCoreObject()

change
CoreName.Functions.Progressbar("flipingcAr", "Fliping car", Config.Settings.carFlipingDuration * 1000,
to
QBCore.Functions.Progressbar("flipingcAr", "Fliping car", Config.Settings.carFlipingDuration * 1000,

error in js

anyone have lj-inventory script with all texted or

Water Bottle

I get this error when trying to give water


[script:keep-companio] SCRIPT ERROR: @keep-companion/server/server.lua:335: attempt to index a nil value (local 'pet_water_bottle')
[script:keep-companio] > TriggerCallback (@qb-core/server/functions.lua:250)
[script:keep-companio] > handler (@qb-core/server/events.lua:142)
[script:qb-core] SCRIPT ERROR: error object is not a string

[Request]

This is amazing! It be cool to add a VIP :)
Let selected players to purchase a pet

Waterbottle

hey hey,

i saw the fix for the waterbottles after i fixed it myself, and i think it might be a better fix because it keeps the initial washing of the bottle

i changed line 265
from: if type(item.info) == "table" then
to: if (item.info.liter ~= nil) then

maybe that helps?

AJ inventory

Can you help me make it work on aj inventory? i found the apps.js file but it keeps breaking inventory when i attempt to add code.

Problems ins de app.js

image

Boa tarde,

Instalei todo o script como indicado no README.
Contudo, este erro surge no app.js e não entendo porque. Abaixo segue o código.

function FormatItemInfo(itemData, dom) {

let element = $('.ply-iteminfo-container');
let itemOffset = $(dom).offset();
element.css('top', itemOffset.top - element.height());
let leftOffset = itemOffset.left + 92;
if (leftOffset + element.width() > $(window).width()) {
    leftOffset = $(window).width() - element.width() - 20;
}
element.css('left', leftOffset);

if (itemData != null && itemData.info != "") {
    if (itemData.name == "id_card") {
        var gender = "Man";
        if (itemData.info.gender == 1) {
            gender = "Woman";
        }
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            '<p><strong>CSN: </strong><span>' + 
            itemData.info.citizenid + 
            '</span></p><p><strong>First Name: </strong><span>' + 
            itemData.info.firstname + 
            '</span></p><p><strong>Last Name: </strong><span>' + 
            itemData.info.lastname + 
            '</span></p><p><strong>Birth Date: </strong><span>' + 
            itemData.info.birthdate + 
            '</span></p><p><strong>Gender: </strong><span>' + 
            gender + 
            '</span></p><p><strong>Nationality: </strong><span>' + 
            itemData.info.nationality + 
            '</span></p>' + '</span></p><p><strong>Fingerprint: </strong><span>' + 
            itemData.info.fingerprint + '</span></p>'
        );
    } else if (itemData.name == "driver_license") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            "<p><strong>First Name: </strong><span>" +
            itemData.info.firstname +
            "</span></p><p><strong>Last Name: </strong><span>" +
            itemData.info.lastname +
            "</span></p><p><strong>Birth Date: </strong><span>" +
            itemData.info.birthdate +
            "</span></p><p><strong>Licenses: </strong><span>" +
            itemData.info.type +
            "</span></p>"
        );
    } else if (itemData.name == "weaponlicense") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            "<p><strong>First Name: </strong><span>" +
            itemData.info.firstname +
            "</span></p><p><strong>Last Name: </strong><span>" +
            itemData.info.lastname +
            "</span></p><p><strong>Birth Date: </strong><span>" +
            itemData.info.birthdate +
            "</span></p>"
        );
    } else if (itemData.name == "lawyerpass") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            "<p><strong>Pass-ID: </strong><span>" +
            itemData.info.id +
            "</span></p><p><strong>First Name: </strong><span>" +
            itemData.info.firstname +
            "</span></p><p><strong>Last Name: </strong><span>" +
            itemData.info.lastname +
            "</span></p><p><strong>CSN: </strong><span>" +
            itemData.info.citizenid +
            "</span></p>"
        );
        else if (
            itemData.name == "keepcompanionhusky" ||
            itemData.name == "keepcompanionrottweiler" ||
            itemData.name == "keepcompanionmtlion" ||
            itemData.name == "keepcompanionmtlion2" ||
            itemData.name == "keepcompanioncat" ||
            itemData.name == "keepcompanionpoodle" ||
            itemData.name == "keepcompanionpug" ||
            itemData.name == "keepcompanionretriever" ||
            itemData.name == "keepcompanionshepherd" ||
            itemData.name == "keepcompanionwesty"
        ) {
            let gender = itemData.info.gender;
            gender ? (gender = "male") : (gender = "female");
            $(".item-info-title").html("<p>" + itemData.info.name + "</p>");
            $(".item-info-description").html(
                "<p><strong>Owner Phone: </strong><span>" +
                itemData.info.owner.phone +
                "</span></p><p><strong>Variation: </strong><span>" +
                `${itemData.info.variation}` +
                "</span></p><p><strong>Gender: </strong><span>" +
                `${gender}` +
                "</span></p><p><strong>Health: </strong><span>" +
                itemData.info.health +
                "</span></p><p><strong>Xp/Max: </strong><span>" +
                `${itemData.info.XP} / ${maxExp(itemData.info.level)}` +
                "</span></p><p><strong>Level: </strong><span>" +
                itemData.info.level +
                "</span></p><p><strong>Age: </strong><span>" +
                callAge(itemData.info.age) +
                "</span></p><p><strong>Food: </strong><span>" +
                itemData.info.food +
                "</span></p>" +
                "</span></p><p><strong>Thirst: </strong><span>" +
                itemData.info.thirst +
                "</span></p>"
            );
        }
        else if (itemData.name == "petwaterbottleportable") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html("<p>capacity(L): " + itemData.info.liter + "</p>");
        }
    } else if (itemData.name == "harness") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            "<p>" + itemData.info.uses + " uses left.</p>"
        );
    } else if (itemData.type == "weapon") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        if (itemData.info.ammo == undefined) {
            itemData.info.ammo = 0;
        } else {
            itemData.info.ammo != null ? itemData.info.ammo : 0;
        }
        if (itemData.info.attachments != null) {
            var attachmentString = "";
            $.each(itemData.info.attachments, function(i, attachment) {
                if (i == itemData.info.attachments.length - 1) {
                    attachmentString += attachment.label;
                } else {
                    attachmentString += attachment.label + ", ";
                }
            });
            $(".item-info-description").html(
                "<p><strong>Serial: </strong><span>" +
                itemData.info.serie +
                "</span></p><p><strong>Ammo: </strong><span>" +
                itemData.info.ammo +
                "</span></p><p><strong>Attachments: </strong><span>" +
                attachmentString +
                "</span></p>"
            );
        } else {
            $(".item-info-description").html(
                "<p><strong>Serial: </strong><span>" +
                itemData.info.serie +
                "</span></p><p><strong>Ammo: </strong><span>" +
                itemData.info.ammo +
                "</span></p><p>" +
                itemData.description +
                "</p>"
            );
        }
    } else if (itemData.name == "filled_evidence_bag") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        if (itemData.info.type == "casing") {
            $(".item-info-description").html(
                "<p><strong>Evidence material: </strong><span>" +
                itemData.info.label +
                "</span></p><p><strong>Type number: </strong><span>" +
                itemData.info.ammotype +
                "</span></p><p><strong>Caliber: </strong><span>" +
                itemData.info.ammolabel +
                "</span></p><p><strong>Serial: </strong><span>" +
                itemData.info.serie +
                "</span></p><p><strong>Crime scene: </strong><span>" +
                itemData.info.street +
                "</span></p><br /><p>" +
                itemData.description +
                "</p>"
            );                
        } else if (itemData.info.type == "blood") {
            $(".item-info-description").html(
                "<p><strong>Evidence material: </strong><span>" +
                itemData.info.label +
                "</span></p><p><strong>Blood type: </strong><span>" +
                itemData.info.bloodtype +
                "</span></p><p><strong>DNA Code: </strong><span>" +
                itemData.info.dnalabel +
                "</span></p><p><strong>Crime scene: </strong><span>" +
                itemData.info.street +
                "</span></p><br /><p>" +
                itemData.description +
                "</p>"
            );
        } else if (itemData.info.type == "fingerprint") {
            $(".item-info-description").html(
                "<p><strong>Evidence material: </strong><span>" +
                itemData.info.label +
                "</span></p><p><strong>Fingerprint: </strong><span>" +
                itemData.info.fingerprint +
                "</span></p><p><strong>Crime Scene: </strong><span>" +
                itemData.info.street +
                "</span></p><br /><p>" +
                itemData.description +
                "</p>"
            );
        } else if (itemData.info.type == "dna") {
            $(".item-info-description").html(
                "<p><strong>Evidence material: </strong><span>" +
                itemData.info.label +
                "</span></p><p><strong>DNA Code: </strong><span>" +
                itemData.info.dnalabel +
                "</span></p><br /><p>" +
                itemData.description +
                "</p>"
            );
        }
    } else if (
        itemData.info.costs != undefined &&
        itemData.info.costs != null
    ) {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html("<p>" + itemData.info.costs + "</p>");
    } else if (itemData.name == "stickynote") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html("<p>" + itemData.info.label + "</p>");
    } else if (itemData.name == "moneybag") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            "<p><strong>Amount of cash: </strong><span>$" +
            itemData.info.cash +
            "</span></p>"
        );
    } else if (itemData.name == "markedbills") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html(
            "<p><strong>Worth: </strong><span>$" +
            itemData.info.worth +
            "</span></p>"
        );
    } else if (itemData.name == "visa" || itemData.name == "mastercard") {
        $(".item-info-title").html('<p>'+itemData.label+'</p>')
        var str = ""+ itemData.info.cardNumber + "";
        var res = str.slice(12);
        var cardNumber = "************" + res;
        $(".item-info-description").html('<p><strong>Card Holder: </strong><span>' + itemData.info.name + '</span></p><p><strong>Citizen ID: </strong><span>' + itemData.info.citizenid + '</span></p><p><strong>Card Number: </strong><span>' + cardNumber + '</span></p>');
    } else if (itemData.name == "labkey") {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html("<p>Lab: " + itemData.info.lab + "</p>");
    } else {
        $(".item-info-title").html("<p>" + itemData.label + "</p>");
        $(".item-info-description").html("<p>" + itemData.description + "</p>");
    }
} else {
    $(".item-info-title").html("<p>" + itemData.label + "</p>");
    $(".item-info-description").html("<p>" + itemData.description + "</p>");
};

}

Bug or should be?

So, script works fine, thanks, but..

Doing nothing, the animal levels seem to update by one every minute. Is that how it should be?
I looked at the code and didn't see any update timer other than the mathematical formulas.

liter error

[script:keep-companio] SCRIPT ERROR: @keep-companion/server/server.lua:266: attempt to compare number with nil
[script:keep-companio] SCRIPT ERROR: @keep-companion/server/server.lua:266: attempt to compare number with nil
    if type(item.info) == "table" then
        if item.info.liter > max_c then
            TriggerClientEvent('QBCore:Notify', source, 'could not do that already reached max capacity', 'error', 2500)
            return
        elseif item.info.liter == max_c then
            amount = max_c

new pets

Is there a way to add new pets ?

Rat interactions

Hi,
It's so awesome that you actually added rats to this! Thank you!

i had one request b/c it seems the rat is unable to hunt, search and do tricks...I've seen it done on a server once, but someone had a rat that would crawl on them. If you would be able to incorporate that, it would make the rat more enjoyable. He seems to get lost a bunch and has environmental issues. Like being stuck on outside of a curb.

I really want to be able to attack with my rat, but would be overly grateful if you could make it crawl on you somehow. On shoulder or moving around on shoulders. thanks a bunch!

pet shop seller & other changes

this is the qb-shop update, also you are missing the pets images, to put in the inventory.
when the pet levels up, you need to put a gap between name and level. as it says namelevel

when you type /renamepet there is two commands that come up /renamePet and /renamepet

in the qb-shop you have two keepcompanionretriever i guess one should be keepcompanionrottweiler
also in qb-shop you have Lion 3 times when there is only 2, so 9 not 10
as the lions don't show up, even on your preview you might want to pick something from
https://docs.fivem.net/docs/game-references/ped-models/#animals

maybe a kitty:)
PS just noticed you updated some stuff, mine was a older copy.

    ["petShop"] = {
        ["label"] = "Pet Shop",
        ["coords"] = vector4(-3225.63, 928.89, 13.9, 297.06),
        ["ped"] = 'S_M_M_StrVend_01',
        ["scenario"] = "WORLD_HUMAN_STAND_MOBILE",
        ["radius"] = 1.5,
        ["targetIcon"] = "far fa-comment",
        ["targetLabel"] = "Open Shop",
        ["products"] = Config.Products["petShop"],
        ["showblip"] = true,
        ["blipsprite"] = 267,
        ["colour"] = 5
    },

keep up the great work looking forward to updates.

Error

[script:keep-companio] SCRIPT ERROR: @keep-companion/server/functions.lua:94: attempt to index a string value (field 'info')

Pet renaming

Maybe you can put /renamePet on a collar item, would be cooler than by command

Petfood

The pet food doesn't go away when used.

important steps for K9 error

Skærmbillede 2022-09-14 001029
Skærmbillede 2022-09-14 001011

error is coming after i added

exports('getTruck', function(id)
return Trunks[id]
)

exports('getGloveboxes', function(id)
return Gloveboxes[id]
)

Items

Medikit are not removed by healing.
Collarpet not function.

help this mod locks server

i added this mod yesterday i followed the intructions and added everything like it was said to in read me.. i added them at end else if statements and then at end of the file like it said .. i have feeling mayb i didnt put them in correct spot . but when i go the shop i can target it and open the shop , but once it opens it takes about 5 seconds then the server like freezes, i can still move mouse but nothing else works i have to pull up task manager to force quit fivem, is there any way u can help me get this working ive tred 2 other pet mods with no avail and this is by fr the best i just want it work lol idk if u can possibly show me where to insert the app.js stuff cause i feel like thats my problem, im new to coding so it kinda confuses me but any help is appreciated

Reading phone issue

Capture

When I hover over the pet in my inventory to see the information, it returns this error.

Water Bottle Problem

I have filled the portable Water Bottle with water_bottle an when it try to giv it the Pet this error is shown

Screenshot (362)

Second Problem:

I dont get the Infos
image

error with update

[      script:qb-core] SCRIPT ERROR: SCRIPT ERROR: @keep-companion/server/server.lua:494: attempt to index a nil value (field '?')
[      script:qb-core] > search_vehicle (@keep-companion/server/server.lua:494)
[      script:qb-core] > ref (@keep-companion/server/server.lua:508)
[      script:qb-core] > Query.onResult (@oxmysql/dist/build.js:21741)
[      script:qb-core] > <unknown> (@oxmysql/dist/build.js:11918)
[      script:qb-core] > processTicksAndRejections (node:internal/process/task_queues:78)

local items = json.decode(items_list[1].items)

ox_inv

Pls Ox_inventory support!

Pet died

I just noticed that after the server restart, if you killed your dog before, it lives again. Maybe it would be possible to include a database query and you have to go to the vet to revive your animal.

Issue With waterbottle

[script:keep-companio] SCRIPT ERROR: @keep-companion/server/server.lua:266: attempt to compare number with nil

Using qb-inventory

It keeps telling me to wash it and I am unable to provide water to my pet

Shop won't open

Followed all steps for install, no errors. When I interact with the ped the menu opens but doesn't display and locks player in place. Any fix or advice would be appreciated.

Using qb-inventory

please add a rat

There was a server that had pet rats. I loved it. Am I able to add the rat info into the files now and use? If i get proper hash or whatever is needed?

Also, the pet rat would crawl on you/carry it. The greatest!

Add more animals?

It could be awesome to add more pets,

boar, cow, chicken, pig, rabbit, coyote. 🤔

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.