Accessible files
Here you can find all the files which can be edite to make the asset compatible with your server.
config.lua
Config = {
Core = 'ESX', -- ESX / QBCORE | Other core setting on the 'core' folder and the client and server utils.lua
TextUI = 'ox_lib', -- 'ox_lib' / 'okokTextUI' / 'ESXTextUI' / 'QBDrawText'
BrutalNotify = true, -- Buy here: (4€+VAT) https://store.brutalscripts.com | Or set up your own notify >> cl_utils.lua
LocallyInvisible = true, -- true or false | If your ANTICHEAT ban the player with 'Invisible' reason, set to false!
BallProp = 'w_am_baseball',
BallWeapon = 'WEAPON_BALL',
MaxPetCount = 3, -- Player Maximum Pets count
SendHomeAutomativally = true, -- if the player left behind the pet, it will send to home automatically
DeletePetAfterDie = false, -- if this is true, when the player's pet dies, it is deleted from the database and cannot be revived.
PetBlip = {Use = true, ShortRange = true, colour = 34, label = 'Pet:', size = 0.7, sprite = 1 }, -- Blip to a Pet if Pet is out
Shops = {
{
name = 'Pet Shop #1', -- Name of the shop
id = 'shop_1', -- ID of the shop, it's used to get what shop is opened | needs to be DIFFERENT for each shop
price = 20000, -- Price of the Shop
inGameBuy = true,
model = 'a_f_m_soucent_02',
blip = {use = true, size = 0.7, sprite = 442, color = 48},
coords = vector4(406.1400, 322.7617, 103.1259, 250.00),
petPosition = { ['left/right'] = -8.0, ['forward/backward'] = 1.4, ['up/down'] = -0.98, ['heading'] = 270 },
managementCoords = vector3(404.6441, 318.7576, 103.1259),
managementMarkers = {use = true, marker = 20, bobUpAndDown = false, rotate = true, size = {0.3, 0.2, 0.2}, rgb = {15, 100, 210}},
jobVehicleModel = 'speedo',
jobVehicleSpawn = vector4(368.4961, 341.8890, 103.1756, 166.1425),
jobBlip = {label = 'Designated Place', size = 0.7, sprite = 1, color = 5},
jobDesignatedCoords = { -- Locations where someone who accepted an order will have to go (it is random)
vector3(978.86, -1565.49, 30.78),
vector3(-104.00, 37.50, 71.48),
vector3(-2034.87, -274.73, 23.39)
},
},
{
name = 'Pet Shop #2', -- Name of the shop
id = 'shop_2', -- ID of the shop, it's used to get what shop is opened | needs to be DIFFERENT for each shop
price = 20000, -- Price of the Shop
inGameBuy = true,
model = 'a_f_m_soucent_02',
blip = {use = true, size = 0.7, sprite = 442, color = 48},
coords = vector4(563.3985, 2753.1648, 42.8771, 185.6694),
petPosition = { ['left/right'] = 0.0, ['forward/backward'] = 3.0, ['up/down'] = -0.98, ['heading'] = 270 },
managementCoords = vector3(560.7430, 2753.0442, 42.8771),
managementMarkers = {use = true, marker = 20, bobUpAndDown = false, rotate = true, size = {0.3, 0.2, 0.2}, rgb = {15, 100, 210}},
jobVehicleModel = 'speedo',
jobVehicleSpawn = vector4(584.3903, 2789.9268, 42.1849, 7.3581),
jobBlip = {label = 'Designated Place', size = 0.7, sprite = 1, color = 5},
jobDesignatedCoords = { -- Locations where someone who accepted an order will have to go (it is random)
vector3(978.86, -1565.49, 30.78),
vector3(-104.00, 37.50, 71.48),
vector3(-2034.87, -274.73, 23.39)
},
},
},
MaxNumberOfItemsOrder = 50,
StatusUpdateTime = 3, -- Pet Status update time in minutes, when the Pet is out!
Medikit = {Progressbar = true, Label = 'Using the medikit...', Time = 7, anim = {'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01'}, Cooldown = 10},
Items = {
[1] = {item = 'pet_water', label = 'Pet Water', type = 'drink', basicPrice = 100, maxAmount = 300, value = 20}, -- You can't give the same Item to two different Items in the shop
[2] = {item = 'pet_food', label = 'Pet Food', type = 'food', basicPrice = 100, maxAmount = 300, value = 20},
[3] = {item = 'pet_medikit', label = 'Pet Medikit', type = 'medikit', maxAmount = 300, basicPrice = 1000},
[4] = {item = 'WEAPON_BALL', label = 'Pet Ball', type = 'ball', maxAmount = 300, basicPrice = 1000},
},
-- IMPORTANT!!!! Download the K9 dog model from here: https://forum.cfx.re/uploads/short-url/jG6S1jPCPgG48VqBghwuxrkyl9z.rar
Pets = {
-- The first pet's job have to be false (Jobs = false)
[1] = {label = 'Husky', model = 'A_C_Husky', type = 'BigDogs', basicPrice = 500, maxAmount = 25, Skin = {0, 2}, Collar = {3, 0}, Jobs = false},
[2] = {label = 'Rottweiler', model = 'A_C_Rottweiler', type = 'BigDogs', basicPrice = 4000, maxAmount = 25, Skin = {4, 2}, Collar = {3, 3}, Jobs = false},
[3] = {label = 'Retriever', model = 'A_C_Retriever', type = 'BigDogs', basicPrice = 500, maxAmount = 25, Skin = {0, 3}, Collar = {3, 0}, Jobs = false},
[4] = {label = 'Westy', model = 'A_C_Westy', type = 'SmallDogs', basicPrice = 500, maxAmount = 25, Skin = {4, 2}, Collar = {3, 5}, Jobs = false},
[5] = {label = 'Pug', model = 'A_C_Pug', type = 'SmallDogs', basicPrice = 500, maxAmount = 25, Skin = {4, 3}, Collar = {3, 5}, Jobs = false},
[6] = {label = 'Poodle', model = 'A_C_Poodle', type = 'SmallDogs', basicPrice = 500, maxAmount = 25, Skin = {0, 0}, Collar = {3, 0}, Jobs = false},
[7] = {label = 'Panther', model = 'A_C_Panther', type = 'BigCat', basicPrice = 500, maxAmount = 25, Skin = {0, 0}, Collar = {3, 0}, Jobs = false},
[8] = {label = 'Lion', model = 'A_C_MtLion', type = 'BigCat', basicPrice = 500, maxAmount = 25, Skin = {0, 2}, Collar = {3, 0}, Jobs = false},
[9] = {label = 'Cat', model = 'A_C_Cat_01', type = 'SmallCat', basicPrice = 500, maxAmount = 25, Skin = {0, 2}, Collar = {3, 0}, Jobs = false},
[10] = {label = 'K9 Dog', model = 'A_C_shepherd', type = 'PoliceDogs', basicPrice = 500, maxAmount = 25, Skin = {0, 2}, Collar = {3, 3}, Jobs = {'police', 'sheriff', 'fbi'}},
-- WOULD YOU LIKE MORE PETS?
-- 'BRUTAL' - code 15% discount: https://future.tebex.io/
-- This is how you can add addon models to the script:
--[11] = {label = 'Yorkshire', model = 'yorkshire', type = 'SmallDogs', basicPrice = 500, maxAmount = 25, Skin = {0, 2}, Collar = {3, 0}, Jobs = false},
},
TaskMenuPosition = { -- The position of the panel which shows the task of the pet
top = 80, -- in percentages
left = 25,
},
Commands = {
PetMenu = {
Command = 'petmenu',
Suggestion = 'Open Pet Menu',
Control = 'Delete' -- Controls list: https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/
},
MenuPosition = {
Command = 'petmenupos',
Suggestion = 'Pet Menu Position edit',
},
MenuHide = {
AlwaysStayHide = false,
Command = 'petmenuhide',
Suggestion = 'Pet Menu Hide',
},
PetControl = {
PetSpawn = {
Command = 'petspawn',
Suggestion = 'Spawn the selected pet',
Control = '' }, -- If '' the value it won't register any contol to it
PetSleep = {
Command = 'petsleep',
Suggestion = 'Send the selected pet to sleep',
Control = '' },
PetSit = {
Command = 'petsit',
Suggestion = 'Sits down/stands up the selected pet',
Control = '' },
PetFollow = {
Command = 'petfollow',
Suggestion = 'The selected pet start/stop following',
Control = '' },
PetAttack = {
Command = 'petattack',
Suggestion = 'The selected pet start/stop attacking',
Control = '' },
},
},
SniffOutDrogs = {
Command = 'petsniff',
Suggestion = 'Pet will sniff out the drogs',
Control = '',
Jobs = {'police', 'sheriff', 'fbi'}, -- Ranks which can use this function
Drogs = {'water', 'heroin'} -- Drogs which your pet can sniff out
},
PetConfig = {
SmallDogs = {
Tasks = {Attack = false, Ball = true, Sniff = false},
SitAnim = {"creatures@pug@amb@world_dog_sitting@idle_a", "idle_b"},
OtherAnims = {
[1] = {"Bark", "creatures@pug@amb@world_dog_barking@idle_a", "idle_a"},
[2] = {"Bark 2", "creatures@pug@amb@world_dog_barking@idle_a", "idle_b"},
[3] = {"Bark", "creatures@pug@amb@world_dog_barking@idle_a", "idle_c"},
}
},
BigDogs = {
Tasks = {Attack = true, Ball = true, Sniff = false},
SitAnim = {"creatures@retriever@amb@world_dog_sitting@idle_a", "idle_b"},
OtherAnims = {
[1] = {"Normal Bark", "creatures@retriever@amb@world_dog_barking@idle_a", "idle_a"},
[2] = {"Standing Bark", "creatures@retriever@amb@world_dog_barking@idle_a", "idle_b"},
[3] = {"Rotate Bark", "creatures@retriever@amb@world_dog_barking@idle_a", "idle_c"},
[4] = {"Sit 1", "creatures@retriever@amb@world_dog_sitting@idle_a", "idle_a"},
[5] = {"Sit 2", "creatures@retriever@amb@world_dog_sitting@idle_a", "idle_b"},
[6] = {"Sit 3", "creatures@retriever@amb@world_dog_sitting@idle_a", "idle_c"},
[7] = {"Sit 4", "creatures@retriever@amb@world_dog_sitting@base", "base"},
[8] = {"Indicate Ahead", "creatures@rottweiler@indication@", "indicate_ahead"},
[9] = {"Indicate High", "creatures@rottweiler@indication@", "indicate_high"},
[10] = {"Indicate Low", "creatures@rottweiler@indication@", "indicate_low"},
[11] = {"Petting Chop", "creatures@rottweiler@tricks@", "petting_chop"},
[12] = {"Fetch Drop", "CREATURES@ROTTWEILER@MOVE", "fetch_drop"},
[13] = {"Fetch Pickup", "CREATURES@ROTTWEILER@MOVE", "fetch_pickup"},
}
},
SmallCat = {
Tasks = {Attack = false, Ball = false, Sniff = false},
SitAnim = {"creatures@cat@amb@world_cat_sleeping_ledge@idle_a", "idle_a"},
OtherAnims = {
[1] = {"Sleep", "creatures@cat@amb@world_cat_sleeping_ground@base", "base"},
[2] = {"Looking up", "creatures@cat@move", "idle_dwn"},
[3] = {"Stealth", "creatures@cat@move", "idle_upp"},
}
},
BigCat = {
Tasks = {Attack = true, Ball = true, Sniff = false},
SitAnim = {"creatures@cougar@amb@world_cougar_rest@idle_a", "idle_c"},
OtherAnims = {
-- We did not find.
}
},
PoliceDogs = {
Tasks = {Attack = true, Ball = true, Sniff = true},
SitAnim = {"creatures@retriever@amb@world_dog_sitting@idle_a", "idle_b"},
OtherAnims = {
[1] = {"Normal Bark", "creatures@retriever@amb@world_dog_barking@idle_a", "idle_a"},
[2] = {"Standing Bark", "creatures@retriever@amb@world_dog_barking@idle_a", "idle_b"},
[3] = {"Rotate Bark", "creatures@retriever@amb@world_dog_barking@idle_a", "idle_c"},
[4] = {"Sit 1", "creatures@retriever@amb@world_dog_sitting@idle_a", "idle_a"},
[5] = {"Sit 2", "creatures@retriever@amb@world_dog_sitting@idle_a", "idle_b"},
[6] = {"Sit 3", "creatures@retriever@amb@world_dog_sitting@idle_a", "idle_c"},
[7] = {"Sit 4", "creatures@retriever@amb@world_dog_sitting@base", "base"},
[8] = {"Indicate Ahead", "creatures@rottweiler@indication@", "indicate_ahead"},
[9] = {"Indicate High", "creatures@rottweiler@indication@", "indicate_high"},
[10] = {"Indicate Low", "creatures@rottweiler@indication@", "indicate_low"},
[11] = {"Petting Chop", "creatures@rottweiler@tricks@", "petting_chop"},
[12] = {"Fetch Drop", "CREATURES@ROTTWEILER@MOVE", "fetch_drop"},
[13] = {"Fetch Pickup", "CREATURES@ROTTWEILER@MOVE", "fetch_pickup"},
}
},
},
BlackListedVehicles = {
'bf400',
-- You can add more
},
-----------------------------------------------------------
-----------------------| TRANSLATE |-----------------------
-----------------------------------------------------------
MoneyForm = '$',
Texts = {
[1] = {'[E] - Pet Shop', 38}, -- 'TEXT', 'CONTROL' Controls: https://docs.fivem.net/docs/game-references/controls/
[2] = {'[E] - Management', 38},
[3] = {'[E] - Job', 38},
[4] = {'[E] - Show Jobs', 38},
[5] = {'[E] - Pick up/down the box', 38},
------- Show Help Notify -------
[6] = {'~b~Throw the ball away!~w~'},
[7] = {'~y~Stay near to you pet to attack someone!~w~\nPress ~INPUT_FRONTEND_RRIGHT~ to ~r~cancel~w~ the attack', 194},
[8] = {'~r~Control:~w~ ~INPUT_CELLPHONE_LEFT~ & ~INPUT_CELLPHONE_RIGHT~\n~b~Current Emote: ~w~', 174, 175, 191},
[9] = {'~g~Keep the gun pointed at the target.~w~', 174, 175, 191},
[10] = {'Press ~INPUT_CELLPHONE_CAMERA_FOCUS_LOCK~ ~b~to send the pet to a place', 182},
[11] = {'Press ~INPUT_CELLPHONE_LEFT~ and ~INPUT_CELLPHONE_RIGHT~ ~o~to rotate the Pet', 174, 175},
[12] = {'Press ~INPUT_FRONTEND_RRIGHT~ ~r~to cancel', 194},
[13] = {'~b~Pet can go to the designated place~w~\nPress ~INPUT_DETONATE~ ~p~to the pet go there', 47},
},
TargetTexts = {
[1] = {'Open Shop Menu', 'fa-solid fa-basket-shopping'},
[2] = {'Open Pet Menu', 'fa-solid fa-paw'},
[3] = {'Open Management Menu', 'fa-solid fa-list-check'},
},
Notify = {
[1] = {"PET MENU", "Your pet is still alive!", 5000, "error"}, -- Error = notify type, "Your pet is still alive!" = Message, 5000 = time, 5000 = 5 sec
[2] = {"PET MENU", "Your pet is dead! Use a medikit item to revive it!", 5000, "warning"}, -- TYPE, MESSAGE, TIME
[3] = {"PET MENU", "Your pet far away!", 5000, "error"},
[4] = {"PET MENU", "You succesfully adopted the pet!", 5000, "success"},
[5] = {"PET MENU", "You succesfully revived your pet!", 5000, "success"},
[6] = {"PET MENU", "Feed or water your pet!", 5000, "warning"},
[7] = {"PET MENU", "You have let free your pet!", 5000, "success"},
[8] = {"PET MENU", "The pet name should be between 3-15 character!", 5000, "error"},
[9] = {"PET MENU", "You already have a pet!", 5000, "error"},
[10] = {"PET MENU", "You don't have a pet!", 5000, "error"},
[11] = {"PET MENU", "Your pet is sleeping!", 5000, "error"},
[12] = {"PET MENU", "You can't open the menu, because your pet is died! Go to the pet Hospital!", 5000, "error"},
[13] = {"PET MENU", "You have gone too far!", 5000, "error"},
[14] = {"PET MENU", "Your pet is sleeping! Send the pet out!", 5000, "error"},
[15] = {"PET MENU", "Your pet is already out!", 5000, "error"},
[16] = {"PET MENU", "You don't have enough money!", 5000, "error"},
[17] = {"PET MENU", "You successfully used the pet Water!", 5000, "success"},
[18] = {"PET MENU", "You successfully used the pet Food!", 5000, "success"},
[19] = {"PET MENU", "Your PET is not hungry / thirsty!", 5000, "error"},
[20] = {"PET MENU", "Successfully purchase!", 5000, "success"},
[21] = {"PET MENU", "You don't have permission to open the Shop!", 5000, "error"},
[22] = {"PET MENU", "You can't buy more pets!", 5000, "error"},
[23] = {"PET MENU", "Your pet can't do it!", 5000, "error"},
[24] = {"PET MENU", "There are no emotions available for this Pet!", 7000, "error"},
[25] = {"PET MENU", "You have no ball in your hand!", 7000, "error"},
[26] = {"PET MENU", "Invalid Player ID!", 7000, "error"},
[27] = {"PET MENU", "Printed!", 7000, "success"},
[28] = {"PET MENU", "You don't have permission to buy a K9 dog! Cause you're not cop!", 5000, "error"},
[29] = {"PET MENU", "Your pet is dead forever!", 5000, "error"},
[30] = {"PET MENU", "You don't have permission to do this!", 5000, "error"},
[31] = {"PET MENU", "The target is not online!", 5000, "error"},
[32] = {"PET MENU", "The pet mustn't be out!", 5000, "error"},
[33] = {"PET MENU", "You successfully transfered the pet! ", 5000, "info"},
[34] = {"PET MENU", "You have got a pet!", 5000, "info"},
[35] = {"PET MENU", "You have deposited:", 5000, "info"},
[36] = {"PET MENU", "You got:", 5000, "info"},
[37] = {"PET MENU", "Not enough money in the business:", 5000, "error"},
[38] = {"PET MENU", "Go to the designated place!", 5000, "info"},
[39] = {"PET MENU", "Deliver the shipment to the company!", 5000, "info"},
[40] = {"PET MENU", "You have successfully completed the shipment!", 5000, "info"},
[41] = {"PET MENU", "The Truck is not near!", 5000, "error"},
[42] = {"PET MENU", "This shop is already sold out!", 5000, "error"},
[43] = {"PET MENU", "Successfully purchase!", 5000, "success"},
[44] = {"PET MENU", "Successfully sale!", 5000, "success"},
[45] = {"PET MENU", "This shop cannot be purchased!", 5000, "error"},
[46] = {"PET MENU", "He has drug(s)!", 5000, "info"},
},
Instructions = { -- Maximum 20 character!
Follow = 'Follow',
SitDown = 'Sit down',
LayDown = 'Lay down',
GoTo = 'Go to place',
Sit = 'Sitting',
Sleep = 'Go to sleeping',
Ball = 'Plays with ball',
Attack = 'Attacking',
Play = 'Playing',
Sniff = "Sniff's out drogs",
},
Webhooks = {
Use = true, -- Use webhooks? true / false
Locale = {
['BusinessPurchase'] = 'Business Purchase',
['BusinessSale'] = 'Business Sale',
['PlayerName'] = 'Player Name',
['Identifier'] = 'Identifier',
['ShopID'] = 'Shop ID',
['Price'] = 'Price',
['Amount'] = 'Amount',
['Time'] = 'Time ⏲️'
},
-- To change a webhook color you need to set the decimal value of a color, you can use this website to do that - https://www.mathsisfun.com/hexadecimal-decimal-colors.html
Colors = {
['Hacker'] = 3145631,
['SubAccountDeleted'] = 16711680,
['PermissionTableRefreshed'] = 10155240
}
}
}
client-utils.lua
-- Buy here: (4€+VAT) https://store.brutalscripts.com
function notification(title, text, time, type)
if Config.BrutalNotify then
exports['brutal_notify']:SendAlert(title, text, time, type)
else
-- Put here your own notify and set the Config.BrutalNotify to false
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(0,1)
-- Default ESX Notify:
--TriggerEvent('esx:showNotification', text)
-- Default QB Notify:
--TriggerEvent('QBCore:Notify', text, 'info', 5000)
-- OKOK Notify:
-- exports['okokNotify']:Alert(title, text, time, type, false)
end
end
function TextUIFunction(type, text)
if type == 'open' then
if Config.TextUI:lower() == 'ox_lib' then
lib.showTextUI(text)
elseif Config.TextUI:lower() == 'okoktextui' then
exports['okokTextUI']:Open(text, 'darkblue', 'right')
elseif Config.TextUI:lower() == 'esxtextui' then
ESX.TextUI(text)
elseif Config.TextUI:lower() == 'qbdrawtext' then
exports['qb-core']:DrawText(text,'left')
end
elseif type == 'hide' then
if Config.TextUI:lower() == 'ox_lib' then
lib.hideTextUI()
elseif Config.TextUI:lower() == 'okoktextui' then
exports['okokTextUI']:Close()
elseif Config.TextUI:lower() == 'esxtextui' then
ESX.HideUI()
elseif Config.TextUI:lower() == 'qbdrawtext' then
exports['qb-core']:HideText()
end
end
end
RegisterNetEvent('brutal_pets:client:OpenPetMenu')
AddEventHandler('brutal_pets:client:OpenPetMenu', function()
TriggerEvent('brutal_pets:client:openmypetmenu')
end)
function PetDied(ped)
local died = false
if IsEntityDead(ped) then
died = true
end
return died
end
function GetPedHP(ped)
if GetEntityHealth(ped) < tonumber(MyPets[CB].HP) and DoesEntityExist(ped) then
if GetEntityHealth(ped) == 0 then
MyPets[CB].HP = 100
else
MyPets[CB].HP = GetEntityHealth(ped)
end
return MyPets[CB].HP
else
if MyPets[CB].HP == 0 then
MyPets[CB].HP = 100
end
return MyPets[CB].HP
end
end
function GPS_Enable()
DisplayRadar(true)
end
function GPS_Disable()
DisplayRadar(false)
end
function WhistleAnimation()
local playerPed = PlayerPedId()
loadAnimDict('rcmnigel1c')
TaskPlayAnim(playerPed, 'rcmnigel1c', 'hailing_whistle_waive_a', 8.0, -8, -1, 1, 0, 0, 0, 0)
Citizen.Wait(2300)
ClearPedTasks(playerPed)
end
function GetBallBack_Utils()
TriggerServerEvent('brutal_pets:server:AddItems', {{"WEAPON_BALL", 1}})
-- This is played when the pet returns the ball to the player
end
function HelpText(text, sound, _end)
text = tostring(text)
AddTextEntry(GetCurrentResourceName(), text)
BeginTextCommandDisplayHelp(GetCurrentResourceName())
EndTextCommandDisplayHelp(0, 0, (sound == true), 2500)
end
-- Put this trigger where you want that the pet unfollow the player
-- TriggerEvent('brutal_pets:client:UnFollowPet')
RegisterNetEvent('brutal_pets:client:UnFollowPet')
AddEventHandler('brutal_pets:client:UnFollowPet', function()
if MyPets[CB].Follow == true and MyPets[CB].InTask == true and MyPets[CB].IsOut then
FollowPlayer()
end
end)
function DeleteBallFunction(object)
DeleteObject(object)
end
function PutPlayerIntoVehicle(Vehicle)
TaskWarpPedIntoVehicle(PlayerPedId(), Vehicle, -1)
end
function GiveKeysToPlayer(Vehicle)
if Config['Core']:upper() == 'QBCORE' then
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(Vehicle))
end
end
server-utils.lua
local YourWebhook = 'ADD-YOUR-WEBHOOK-HERE' -- help: https://docs.brutalscripts.com/site/others/discord-webhook
function GetWebhook()
return YourWebhook
end
client-core.lua
Core = nil
if Config['Core']:upper() == 'ESX' then
local _esx_ = 'new' -- 'new' / 'old'
if _esx_ then
Core = exports['es_extended']:getSharedObject()
else
while Core == nil do
TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
Citizen.Wait(0)
end
end
LoadedEvent = 'esx:playerLoaded'
TSCB = Core.TriggerServerCallback
function PlayerJobFunction()
return Core.GetPlayerData().job.name
end
elseif Config['Core']:upper() == 'QBCORE' then
Core = exports['qb-core']:GetCoreObject()
LoadedEvent = 'QBCore:Client:OnPlayerLoaded'
TSCB = Core.Functions.TriggerCallback
function PlayerJobFunction()
return Core.Functions.GetPlayerData().job.name
end
end
server-core.lua
Core = nil
if Config['Core']:upper() == 'ESX' then
--------------------------------------------------------------------------
---------------------------------| ESX |----------------------------------
--------------------------------------------------------------------------
local _esx_ = 'new' -- 'new' / 'old'
if _esx_ == 'new' then
Core = exports['es_extended']:getSharedObject()
else
Core = nil
TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
while Core == nil do
Citizen.Wait(0)
end
end
RESCB = Core.RegisterServerCallback
GETPFI = Core.GetPlayerFromId
RUI = Core.RegisterUsableItem
function GetIdentifier(source)
local xPlayer = GETPFI(source)
return xPlayer.identifier
end
function GetAccountMoney(source,account)
local xPlayer = GETPFI(source)
if account == 'bank' then
return xPlayer.getAccount(account).money
elseif account == 'money' then
return xPlayer.getMoney()
end
end
function AddMoneyFunction(source, account, amount)
local xPlayer = GETPFI(source)
if account == 'bank' then
xPlayer.addAccountMoney('bank', amount)
elseif account == 'money' then
xPlayer.addMoney(amount)
end
end
function RemoveAccountMoney(source, account, amount)
local xPlayer = GETPFI(source)
if account == 'bank' then
xPlayer.removeAccountMoney('bank', amount)
elseif account == 'money' then
xPlayer.removeMoney(amount)
end
end
function GetItemCount(source, item)
local xPlayer = GETPFI(source)
if _esx_ == 'new' then
if xPlayer.getInventoryItem(item) ~= nil and xPlayer.getInventoryItem(item) ~= '' then
return xPlayer.getInventoryItem(item).count
else
return 0
end
else
if string.sub(item, 0, 6):lower() == 'weapon' then
local loadoutNum, weapon = xPlayer.getWeapon(item:upper())
if weapon then
return true
else
return false
end
else
if xPlayer.getInventoryItem(item) ~= nil and xPlayer.getInventoryItem(item) ~= '' then
return xPlayer.getInventoryItem(item).count
else
return 0
end
end
end
end
function RemoveItem(source, item, amount)
local xPlayer = GETPFI(source)
if _esx_ == 'new' then
xPlayer.removeInventoryItem(item, amount)
else
if string.sub(item, 0, 6):lower() == 'weapon' then
xPlayer.removeWeapon(item)
else
xPlayer.removeInventoryItem(item, amount)
end
end
end
function AddItem(source, item, count)
local xPlayer = GETPFI(source)
if _esx_ == 'new' then
xPlayer.addInventoryItem(item, count)
else
if string.sub(item, 0, 6):lower() == 'weapon' then
xPlayer.addWeapon(item, 90)
else
xPlayer.addInventoryItem(item, count)
end
end
end
elseif Config['Core']:upper() == 'QBCORE' then
--------------------------------------------------------------------------
--------------------------------| QBCORE |--------------------------------
--------------------------------------------------------------------------
Core = exports['qb-core']:GetCoreObject()
RESCB = Core.Functions.CreateCallback
GETPFI = Core.Functions.GetPlayer
RUI = Core.Functions.CreateUseableItem
function GetIdentifier(source)
local xPlayer = GETPFI(source)
return xPlayer.PlayerData.citizenid
end
function GetItemCount(source, item)
local xPlayer = GETPFI(source)
local items = xPlayer.Functions.GetItemByName(item)
local item_count = 0
if items ~= nil then
item_count = items.amount
else
item_count = 0
end
return item_count
end
function GetAccountMoney(source, account)
local xPlayer = GETPFI(source)
if account == 'bank' then
return xPlayer.PlayerData.money.bank
elseif account == 'money' then
return xPlayer.PlayerData.money.cash
end
end
function AddMoneyFunction(source, account, amount)
local xPlayer = GETPFI(source)
if account == 'bank' then
xPlayer.Functions.AddMoney('bank', amount)
elseif account == 'money' then
xPlayer.Functions.AddMoney('cash', amount)
end
end
function RemoveAccountMoney(source, account, amount)
local xPlayer = GETPFI(source)
if account == 'bank' then
xPlayer.Functions.RemoveMoney('bank', amount)
elseif account == 'money' then
xPlayer.Functions.RemoveMoney('cash', amount)
end
end
function RemoveItem(source, item)
local xPlayer = GETPFI(source)
xPlayer.Functions.RemoveItem(item, 1)
end
function AddItem(source, item, count)
local xPlayer = GETPFI(source)
xPlayer.Functions.AddItem(item, count)
end
end
Last updated