Merge pull request #170 from TheOrderFivem/dev

Dev
This commit is contained in:
MrNewb authored and GitHub committed 2025-12-14 16:23:45 -05:00
commit 5fd0744ca5
164 files changed
+3032 -3206

No files matched your search

-20
View File
@@ -1,20 +0,0 @@
-- -- Make sure to include filename in the init (prefix of the .lua)Utility = Utility or Require("lib/utility/client/utility.lua")
-- local ParticlesBehaviors = {
-- tag = "isTemplate",
-- default = {
-- }
-- }
-- function ParticlesBehaviors.OnSpawn(entityData)
-- end
-- function ParticlesBehaviors.OnRemove(entityData)
-- end
-- function ParticlesBehaviors.OnUpdate(entityData)
-- end
-- return ParticlesBehaviors
-19
View File
@@ -1,19 +0,0 @@
AddEventHandler('onResourceStart', function(resource)
if resource == GetCurrentResourceName() then
Bridge.Cache.OnChange("Ped", function(newValue, oldValue)
print("Ped changed from " .. tostring(oldValue) .. " to " .. tostring(newValue))
end)
end
end)
RegisterCommand("testcache", function(source, args, rawCommand)
-- local cache = Bridge.Cache.Get("Ped")
Bridge.Cache.Create("TestCache", function()
return math.random(1, 100)
end, 1000)
Bridge.Cache.OnChange("TestCache", function(newValue, oldValue)
print("TestCache changed from " .. tostring(oldValue) .. " to " .. tostring(newValue))
end)
end)
-40
View File
@@ -1,40 +0,0 @@
-- ▄▀▀ ▄▀▄ █ █ ██▄ ▄▀▄ ▄▀▀ █▄▀ ▄▀▀ ▄▀▀ █▄█ ▄▀▄ █▀▄ ██▀ █▀▄ █ █ █▄ █ █ ▀█▀ ▀█▀ ██▀ ▄▀▀ ▀█▀
-- ▀▄▄ █▀█ █▄▄ █▄▄ █▄█ █▀█ ▀▄▄ █ █ ▄█▀ ▄█▀ █ █ █▀█ █▀▄ █▄▄ █▄▀ ▀▄█ █ ▀█ █ █ █ █▄▄ ▄█▀ █
-- -- -- -- -- -- -- -- -- --
-- ▄▀▀ ██▀ █▀▄ █ █ ██▀ █▀▄
-- ▄█▀ █▄▄ █▀▄ ▀▄▀ █▄▄ █▀▄
-- -- -- -- -- -- -- -- -- --
if not IsDuplicityVersion() then goto client end
Bridge.Callbacks.Register('callback_test1_name_here', function(src, var1)
if var1 == "herpaderpa" then
print("this is a test")
end
return 'some random string', "some other string"
end)
RegisterCommand('callback_test2', function(source)
local someData, other = Bridge.Callbacks.Trigger('callback_test2_name_here', source, "herpaderpa")
print("Data From Client: ", someData, other)
end)
-- -- -- -- -- -- -- -- -- --
-- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀
-- ▀▄▄ █▄▄ █ █▄▄ █ ▀█ █
-- -- -- -- -- -- -- -- -- --
if IsDuplicityVersion() then return end
::client::
RegisterCommand('callback_test1', function()
local somerandomstring, someotherrandomstring = Bridge.Callbacks.Trigger('callback_test1_name_here', "herpaderpa")
print("Data From Server: ", somerandomstring, someotherrandomstring)
end)
-- exports.community_bridge:RegisterRebound('callback_test1', function(src, cb, ftpcsftug)
-- print("this is a rebound to all players")
-- end)
Bridge.Callbacks.Register('callback_test2_name_here', function(ftpcsftug)
return ftpcsftug, 'TestyMcTesterton'
end)
-367
View File
@@ -1,367 +0,0 @@
Bridge = Bridge or exports['community_bridge']:Bridge()
-- RegisterCommand("ClientEntityParticles", function()
-- local position = GetEntityCoords(PlayerPedId())
-- local data = Bridge.ClientEntity.Create({
-- id = "particle_" .. math.random(1, 10000),
-- model = "mp_m_freemode_01",
-- coords = position,
-- entityType = "ped",
-- freeze = false,
-- follow = {
-- target = 1,
-- },
-- weapon = {
-- name = "WEAPON_PISTOL",
-- ammo = 100
-- },
-- stash = {
-- -- id = "generate from server",
-- label = "Test Stash",
-- target = {
-- label = "Open Stash",
-- description = "Access the stash to store or retrieve items.",
-- icon = "fas fa-boxes"
-- }
-- },
-- attach = {
-- target = 1,
-- bone = 57005, -- right hand
-- },
-- scenarios = {
-- name = "WORLD_HUMAN_CLIPBOARD",
-- introClip = true,
-- duration = 20000
-- },
-- anim = {
-- dict = "anim@mp_player_intcelebrationmale@wave",
-- name = "wave",
-- flags = 49,
-- duration = -1,
-- onComplete = function(entityData)
-- Bridge.ClientEntity.Set(entityData.id, "anim", {
-- dict = "rcmnigel1c",
-- name = "hailing_whistle_waive_a",
-- flags = entityData.anim.flags,
-- duration = 10000,
-- onComplete = function(entityData)
-- Bridge.ClientEntity.Set(entityData.id, "anim", {
-- dict = "timetable@denice@ig_1",
-- name = "idle_b",
-- flags = entityData.anim.flags,
-- duration = 10000,
-- onComplete = function(entityData)
-- print("hello")
-- end
-- })
-- end
-- })
-- end
-- },
-- clothing = {
-- components = {
-- { drawable = 0, texture = 0, component_id = 0 },
-- { drawable = 0, texture = 0, component_id = 1 },
-- { drawable = 19, texture = 0, component_id = 2 },
-- { drawable = 6, texture = 0, component_id = 3 },
-- { drawable = 0, texture = 0, component_id = 4 },
-- { drawable = 0, texture = 0, component_id = 5 },
-- { drawable = 0, texture = 0, component_id = 6 },
-- { drawable = 0, texture = 0, component_id = 7 },
-- { drawable = 23, texture = 0, component_id = 8 },
-- { drawable = 0, texture = 0, component_id = 9 },
-- { drawable = 0, texture = 0, component_id = 10 },
-- { drawable = 4, texture = 2, component_id = 11 }
-- },
-- props = {
-- { drawable = 27, prop_id = 0, texture = 0 },
-- { drawable = 0, prop_id = 1, texture = 0 },
-- { drawable = 0, prop_id = 2, texture = 0 },
-- { drawable = 0, prop_id = 3, texture = 0 },
-- { drawable = 0, prop_id = 4, texture = 0 },
-- { drawable = 0, prop_id = 5, texture = 0 },
-- { drawable = 0, prop_id = 6, texture = 0 },
-- { drawable = 0, prop_id = 7, texture = 0 },
-- { drawable = 0, prop_id = 8, texture = 0 },
-- { drawable = 0, prop_id = 9, texture = 0 },
-- { drawable = 0, prop_id = 10, texture = 0 },
-- { drawable = 0, prop_id = 11, texture = 0 },
-- { drawable = 0, prop_id = 12, texture = 0 },
-- { drawable = 0, prop_id = 13, texture = 0 }
-- }
-- },
-- particles = {
-- {
-- dict = "core",
-- ptfx = "ent_dst_electrical",
-- offset = vector3(0.0, 1.0, 0.0),
-- looped = true
-- },
-- {
-- dict = "core",
-- ptfx = "ent_dst_electrical",
-- offset = vector3(0.0, -1.0, 0.0),
-- rotation = vector3(0.0, 0.0, 180.0),
-- looped = true,
-- loopLength = 1000
-- }
-- },
-- targets = {
-- {
-- label = "Follow Test",
-- distance = 2,
-- description = "A test particle for demonstration purposes.",
-- onSelect = function (entityData, entity)
-- FreezeEntityPosition(entity, false)
-- Bridge.ClientEntity.Set(entityData.id, "follow", {
-- target = PlayerPedId()
-- })
-- end
-- }
-- },
-- -- OnUpdate = function(entityData)
-- -- end,
-- })
-- -- Wait(5000)
-- Bridge.ClientEntity.Set(data.id, "targets", {
-- label = "This should be the new label",
-- distance = 2,
-- description = "Herpa derpa gihad",
-- onSelect = function (entityData, entity)
-- print("round 2 baby", entityData.id)
-- end
-- })
-- end, false)
-- Bridge.ClientEntity.Behaviors.Create("plate", {
-- tag = "something",
-- OnCreate = function(entityData)
-- end,
-- OnSpawn = function(entityData)
-- end,
-- OnUpdate = function(entityData)
-- -- Update logic here
-- end,
-- OnRemove = function(entityData)
-- end,
-- OnDestroy = function(entityData)
-- end
-- })
RegisterCommand("ClientEntityFreeze", function()
local position = GetEntityCoords(PlayerPedId())
local data = Bridge.ClientEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
freeze = true
})
Wait(10000)
Bridge.ClientEntity.Set(data.id, "freeze", false)
end, false)
RegisterCommand("ClientEntityFollow", function()
local position = GetEntityCoords(PlayerPedId())
local serverId = GetPlayerServerId(PlayerId())
local data = Bridge.ClientEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
freeze = false,
follow = {
speed = 3.0,
target = serverId,
distance = 5.0
}
})
print(data.id)
end, false)
RegisterCommand("ClientEntityWeapon", function()
local position = GetEntityCoords(PlayerPedId())
local data = Bridge.ClientEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
weapon = {
name = "WEAPON_PISTOL",
ammo = 100
}
})
end, false)
RegisterCommand("ClientEntityAttach", function()
local position = GetEntityCoords(PlayerPedId())
local serverId = GetPlayerServerId(PlayerId())
Bridge.ClientEntity.Create({
id = "attach_" .. math.random(1, 10000),
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
attach = {
target = serverId,
bone = 57005
}
})
end, false)
RegisterCommand("ClientEntityScenarios", function()
local position = GetEntityCoords(PlayerPedId())
Bridge.ClientEntity.Create({
id = "scenarios_" .. math.random(1, 10000),
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
scenarios = {
name = "WORLD_HUMAN_CLIPBOARD",
introClip = true,
duration = 20000
}
})
end, false)
RegisterCommand("ClientEntityAnim", function()
local position = GetEntityCoords(PlayerPedId())
Bridge.ClientEntity.Create({
id = "anim_" .. math.random(1, 10000),
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
anim = {
dict = "anim@mp_player_intcelebrationmale@wave",
name = "wave",
flags = 49,
duration = -1,
onComplete = function(entityData)
Bridge.ClientEntity.Set(entityData.id, "anim", {
dict = "rcmnigel1c",
name = "hailing_whistle_waive_a",
flags = entityData.anim.flags,
duration = 10000,
onComplete = function(entityData)
Bridge.ClientEntity.Set(entityData.id, "anim", {
dict = "timetable@denice@ig_1",
name = "idle_b",
flags = entityData.anim.flags,
duration = 10000,
onComplete = function(entityData)
print("hello")
end
})
end
})
end
}
})
end, false)
RegisterCommand("ClientEntityClothing", function()
local position = GetEntityCoords(PlayerPedId())
Bridge.ClientEntity.Create({
id = "clothing_" .. math.random(1, 10000),
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
clothing = {
components = {
{ drawable = 0, texture = 0, component_id = 0 },
{ drawable = 0, texture = 0, component_id = 1 },
{ drawable = 19, texture = 0, component_id = 2 },
{ drawable = 6, texture = 0, component_id = 3 },
{ drawable = 0, texture = 0, component_id = 4 },
{ drawable = 0, texture = 0, component_id = 5 },
{ drawable = 0, texture = 0, component_id = 6 },
{ drawable = 0, texture = 0, component_id = 7 },
{ drawable = 23, texture = 0, component_id = 8 },
{ drawable = 0, texture = 0, component_id = 9 },
{ drawable = 0, texture = 0, component_id = 10 },
{ drawable = 4, texture = 2, component_id = 11 }
},
props = {
{ drawable = 27, prop_id = 0, texture = 0 },
{ drawable = 0, prop_id = 1, texture = 0 },
{ drawable = 0, prop_id = 2, texture = 0 },
{ drawable = 0, prop_id = 3, texture = 0 },
{ drawable = 0, prop_id = 4, texture = 0 },
{ drawable = 0, prop_id = 5, texture = 0 },
{ drawable = 0, prop_id = 6, texture = 0 },
{ drawable = 0, prop_id = 7, texture = 0 },
{ drawable = 0, prop_id = 8, texture = 0 },
{ drawable = 0, prop_id = 9, texture = 0 },
{ drawable = 0, prop_id = 10, texture = 0 },
{ drawable = 0, prop_id = 11, texture = 0 },
{ drawable = 0, prop_id = 12, texture = 0 },
{ drawable = 0, prop_id = 13, texture = 0 }
}
}
})
end, false)
RegisterCommand("ClientEntityParticles", function()
local position = GetEntityCoords(PlayerPedId())
Bridge.ClientEntity.Create({
id = "particles_" .. math.random(1, 10000),
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
particles = {
{
dict = "core",
ptfx = "ent_dst_electrical",
offset = vector3(0.0, 1.0, 0.0),
looped = true
},
{
dict = "core",
ptfx = "ent_dst_electrical",
offset = vector3(0.0, -1.0, 0.0),
rotation = vector3(0.0, 0.0, 180.0),
looped = true,
loopLength = 1000
}
}
})
end, false)
RegisterCommand("ClientEntityTargets", function()
local position = GetEntityCoords(PlayerPedId())
local derp = Bridge.ClientEntity.Create({
id = "targets_" .. math.random(1, 10000),
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
targets = {
{
label = "Initial test",
distance = 2,
description = "A test particle for demonstration purposes.",
onSelect = function (entityData, entity)
print("Selected entity:", entityData.id)
end
}
}
})
Wait(10000)
Bridge.ClientEntity.Set(derp.id, "targets",
{
{
label = "Follow Test",
distance = 2,
description = "A test particle for demonstration purposes.",
onSelect = function (entityData, entity)
Bridge.ClientEntity.Set(entityData.id, "freeze", false)
Bridge.ClientEntity.Set(entityData.id, "follow", {
target = PlayerPedId()
})
end
}
}
)
end, false)
-60
View File
@@ -1,60 +0,0 @@
Bridge = Bridge or exports['community_bridge']:Bridge()
RegisterCommand("dialogue", function()
local pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0, 2.0, 0)
local timeout = 500
local model = `a_f_y_hipster_01`
RequestModel(model)
while not HasModelLoaded(model) do
Wait(0)
timeout = timeout - 1
if timeout == 0 then
print("Failed to load model")
return
end
end
local ped = CreatePed(0, model, pos.x, pos.y, pos.z, 0.0, false, false)
SetEntityHeading(ped, 50.0)
local characterData = {
entity = ped,
offset = vector3(0, 0, 0),
rotationOffset = vector3(0, 0, 0)
}
Bridge.Dialogue.Open("Akmed", "Hello how are you doing my friend?", ped, {
{
label = "Trade with me",
id = 'something',
},
{
label = "Goodbye",
id = 'someotherthing',
},
},
function(selectedId)
if selectedId == 'something' then
Dialogue.Open( "Akmed" , "Thank you for wanting to purchase me lucky charms", characterData, {
{
label = "Fuck off",
id = 'something',
},
{
label = "Goodbye",
id = 'someotherthing',
},
},
function(selectedId)
DeleteEntity(ped)
if selectedId == "something" then
print("You hate lucky charms")
else
print("Thanks for keeping it civil")
end
end)
else
DeleteEntity(ped)
end
end)
end)
-234
View File
@@ -1,234 +0,0 @@
-- Test QB Format Input
RegisterCommand('input_test_qb', function()
local qbFormatData = {
inputs = {
{
text = "Player Name",
name = "playername",
type = "text",
isRequired = true,
default = "John Doe"
},
{
text = "Player ID",
name = "playerid",
type = "number",
isRequired = true
},
{
text = "Password",
name = "password",
type = "password",
isRequired = false
},
{
text = "Vehicle Type",
name = "vehicle",
type = "select",
isRequired = true,
options = {
{value = "car", text = "Car"},
{value = "bike", text = "Motorcycle"},
{value = "truck", text = "Truck"}
}
},
{
text = "Enable Notifications",
name = "notifications",
type = "checkbox",
isRequired = false,
options = {
{value = "email", text = "Email", checked = true},
{value = "sms", text = "SMS", checked = false}
}
}
}
}
local result = Input.Open("QB Format Test", qbFormatData, true, "Submit")
if result then
print("QB Format Result:")
for k, v in pairs(result) do
print(k .. ": " .. tostring(v))
end
else
print("QB Format: User cancelled or no input")
end
end, false)
-- Test Ox Format Input
RegisterCommand('input_test_ox', function()
local oxFormatData = {
{
type = "input",
label = "Character Name",
name = "charname",
required = true,
default = "Jane Smith"
},
{
type = "number",
label = "Age",
name = "age",
required = true,
min = 18,
max = 100
},
{
type = "select",
label = "Job Category",
name = "jobcat",
required = true,
options = {
{value = "civ", label = "Civilian"},
{value = "leo", label = "Law Enforcement"},
{value = "ems", label = "Emergency Medical"}
}
},
{
type = "checkbox",
label = "Has License",
name = "license",
required = false
},
{
type = "color",
label = "Favorite Color",
name = "color",
default = "#ff0000"
},
{
type = "date",
label = "Birth Date",
name = "birthdate",
format = "DD/MM/YYYY"
}
}
local result = Input.Open("Ox Format Test", oxFormatData, false)
if result then
print("Ox Format Result:")
for k, v in pairs(result) do
print(k .. ": " .. tostring(v))
end
else
print("Ox Format: User cancelled or no input")
end
end, false)
-- Test Simple Text Input
RegisterCommand('input_test_simple', function()
local simpleData = {
inputs = {
{
text = "Enter your message",
name = "message",
type = "text",
isRequired = true
}
}
}
local result = Input.Open("Simple Input", simpleData, true, "Send")
if result then
print("Simple Input Result: " .. (result.message or "No message"))
else
print("Simple Input: Cancelled")
end
end, false)
-- Test All Input Types (QB Format)
RegisterCommand('input_test_all_types', function()
local allTypesData = {
inputs = {
{
text = "Text Input",
name = "text_field",
type = "text",
isRequired = false,
default = "Sample text"
},
{
text = "Number Input",
name = "number_field",
type = "number",
isRequired = false,
default = 42
},
{
text = "Password Input",
name = "password_field",
type = "password",
isRequired = false
},
{
text = "Radio Selection",
name = "radio_field",
type = "radio",
isRequired = false,
options = {
{value = "option1", text = "Option 1"},
{value = "option2", text = "Option 2"},
{value = "option3", text = "Option 3"}
}
},
{
text = "Checkbox Options",
name = "checkbox_field",
type = "checkbox",
isRequired = false,
options = {
{value = "check1", text = "Check 1", checked = true},
{value = "check2", text = "Check 2", checked = false},
{value = "check3", text = "Check 3", checked = false}
}
},
{
text = "Select Dropdown",
name = "select_field",
type = "select",
isRequired = false,
options = {
{value = "val1", text = "Value 1"},
{value = "val2", text = "Value 2"},
{value = "val3", text = "Value 3"}
}
}
}
}
local result = Input.Open("All Input Types Test", allTypesData, true, "Test Submit")
if result then
print("All Types Result:", json.encode(result))
else
print("All Types: User cancelled")
end
end, false)
-- Test Error Handling
RegisterCommand('input_test_error', function()
-- Test with invalid data
local result = Input.Open("Error Test", nil, true)
if result then
print("Error test unexpectedly succeeded")
else
print("Error test correctly handled nil data")
end
-- Test with empty inputs
local emptyData = {inputs = {}}
local result2 = Input.Open("Empty Test", emptyData, true)
if result2 then
print("Empty test result: " .. json.encode(result2))
else
print("Empty test: No result")
end
end, false)
-- print("Input unit tests loaded. Available commands:")
-- print(" /input_test_qb - Test QB format input")
-- print(" /input_test_ox - Test Ox format input")
-- print(" /input_test_simple - Test simple text input")
-- print(" /input_test_all_types - Test all input types")
-- print(" /input_test_error - Test error handling")
-16
View File
@@ -1,16 +0,0 @@
-- if outside this resource, use local whatever = Require("modules/locales/shared.lua")
-- whatever.Locales("some-index-in-language-.json-file")
-- Files must be stored in "locales" folder, within the resource.
-- Instead of using Require you can also import it via the manifest.
-- The Lang variable is available globally, which tells you what the server is using.
-- print("Language: ", Lang)
-- print("Locale: ", Language.Locale("UNITTEST.locale-unit-test"))
-- Example outside community bridge resource:
-- local Language = Require('modules/locales/shared.lua')
-- print("Language: ", Lang)
-- print("Locale: ", Language.Locale("UNITTEST.locale-unit-test"))
RegisterCommand("lang", function(source, args, raw)
print( "Oh also this works", Language.Locale("placeable_object.place_object_scroll_down"))
end, false)
-7
View File
@@ -1,7 +0,0 @@
RegisterCommand("test_particle", function(source, args, rawCommand)
local playerPed = PlayerPedId()
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 1.0, 0.0)
local heading = GetEntityHeading(playerPed)
Particle.Create("core", "ent_dst_concrete_large", coords, vector3(0.0, 0.0, heading), 1.0, vector3(1.0, 1.0, 1.0), false)
end)
-38
View File
@@ -1,38 +0,0 @@
local isPlacing = false
RegisterCommand('startplacer', function(source, args, rawCommand)
if Bridge.PlaceableObject.IsPlacing() then
print("Already placing an object.")
return
end
local model = args[1] or 'prop_barrel_01a' -- Default model if none provided
local position = GetEntityCoords(PlayerPedId())
local result = Bridge.PlaceableObject.Create(model, {
allowMovement = true, -- Enable movement mode
allowNormal = true, -- Enable normal mode
allowVertical = false, -- Allow vertical movement in normal mode
startMode = 'normal', -- Start in normal mode
depthMin = 2.0,
depthMax = 15.0,
heightStep = 0.2, -- Height adjustment step
boundary = {min = vector3(position.x - 5, position.y - 5, position.z - 1.5), max = vector3(position.x + 5, position.y + 5, position.z + 10)},
showInstructionalButtons = true, -- Show instructional buttons
})
if result then
print("Object placed!")
print("Position:", result.position)
print("Heading:", result.heading)
else
print("Placement cancelled")
end
end)
RegisterCommand("startplacerold", function(source, args, rawCommand)
local model = args[1] or 'prop_barrel_01a' -- Default model if none provided
local distance = tonumber(args[2]) or 5.0 -- Default distance if not provided
local snapToGround = true
local offset = vector3(0.0, 0.0, 0.0) -- No offset
local obj = Bridge.Placeable.PlaceObject(model, distance, snapToGround, {}, offset)
end)
-115
View File
@@ -1,115 +0,0 @@
Bridge = Bridge or exports['community_bridge']:Bridge()
RegisterCommand("ServerEntityStash", function(src)
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
Bridge.ServerEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
stash = {
label = "Test Stash",
slots = 20,
maxWeight = 10000,
target = {
label = "Open Stash",
description = "Access the stash to store or retrieve items.",
icon = "fas fa-boxes"
}
}
})
end, false)
RegisterCommand("ServerEntityScenarios", function(src)
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
Bridge.ServerEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
scenarios = {
name = "WORLD_HUMAN_CLIPBOARD",
introClip = true,
duration = 20000
}
})
end, false)
RegisterCommand("ServerEntityAnim", function(src)
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
Bridge.ServerEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
anim = {
dict = "anim@mp_player_intcelebrationmale@wave",
name = "wave",
flags = 49,
duration = -1,
}
})
end, false)
RegisterCommand("ServerEntityParticles", function(src)
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
Bridge.ServerEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
particles = {
{
dict = "core",
ptfx = "ent_dst_electrical",
offset = vector3(0.0, 1.0, 0.0),
looped = true
},
{
dict = "core",
ptfx = "ent_dst_electrical",
offset = vector3(0.0, -1.0, 0.0),
rotation = vector3(0.0, 0.0, 180.0),
looped = true,
loopLength = 1000
}
}
})
end, false)
RegisterCommand("ServerEntityClothing", function(src)
local position = GetEntityCoords(GetPlayerPed(src)) - vector3(0,0,1)
Bridge.ServerEntity.Create({
model = "mp_m_freemode_01",
coords = position,
entityType = "ped",
clothing = {
components = {
{ drawable = 0, texture = 0, component_id = 0 },
{ drawable = 0, texture = 0, component_id = 1 },
{ drawable = 19, texture = 0, component_id = 2 },
{ drawable = 6, texture = 0, component_id = 3 },
{ drawable = 0, texture = 0, component_id = 4 },
{ drawable = 0, texture = 0, component_id = 5 },
{ drawable = 0, texture = 0, component_id = 6 },
{ drawable = 0, texture = 0, component_id = 7 },
{ drawable = 23, texture = 0, component_id = 8 },
{ drawable = 0, texture = 0, component_id = 9 },
{ drawable = 0, texture = 0, component_id = 10 },
{ drawable = 4, texture = 2, component_id = 11 }
},
props = {
{ drawable = 27, prop_id = 0, texture = 0 },
{ drawable = 0, prop_id = 1, texture = 0 },
{ drawable = 0, prop_id = 2, texture = 0 },
{ drawable = 0, prop_id = 3, texture = 0 },
{ drawable = 0, prop_id = 4, texture = 0 },
{ drawable = 0, prop_id = 5, texture = 0 },
{ drawable = 0, prop_id = 6, texture = 0 },
{ drawable = 0, prop_id = 7, texture = 0 },
{ drawable = 0, prop_id = 8, texture = 0 },
{ drawable = 0, prop_id = 9, texture = 0 },
{ drawable = 0, prop_id = 10, texture = 0 },
{ drawable = 0, prop_id = 11, texture = 0 },
{ drawable = 0, prop_id = 12, texture = 0 },
{ drawable = 0, prop_id = 13, texture = 0 }
}
}
})
end, false)
-53
View File
@@ -1,53 +0,0 @@
Bridge = Bridge or exports['community_bridge']:Bridge()
RegisterCommand('testboxzone', function(source, args, rawCommand)
local playerPos = GetEntityCoords(PlayerPedId())
Bridge.Zones.Create("box", {
coords = vector3(playerPos.x, playerPos.y, playerPos.z),
size = vector3(2, 2, 6),
heading = 90,
debug = true,
onEnter = function(data)
print("Entered Zone: " .. data.id)
end,
onExit = function(data)
print("Exited Zone:")
end
})
end, false)
RegisterCommand('testpolyzone', function(source, args, rawCommand)
local playerPos = GetEntityCoords(PlayerPedId())
Bridge.Zones.Create("poly", {
points = {
vector3(playerPos.x - 1, playerPos.y - 1, playerPos.z),
vector3(playerPos.x + 1, playerPos.y - 1, playerPos.z),
vector3(playerPos.x + 1, playerPos.y + 1, playerPos.z),
vector3(playerPos.x - 1, playerPos.y + 1, playerPos.z)
},
size = vector3(1, 1, 1),
heading = 90,
debug = true,
onEnter = function(data)
print("Entered Zone: " .. data.id)
end,
onExit = function(data)
print("Exited Zone:")
end
})
end, false)
RegisterCommand('testspherezone', function(source, args, rawCommand)
local playerPos = GetEntityCoords(PlayerPedId())
Bridge.Zones.Create("sphere", {
coords = vector3(playerPos.x, playerPos.y, playerPos.z),
radius = 2.0,
debug = true,
onEnter = function(data)
print("Entered Zone: " .. data.id)
end,
onExit = function(data)
print("Exited Zone:")
end
})
end, false)
+1 -2
View File
@@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'
author 'The Order of the Sacred Framework'
name 'community_bridge'
description 'A Universal Bridge for Our Community, created by a group of contributors with a shared vision to enhance both user and developer experiences. This bridge connects various frameworks, inventories, target systems, notification systems, and more, fostering compatibility and seamless integration.'
version '0.12.1'
version '0.13.0'
shared_scripts {
'@ox_lib/init.lua',
@@ -62,7 +62,6 @@ client_scripts {
'modules/bossmenu/**/client.lua',
'modules/zones/**/client.lua',
'init.lua',
-- 'unit_tests/*.lua',
}
ui_page 'web/dist/index.html'
+17 -4
View File
@@ -80,9 +80,9 @@ local function UpdateEntity(_entityData)
entityData.oldCoords = entityData.oldCoords and vector3(entityData.oldCoords.x, entityData.oldCoords.y, entityData.oldCoords.z) or coords
local dist = #(coords - entityData.oldCoords)
if entityData.oldCoords and dist > 0.5 then
if entityData.spawned then
SetEntityCoords(entityData.spawned, coords.x, coords.y, coords.z, false, false, false, true)
end
-- if entityData.spawned then
-- SetEntityCoords(entityData.spawned, coords.x, coords.y, coords.z, false, false, false, false)
-- end
-- ClientEntity.UpdateCoords(entityData.id, entityData.coords)
if entityData.OnMove then
pcall(function (...)
@@ -167,7 +167,20 @@ end
function ClientEntity.Set(id, key, value)
local entityData = ClientEntity.Get(id)
if not entityData then return print(string.format("[ClientEntity] SetKey: Entity %s does not exist", id)) end
entityData[key] = value
local oldData = entityData[key]
if oldData == value then return end
if entityData.OnSet then
pcall(function (...)
return entityData.OnSet(entityData, key, value, oldData)
end)
end
if value then
entityData[key] = value
Behaviors.Trigger("OnSet", entityData, key, value, oldData)
return
end
Behaviors.Trigger("OnSet", entityData, key, value, oldData)
entityData[key] = nil
end
function ClientEntity.Get(id)
+2 -2
View File
@@ -51,7 +51,7 @@ function Behaviors.Trigger(actionName, clientEntityData, ...)
for property, behavior in pairs(Behaviors.All[invoking] or {}) do
local hasBehaviorArgs = Behaviors.Has(property, clientEntityData) -- this is everything that's contained inside the object's individual property
if hasBehaviorArgs and behavior[actionName] then
local success, result = pcall(behavior[actionName], clientEntityData, hasBehaviorArgs, ...)
local success, result = pcall(behavior[actionName], clientEntityData, ...)
if not success then
print(string.format("[ClientEntity] Behavior %s failed: %s", property, result))
end
@@ -60,7 +60,7 @@ function Behaviors.Trigger(actionName, clientEntityData, ...)
for property, behavior in pairs(Behaviors.All['community_bridge'] or {}) do
local hasBehaviorArgs = Behaviors.Has(property, clientEntityData) -- this is everything that's contained inside the object's individual property
if hasBehaviorArgs and behavior[actionName] and not Behaviors.All[invoking]?[actionName] then
local success, result = pcall(behavior[actionName], clientEntityData, hasBehaviorArgs, ...)
local success, result = pcall(behavior[actionName], clientEntityData, ...)
if not success then
print(string.format("[ClientEntity] Behavior %s failed: %s", property, result))
end
+15 -1
View File
@@ -11,7 +11,6 @@ local ParticlesBehaviors = {
color = vector3(255, 255, 255),
loopLength = 5000,
}
}
function ParticlesBehaviors.Start(entityData)
@@ -76,5 +75,20 @@ function ParticlesBehaviors.OnMove(entityData)
end
end
function ParticlesBehaviors.OnSet(entityData, key, value, oldValue)
if key ~= "particles" then return end
if oldValue then
ParticlesBehaviors.OnRemove(entityData)
end
if value then
if value.dict then -- single particle
entityData.particles = {value}
else
entityData.particles = value
end
ParticlesBehaviors.Start(entityData)
end
end
Bridge.Entity.RegisterBehavior("particles", ParticlesBehaviors)
return ParticlesBehaviors
-5
View File
@@ -11,9 +11,6 @@ function Require(modulePath, resourceName)
local id = resourceName .. ":" .. modulePath
if loadedModules[id] then
if BridgeSharedConfig.DebugLevel ~= 0 then
print("^2 Returning cached module [" .. id .. "] ^0")
end
return loadedModules[id]
end
@@ -45,8 +42,6 @@ cLib = {
Prints = Prints or Require("lib/utility/shared/prints.lua"),
Math = Math or Require("lib/utility/shared/math.lua"),
LA = LA or Require("lib/utility/shared/la.lua")
-- Zones = Poly or Require("lib/zones/shared/zones.lua"),
-- Action = Action or Require("lib/entities/shared/actions.lua"),
}
exports('cLib', cLib)
+10 -5
View File
@@ -1,7 +1,6 @@
Logs = Logs or {}
local BridgeServerConfig = BridgeServerConfig or Require('settings/serverConfig.lua')
local pendingLogs = {}
local sendTimer = nil
@@ -52,10 +51,10 @@ local function queueLogForDiscord(message)
end
local logHandlers = {
fivemerr = function(logData)
fivemerr = function(message)
local fivemerrData = {
level = 'info',
message = tostring(logData),
message = tostring(message),
resource = GetInvokingResource() or GetCurrentResourceName(),
}
@@ -69,6 +68,11 @@ local logHandlers = {
})
end,
fivemanage = function(message)
if GetResourceState("fmsdk") == "missing" then return print('^1Error:^0 fivemanage log system selected but fmsdk resource is missing.') end
exports.fmsdk:LogMessage('info', message)
end,
qb = function(message)
TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetInvokingResource(), 'green', message, false)
end,
@@ -94,9 +98,10 @@ Logs.Notify = function(src, url, image, message)
Logs.CreateLog(message)
end
Logs.CreateLog = function(logData)
Logs.CreateLog = function(message)
local handler = logHandlers[BridgeServerConfig.LogSystem]
if handler then handler(logData) end
if not handler then return end
handler(message)
end
exports('Logs', Logs)
+4 -7
View File
@@ -1,9 +1,8 @@
Particles = {}
Particle = {}
---@diagnostic disable: duplicate-set-field
Ids = Ids or Require("lib/utility/shared/ids.lua")
local point = Require("lib/points/client/points.lua")
---Loads a ptfx asset into memory.
---@param dict string
---@return boolean
@@ -26,7 +25,7 @@ end
--- @param scale number
--- @param color vector3
--- @param looped boolean
--- @param loopLength number|nil
--- @param removeAfter number|nil
--- @return number|nil ptfxHandle -- The handle of the particle effect, or nil if it failed to create.
function Particle.Play(dict, ptfx, pos, rot, scale, color, looped, removeAfter)
LoadPtfxAsset(dict)
@@ -93,8 +92,6 @@ function Particle.Stop(particle)
Particles[tostring(particle)] = nil
end
RegisterNetEvent("community_bridge:Client:Particle", function(data)
if not data then return end
Particle.Create(data)
@@ -110,12 +107,12 @@ end)
RegisterNetEvent("community_bridge:Client:ParticleRemove", function(id)
local particle = Particles[id]
if not particle then return end
Particle.Remove(Drawing[id])
Particle.Stop(id)
end)
RegisterNetEvent("community_bridge:Client:ParticleRemoveBulk", function(ids)
for _, id in pairs(ids) do
Particle.Remove(id)
Particle.Stop(id)
end
end)
+2 -1
View File
@@ -1,5 +1,6 @@
Placeable = Placeable or {}
Utility = Utility or Require("lib/utility/client/utility.lua")
if not lib then Require('init.lua', 'ox_lib') end
local activePlacementProp = nil
lib.locale()
@@ -31,7 +32,7 @@ Placeable.PlaceObject = function(object, distance, snapToGround, allowedMats, of
distance = tonumber(distance or 10.0 )
if activePlacementProp then return end
if not object then Prints.Error('placeable_object.no_prop_defined') end
if not object then print('^6 placeable_object.no_prop_defined ^0') end
local propObject = type(object) == 'string' and joaat(object) or object
local heading = 0.0
+3 -95
View File
@@ -12,7 +12,7 @@ RegisterKeyMapping('+rotate_left', locale('placeable_object.rotate_left'), 'keyb
RegisterKeyMapping('+rotate_right', locale('placeable_object.rotate_right'), 'keyboard', 'RIGHT')
RegisterKeyMapping('+scroll_up', locale('placeable_object.object_scroll_up'), 'mouse_wheel', 'IOM_WHEEL_UP')
RegisterKeyMapping('+scroll_down', locale('placeable_object.object_scroll_down'), 'mouse_wheel', 'IOM_WHEEL_DOWN')
RegisterKeyMapping('+depth_modifier', locale('placeable_object.depth_modifier'), 'keyboard', 'LCONTROL')
RegisterKeyMapping('+depth_modifier', locale('placeable_object.depth_modifier'), 'keyboard', 'LCONTROL')
local state = {
isPlacing = false,
@@ -50,7 +50,7 @@ local placementText = {
string.format(locale('placeable_object.rotate_clockwise'), Utility.GetCommandKey('+scroll_up')),
string.format(locale('placeable_object.rotate_counter_clockwise'), Utility.GetCommandKey('+scroll_down')),
string.format(locale('placeable_object.depth_modifier'), Utility.GetCommandKey('+depth_modifier'))
}
-- Command handlers for key mappings
@@ -134,63 +134,6 @@ local function getMouseWorldPos(depth)
return playerPos + normal * depth
end
-- local function isInBoundary(pos, boundary)
-- if not boundary then return true end
-- local x, y, z = table.unpack(pos)
-- -- Handle legacy min/max boundary format for backwards compatibility
-- if boundary.min and boundary.max then
-- local minX, minY, minZ = table.unpack(boundary.min)
-- local maxX, maxY, maxZ = table.unpack(boundary.max)
-- return x >= minX and x <= maxX and y >= minY and y <= maxY and z >= minZ and z <= maxZ
-- end
-- -- Handle list of points (polygon boundary)
-- if boundary.points and #boundary.points > 0 then
-- local points = boundary.points
-- local minZ = boundary.minZ or -math.huge
-- local maxZ = boundary.maxZ or math.huge
-- -- Check Z bounds first
-- if z < minZ or z > maxZ then
-- return false
-- end
-- -- Point-in-polygon test using ray casting algorithm (improved version)
-- local inside = false
-- local n = #points
-- for i = 1, n do
-- local j = i == n and 1 or i + 1 -- Next point (wrap around)
-- local xi, yi = points[i].x or points[i][1], points[i].y or points[i][2]
-- local xj, yj = points[j].x or points[j][1], points[j].y or points[j][2]
-- -- Ensure xi, yi, xj, yj are numbers
-- if not (xi and yi and xj and yj) then
-- goto continue
-- end
-- -- Ray casting test
-- if ((yi > y) ~= (yj > y)) then
-- -- Calculate intersection point
-- local intersect = (xj - xi) * (y - yi) / (yj - yi) + xi
-- if x < intersect then
-- inside = not inside
-- end
-- end
-- ::continue::
-- end
-- return inside
-- end
-- -- Fallback to true if boundary format is not recognized
-- return true
-- end
local function checkMaterialAndBoundary()
if not state.currentEntity then return true end
@@ -260,41 +203,6 @@ local function checkMaterialAndBoundaryDetailed()
return inBounds, inBounds, customCheckPassed
end
-- local function setupInstructionalButtons()
-- local buttons = {}
-- -- Common buttons
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = state.settings.config?.place_object?.name or 'Place Object:', keyIndex = state.settings.config?.place_object?.key or {223}, int = 5})
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = state.settings.config?.cancel_placement?.name or 'Cancel:', keyIndex = state.settings.config?.cancel_placement?.key or {25}, int = 4})
-- if state.mode == 'normal' then
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Rotate:', keyIndex = {241, 242}, int = 3})
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Depth:', keyIndex = {224}, int = 2})
-- if state.settings.allowVertical then
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Height:', keyIndex = {16, 17}, int = 1})
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Toggle Ground Snap:', keyIndex = {19}, int = 0})
-- end
-- if state.settings.allowMovement then
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Movement Mode:', keyIndex = {38}, int = 6})
-- end
-- elseif state.mode == 'movement' then
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Move:', keyIndex = {32, 33, 34, 35}, int = 3})
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Rotate:', keyIndex = {174, 175}, int = 2})
-- if state.settings.allowVertical then
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Up/Down:', keyIndex = {85, 48}, int = 1})
-- end
-- if state.settings.allowNormal then
-- table.insert(buttons, {type = "SET_DATA_SLOT", name = 'Normal Mode:', keyIndex = {38}, int = 0})
-- end
-- end
-- table.insert(buttons, {type = "DRAW_INSTRUCTIONAL_BUTTONS"})
-- table.insert(buttons, {type = "SET_BACKGROUND_COLOUR"})
-- -- return Scaleform.SetupInstructionalButtons(buttons)
-- return nil -- Scaleform disabled for now
-- end
local function drawBoundaryBox(boundary)
if not boundary then return end
@@ -567,7 +475,7 @@ local function placementLoop()
-- if not state.settings.allowVertical or state.snapToGround then
-- local groundZ, _z = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z + 50, false)
-- if groundZ then
-- end
-- end
coords = vector3(coords.x, coords.y, coords.z - 0.2) -- Adjust Z to ground level
+17 -21
View File
@@ -1,6 +1,5 @@
local GRIDE_SIZE_X = 8968.83 / 2
local GRIDE_SIZE_Y = 126200.40 / 2
local GRIDE_SIZE_X = 8968.83
local GRIDE_SIZE_Y = 126200.40
local CELL_SIZE = 500
local Grid = {}
@@ -8,6 +7,7 @@ Grid.Generated = false
local Grids = {}
Point = {}
Point.All = {}
Point.LastInside = nil
function Grid.Generate()
if Grid.Generated then return end
@@ -40,31 +40,27 @@ Points.Started = false
function Point.StartLoop()
if Points.Started then return end
Points.Started = true
CreateThread(function()
while Points.Started do
local playerPed = PlayerPedId()
if playerPed ~= -1 then
local coords = GetEntityCoords(playerPed)
local cell = Grid.GetCellByCoords(coords)
for _, point in pairs(cell or {}) do
if point.isEntity then
local entity = point.target
if DoesEntityExist(entity) then
local entityCoords = GetEntityCoords(entity)
local distance = #(coords - entityCoords)
if distance < point.distance then
if not point.inside then
point.inside = true
point.args = point?.onEnter(point, point.args) or point.args
end
elseif point.inside then
point.inside = false
point.args = point?.onExit(point, point.args) or point.args
end
if Point.LastInside ~= cell then
for _, point in pairs(Point.LastInside or {}) do
if point.inside then
point.inside = false
point.args = point?.onExit(point, point.args) or point.args
end
else
local distance = #(vector3(coords.x, coords.y, coords.z) - vector3(point.coords.x, point.coords.y, point.coords.z))
end
Point.LastInside = cell
end
for _, point in pairs(cell or {}) do
local entity = point.target
local targetCoords = point.isEntity and DoesEntityExist(entity) and GetEntityCoords(entity) or point.coords
if not point.disable and targetCoords then
targetCoords = vector3(targetCoords.x, targetCoords.y, targetCoords.z)
local distance = #(coords - targetCoords)
if distance < point.distance then
if not point.inside then
point.inside = true
+1 -2
View File
@@ -22,8 +22,7 @@ local function setupButton(scaleform, button)
N_0xe83a3e3557a56640(GetControlInstructionalButton(CONTROL_TYPE, keyCode, true))
end
else
ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(CONTROL_TYPE, button.keyIndex[1],
true))
ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(CONTROL_TYPE, button.keyIndex[1], true))
end
end
+29 -10
View File
@@ -1,6 +1,7 @@
Utility = Utility or {}
local blipIDs = {}
local spawnedPeds = {}
local spawnedProps = {}
Locales = Locales or Require('modules/locales/shared.lua')
Point = Point or Require('lib/points/client/points.lua')
@@ -39,10 +40,11 @@ end
---@return number|nil
function Utility.CreateProp(model, coords, heading, networked)
local loaded, hash = ensureModelLoaded(model)
if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
if not loaded then return nil, print("^6 Model was unable to load "..tostring(model).." ^0") end
local propEntity = CreateObject(hash, coords.x, coords.y, coords.z, networked, false, false)
SetEntityHeading(propEntity, heading)
SetModelAsNoLongerNeeded(hash)
spawnedProps[tostring(propEntity)] = true
return propEntity
end
@@ -62,7 +64,7 @@ end
---@return number|nil, table
function Utility.CreateVehicle(model, coords, heading, networked)
local loaded, hash = ensureModelLoaded(model)
if not loaded then return nil, {}, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
if not loaded then return nil, {}, print("^6 Model was unable to load "..tostring(model).." ^0") end
local vehicle = CreateVehicle(hash, coords.x, coords.y, coords.z, heading, networked, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetVehicleNeedsToBeHotwired(vehicle, false)
@@ -80,7 +82,7 @@ end
---@return number|nil
function Utility.CreatePed(model, coords, heading, networked, settings)
local loaded, hash = ensureModelLoaded(model)
if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
if not loaded then return nil, print("^6 Model was unable to load "..tostring(model).." ^0") end
local spawnedEntity = CreatePed(0, hash, coords.x, coords.y, coords.z, heading, networked, false)
SetModelAsNoLongerNeeded(hash)
spawnedPeds[tostring(spawnedEntity)] = true
@@ -124,8 +126,8 @@ function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, dis
SetBlipScale(blip, scale or 0.8)
SetBlipDisplay(blip, displayType or 2)
SetBlipAsShortRange(blip, shortRange)
AddTextEntry(label, label)
BeginTextCommandSetBlipName(label)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName(label)
EndTextCommandSetBlipName(blip)
blipIDs[tostring(blip)] = blip
return blip
@@ -172,7 +174,7 @@ end
---@param blip number
---@return boolean
function Utility.RemoveBlip(blip)
if not blipIDs[tostring(blip)] then return false, print("NO BLIP BY ID") end
if not blipIDs[tostring(blip)] then return false, print("^6 No blip to remove with matching ID ^0") end
RemoveBlip(blipIDs[tostring(blip)])
blipIDs[tostring(blip)] = nil
return true
@@ -211,6 +213,18 @@ function Utility.RemovePed(entity)
return true
end
---Remove a ped if it exists
---@param entity number
---@return boolean
function Utility.RemoveProp(entity)
if not spawnedProps[tostring(entity)] then return false end
spawnedProps[tostring(entity)] = nil
if not DoesEntityExist(entity) then return false end
SetEntityAsMissionEntity(entity, true, true)
DeleteEntity(entity)
return true
end
---Show a native input menu and return the result
---@param text string
---@param length number
@@ -290,9 +304,9 @@ local doingstuff = false
---@param text string The text to show
---@param coords table The coords to show the message at
---@return nil
function Utility.FloatingHelpText(text, coords)
function Utility.FloatingHelpText(text, coords)
AddTextEntry("community_bridge_"..text, text)
SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z)
SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z)
SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0)
BeginTextCommandDisplayHelp("community_bridge_"..text)
EndTextCommandDisplayHelp(2, false, false, 100)
@@ -313,7 +327,7 @@ function Utility.Draw3DHelpText(coords, text, scale)
end
local widthFactor = maxLineLen * 0.012 * scale
local height = 0.06 * scale * lineCount
-- Set text properties
SetTextScale(scale or 0.35, scale or 0.35)
SetTextFont(4)
@@ -323,7 +337,7 @@ function Utility.Draw3DHelpText(coords, text, scale)
SetTextCentre(true)
AddTextComponentString(text)
DrawText(x, y)
-- Draw background rectangle
DrawRect(x, y + height / 2, widthFactor + 0.015 + 0.006, height + 0.015 + 0.006, 10, 25, 47, 200)
DrawRect(x, y + height / 2, widthFactor + 0.015, height + 0.015, 17, 45, 78, 50)
@@ -613,6 +627,11 @@ AddEventHandler('onResourceStop', function(resource)
DeleteEntity(tonumber(ped))
end
end
for _, prop in pairs(spawnedProps) do
if prop and DoesEntityExist(tonumber(prop)) then
DeleteEntity(tonumber(prop))
end
end
end)
exports('Utility', Utility)
+1 -1
View File
@@ -17,7 +17,7 @@ Ids.CreateUniqueId = function(tbl, len, pattern) -- both optional
local charIndex = math.random(1, #pattern)
char = pattern:sub(charIndex, charIndex)
else
char = math.random(1, 2) == 1 and string.char(math.random(65, 90)) or math.random(0, 9) -- CAP letter and number
char = math.random(1, 2) == 1 and string.char(math.random(65, 90)) or string.format("%d", math.random(10) - 1) -- CAP letter and number
end
id = id .. char
end
+47 -16
View File
@@ -1,34 +1,65 @@
Prints = Prints or {}
local function printMessage(level, color, message)
if type(message) == 'table' then
message = json.encode(message)
local function handle(result, value)
if type(value) == 'function' then
return tostring(value)
end
print(color .. '[' .. level .. ']:', message)
return result
end
---This will print a colored message to the console with the designated prefix.
---@param message string
Prints.Info = function(message)
printMessage('INFO', '^5', message)
local function format(color, ...)
local data = {...}
for i = 1, #data do
if data[i] == nil then
data[i] = 'nil'
end
end
local newForm = {}
local jsonDecode = {sort_keys = true, indent = true, exception = handle}
for k, v in pairs(data) do
local formatted
if type(v) == 'table' then
formatted = json.encode(v, jsonDecode)
elseif type(v) == 'number' then
formatted = tostring(v)
elseif type(v) == 'boolean' then
formatted = tostring(v)
elseif type(v) == 'nil' then
formatted = 'nil Value'
elseif type(v) == 'string' then
formatted = v
elseif type(v) == 'function' then
formatted = tostring(v)
else
formatted = tostring(v)
end
table.insert(newForm, color .. formatted)
end
return table.concat(newForm, color .. ' \n ')
end
---This will print a colored message to the console with the designated prefix.
---@param message string
Prints.Warn = function(message)
printMessage('WARN', '^3', message)
Prints.Info = function(...)
print('^5 [INFO] '.. format('^5 ', ...))
end
---This will print a colored message to the console with the designated prefix.
---@param message string
Prints.Error = function(message)
printMessage('ERROR', '^1', message)
Prints.Warn = function(...)
print('^3 [WARN] '.. format('^3', ...))
end
---This will print a colored message to the console with the designated prefix.
---@param message string
Prints.Debug = function(message)
printMessage('DEBUG', '^2', message)
Prints.Error = function(...)
print('^1 [ERROR] '.. format('^1', ...))
end
return Prints
---This will print a colored message to the console with the designated prefix.
---@param message string
Prints.Debug = function(...)
print('^2 [DEBUG] '.. format('^2', ...))
end
return Prints
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Hoeveelheid Invoer",
"PurchaseAmount": "Aankoop Hoeveelheid",
"PurchasedItem": "Jy het gekoop ",
"PurchaseFailed": "Aankoop het misluk, inventaris vol",
"CurrencySymbol": "$ %s",
"Confirm": "Bevestig Aankoop",
"AreYouSure": "Is jy seker jy wil 'n %s koop",
@@ -14,12 +15,14 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Winkel Naam"
},
"UNITTEST": {
"UNITTESTA": "Ek is 'n %s %s",
"locale-unit-test": "Dit is 'n toets string"
"Notifications": {
"PlaceholderTitle": "Kennisgewing"
},
"clipboard": {
"copy": "Gekopieer na klipbord"
"copy": "Gekopieer na knipbord"
},
"input": {
"submit_text": "Indien"
},
"placeable_object": {
"no_prop_defined": "Jy het nie enige voorwerp gedefinieer om te plaas nie",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Kanselleer \n",
"object_scroll_up": "[%s] Draai regs \n",
"object_scroll_down": "[%s] Draai links \n",
"rotate_left": "Draai links",
"rotate_right": "Draai regs",
"rotate_clockwise": "[%s] Draai Kloksgewys \n",
"rotate_counter_clockwise": "[%s] Draai Antikloksgewys \n",
"depth_modifier": "[%s] Diepte Beheer Wysiging \n"
},
"target": {
"interact": "[E] Interaksie",
"title": "Opsies",
"description": "Geen Beskrywing"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "إدخال الكمية",
"PurchaseAmount": "كمية الشراء",
"PurchasedItem": "لقد قمت بشراء ",
"PurchaseFailed": "فشل الشراء، المخزون ممتلئ",
"CurrencySymbol": "$ %s",
"Confirm": "تأكيد الشراء",
"AreYouSure": "هل أنت متأكد أنك تريد شراء %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "اسم المتجر"
},
"UNITTEST": {
"UNITTESTA": "أنا %s %s",
"locale-unit-test": "هذا نص تجريبي"
"Notifications": {
"PlaceholderTitle": "إشعار"
},
"clipboard": {
"copy": "تم النسخ إلى الحافظة"
},
"input": {
"submit_text": "إرسال"
},
"placeable_object": {
"no_prop_defined": "لم تحدد أي كائن للوضع",
"cant_place_here": "لا يمكنك وضع هذا الكائن هنا",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] إلغاء \n",
"object_scroll_up": "[%s] استدارة يمين \n",
"object_scroll_down": "[%s] استدارة يسار \n",
"depth_modifier": "[%s] تعديل التحكم بالعمق \n"
"rotate_left": "استدارة يسار",
"rotate_right": "استدارة يمين",
"rotate_clockwise": "[%s] استدارة مع عقارب الساعة \n",
"rotate_counter_clockwise": "[%s] استدارة عكس عقارب الساعة \n",
"depth_modifier": "[%s] معدل التحكم في العمق \n"
},
"target": {
"interact": "[E] تفاعل",
"title": "خيارات",
"description": "لا يوجد وصف"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Zadání množství",
"PurchaseAmount": "Množství nákupu",
"PurchasedItem": "Zakoupili jste ",
"PurchaseFailed": "Nákup se nezdařil, inventář je plný",
"CurrencySymbol": "$ %s",
"Confirm": "Potvrdit nákup",
"AreYouSure": "Jste si jisti, že chcete koupit %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Název obchodu"
},
"UNITTEST": {
"UNITTESTA": "Jsem %s %s",
"locale-unit-test": "Toto je testovací řetězec"
"Notifications": {
"PlaceholderTitle": "Oznámení"
},
"clipboard": {
"copy": "Zkopírováno do schránky"
},
"input": {
"submit_text": "Odeslat"
},
"placeable_object": {
"no_prop_defined": "Nedefinovali jste žádný objekt k umístění",
"cant_place_here": "Tento objekt nemůžete umístit zde",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Zrušit \n",
"object_scroll_up": "[%s] Otočit doprava \n",
"object_scroll_down": "[%s] Otočit doleva \n",
"depth_modifier": "[%s] Modifikátor kontroly hloubky \n"
"rotate_left": "Otočit doleva",
"rotate_right": "Otočit doprava",
"rotate_clockwise": "[%s] Otočit ve směru hodinových ručiček \n",
"rotate_counter_clockwise": "[%s] Otočit proti směru hodinových ručiček \n",
"depth_modifier": "[%s] Modifikátor řízení hloubky \n"
},
"target": {
"interact": "[E] Interakce",
"title": "Možnosti",
"description": "Bez popisu"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Mængde input",
"PurchaseAmount": "Købs mængde",
"PurchasedItem": "Du har købt ",
"PurchaseFailed": "Køb mislykkedes, inventar fuldt",
"CurrencySymbol": "$ %s",
"Confirm": "Bekræft køb",
"AreYouSure": "Er du sikker på, at du vil købe en %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Butiksnavn"
},
"UNITTEST": {
"UNITTESTA": "Jeg er en %s %s",
"locale-unit-test": "Dette er en test streng"
"Notifications": {
"PlaceholderTitle": "Notifikation"
},
"clipboard": {
"copy": "Kopieret til udklipsholder"
},
"input": {
"submit_text": "Indsend"
},
"placeable_object": {
"no_prop_defined": "Du har ikke defineret noget objekt at placere",
"cant_place_here": "Du kan ikke placere dette objekt her",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Annuller \n",
"object_scroll_up": "[%s] Drej til højre \n",
"object_scroll_down": "[%s] Drej til venstre \n",
"depth_modifier": "[%s] Dybde kontrol modifier \n"
"rotate_left": "Drej til venstre",
"rotate_right": "Drej til højre",
"rotate_clockwise": "[%s] Rotér med uret \n",
"rotate_counter_clockwise": "[%s] Rotér mod uret \n",
"depth_modifier": "[%s] Dybdekontrol Modifier \n"
},
"target": {
"interact": "[E] Interager",
"title": "Muligheder",
"description": "Ingen beskrivelse"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Mengen-Eingabe",
"PurchaseAmount": "Kaufmenge",
"PurchasedItem": "Sie haben gekauft ",
"PurchaseFailed": "Kauf fehlgeschlagen, Inventar voll",
"CurrencySymbol": "$ %s",
"Confirm": "Kauf bestätigen",
"AreYouSure": "Sind Sie sicher, dass Sie einen %s kaufen möchten",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Geschäftsname"
},
"UNITTEST": {
"UNITTESTA": "Ich bin ein %s %s",
"locale-unit-test": "Dies ist ein Test-String"
"Notifications": {
"PlaceholderTitle": "Benachrichtigung"
},
"clipboard": {
"copy": "In die Zwischenablage kopiert"
},
"input": {
"submit_text": "Absenden"
},
"placeable_object": {
"no_prop_defined": "Sie haben kein Objekt zum Platzieren definiert",
"cant_place_here": "Sie können dieses Objekt hier nicht platzieren",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Abbrechen \n",
"object_scroll_up": "[%s] Nach rechts drehen \n",
"object_scroll_down": "[%s] Nach links drehen \n",
"rotate_left": "Nach links drehen",
"rotate_right": "Nach rechts drehen",
"rotate_clockwise": "[%s] Im Uhrzeigersinn drehen \n",
"rotate_counter_clockwise": "[%s] Gegen den Uhrzeigersinn drehen \n",
"depth_modifier": "[%s] Tiefenkontrolle Modifikator \n"
},
"target": {
"interact": "[E] Interagieren",
"title": "Optionen",
"description": "Keine Beschreibung"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Εισαγωγή ποσότητας",
"PurchaseAmount": "Ποσότητα αγοράς",
"PurchasedItem": "Αγοράσατε ",
"PurchaseFailed": "Η αγορά απέτυχε, το αποθέμα είναι γεμάτο",
"CurrencySymbol": "$ %s",
"Confirm": "Επιβεβαίωση αγοράς",
"AreYouSure": "Είστε βέβαιοι ότι θέλετε να αγοράσετε ένα %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Όνομα καταστήματος"
},
"UNITTEST": {
"UNITTESTA": "Είμαι ένας %s %s",
"locale-unit-test": "Αυτό είναι ένα δοκιμαστικό κείμενο"
"Notifications": {
"PlaceholderTitle": "Ειδοποίηση"
},
"clipboard": {
"copy": "Αντιγράφηκε στο clipboard"
},
"input": {
"submit_text": "Υποβολή"
},
"placeable_object": {
"no_prop_defined": "Δεν ορίσατε κανένα αντικείμενο για τοποθέτηση",
"cant_place_here": "Δεν μπορείτε να τοποθετήσετε αυτό το αντικείμενο εδώ",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Ακύρωση \n",
"object_scroll_up": "[%s] Περιστροφή δεξιά \n",
"object_scroll_down": "[%s] Περιστροφή αριστερά \n",
"rotate_left": "Περιστροφή αριστερά",
"rotate_right": "Περιστροφή δεξιά",
"rotate_clockwise": "[%s] Περιστροφή δεξιόστροφα \n",
"rotate_counter_clockwise": "[%s] Περιστροφή αριστερόστροφα \n",
"depth_modifier": "[%s] Τροποποιητής ελέγχου βάθους \n"
},
"target": {
"interact": "[E] Αλληλεπίδραση",
"title": "Επιλογές",
"description": "Χωρίς περιγραφή"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Amount o' Booty",
"PurchaseAmount": "Plunder Quantity",
"PurchasedItem": "Ye Have Plundered ",
"PurchaseFailed": "Plunder failed, yer hold be full",
"CurrencySymbol": "$ %s",
"Confirm": "Aye, Plunder!",
"AreYouSure": "Be ye sure ye want to plunder a %s?",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Pirate's Emporium"
},
"UNITTEST": {
"UNITTESTA": "I be a %s %s",
"locale-unit-test": "This be a test string, arrr!"
"Notifications": {
"PlaceholderTitle": "Parley Notice"
},
"clipboard": {
"copy": "Copied to ye clipboard, matey!"
},
"input": {
"submit_text": "Send forth!"
},
"placeable_object": {
"no_prop_defined": "Ye didn't pick any booty to place, ye scallywag!",
"cant_place_here": "Ye can't be plunderin' here!",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Abandon Ship! \n",
"object_scroll_up": "[%s] Turn starboard \n",
"object_scroll_down": "[%s] Turn port \n",
"rotate_left": "Turn Port",
"rotate_right": "Turn Starboard",
"rotate_clockwise": "[%s] Spin Clockwise, arrr! \n",
"rotate_counter_clockwise": "[%s] Spin Counter-Clockwise, matey! \n",
"depth_modifier": "[%s] Depth Control, savvy? \n"
},
"target": {
"interact": "[E] Parley",
"title": "Choices, matey",
"description": "No tale to tell"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Amount Input",
"PurchaseAmount": "Purchase Quantity",
"PurchasedItem": "You Have Purchased ",
"PurchaseFailed": "Purchase failed, inventory full",
"CurrencySymbol": "$ %s",
"Confirm": "Confirm Purchase",
"AreYouSure": "Are you sure you want to purchase a %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Shop Name"
},
"UNITTEST": {
"UNITTESTA": "I'm a %s %s",
"locale-unit-test": "This is a test string"
"Notifications": {
"PlaceholderTitle": "Notification"
},
"clipboard": {
"copy": "Copied to clipboard"
},
"input": {
"submit_text": "Submit"
},
"placeable_object": {
"no_prop_defined": "You didn't define any object to place",
"cant_place_here": "You can't place this object here",
@@ -30,8 +33,17 @@
"place_object_scroll_down": "[Scroll Down] Turn left \n",
"object_place": "[%s] Place \n",
"object_cancel": "[%s] Cancel \n",
"object_scroll_up": "[%s] Turn right \n",
"object_scroll_down": "[%s] Turn left \n",
"rotate_left": "Rotate Left",
"rotate_right": "Rotate Right",
"rotate_clockwise": "[%s] Rotate Clockwise \n",
"rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n",
"depth_modifier": "[%s] Depth Control Modifier \n"
},
"target": {
"interact": "[E] Interact",
"title": "Options",
"description": "No Description"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Entrada de cantidad",
"PurchaseAmount": "Cantidad de compra",
"PurchasedItem": "Has comprado ",
"PurchaseFailed": "Compra fallida, inventario lleno",
"CurrencySymbol": "$ %s",
"Confirm": "Confirmar compra",
"AreYouSure": "¿Estás seguro de que quieres comprar un %s?",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Nombre de la tienda"
},
"UNITTEST": {
"UNITTESTA": "Soy un %s %s",
"locale-unit-test": "Esta es una cadena de prueba"
"Notifications": {
"PlaceholderTitle": "Notificación"
},
"clipboard": {
"copy": "Copiado al portapapeles"
},
"input": {
"submit_text": "Enviar"
},
"placeable_object": {
"no_prop_defined": "No has definido ningún objeto para colocar",
"cant_place_here": "No puedes colocar este objeto aquí",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Cancelar \n",
"object_scroll_up": "[%s] Girar a la derecha \n",
"object_scroll_down": "[%s] Girar a la izquierda \n",
"rotate_left": "Girar a la izquierda",
"rotate_right": "Girar a la derecha",
"rotate_clockwise": "[%s] Rotar en sentido horario \n",
"rotate_counter_clockwise": "[%s] Rotar en sentido antihorario \n",
"depth_modifier": "[%s] Modificador de control de profundidad \n"
},
"target": {
"interact": "[E] Interactuar",
"title": "Opciones",
"description": "Sin descripción"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Määrän syöttö",
"PurchaseAmount": "Ostomäärä",
"PurchasedItem": "Olet ostanut ",
"PurchaseFailed": "Osto epäonnistui, varasto täynnä",
"CurrencySymbol": "$ %s",
"Confirm": "Vahvista osto",
"AreYouSure": "Oletko varma, että haluat ostaa %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Kaupan nimi"
},
"UNITTEST": {
"UNITTESTA": "Olen %s %s",
"locale-unit-test": "Tämä on testimerkki"
"Notifications": {
"PlaceholderTitle": "Ilmoitus"
},
"clipboard": {
"copy": "Kopioitu leikepöydälle"
},
"input": {
"submit_text": "Lähetä"
},
"placeable_object": {
"no_prop_defined": "Et ole määrittänyt mitään objektia sijoitettavaksi",
"cant_place_here": "Et voi sijoittaa tätä objektia tähän",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Peruuta \n",
"object_scroll_up": "[%s] Käännä oikealle \n",
"object_scroll_down": "[%s] Käännä vasemmalle \n",
"rotate_left": "Kierrä vasemmalle",
"rotate_right": "Kierrä oikealle",
"rotate_clockwise": "[%s] Kierrä myötäpäivään \n",
"rotate_counter_clockwise": "[%s] Kierrä vastapäivään \n",
"depth_modifier": "[%s] Syvyyshallinnan muokkaaja \n"
},
"target": {
"interact": "[E] Vuorovaikutus",
"title": "Vaihtoehdot",
"description": "Ei kuvausta"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Saisie de quantité",
"PurchaseAmount": "Quantité d'achat",
"PurchasedItem": "Vous avez acheté ",
"PurchaseFailed": "Achat échoué, inventaire plein",
"CurrencySymbol": "$ %s",
"Confirm": "Confirmer l'achat",
"AreYouSure": "Êtes-vous sûr de vouloir acheter un %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Nom du magasin"
},
"UNITTEST": {
"UNITTESTA": "Je suis un %s %s",
"locale-unit-test": "Ceci est une chaîne de test"
"Notifications": {
"PlaceholderTitle": "Notification"
},
"clipboard": {
"copy": "Copié dans le presse-papiers"
},
"input": {
"submit_text": "Soumettre"
},
"placeable_object": {
"no_prop_defined": "Vous n'avez défini aucun objet à placer",
"cant_place_here": "Vous ne pouvez pas placer cet objet ici",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Annuler \n",
"object_scroll_up": "[%s] Tourner à droite \n",
"object_scroll_down": "[%s] Tourner à gauche \n",
"rotate_left": "Pivoter à gauche",
"rotate_right": "Pivoter à droite",
"rotate_clockwise": "[%s] Rotation horaire \n",
"rotate_counter_clockwise": "[%s] Rotation antihoraire \n",
"depth_modifier": "[%s] Modificateur de contrôle de profondeur \n"
},
"target": {
"interact": "[E] Interagir",
"title": "Options",
"description": "Aucune description"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "मात्रा इनपुट",
"PurchaseAmount": "खरीदारी की मात्रा",
"PurchasedItem": "आपने खरीदा है ",
"PurchaseFailed": "खरीदारी विफल, इन्वेंटरी भरी हुई है",
"CurrencySymbol": "$ %s",
"Confirm": "खरीदारी की पुष्टि करें",
"AreYouSure": "क्या आप वाकई %s खरीदना चाहते हैं",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "दुकान का नाम"
},
"UNITTEST": {
"UNITTESTA": "मैं एक %s %s हूं",
"locale-unit-test": "यह एक परीक्षण स्ट्रिंग है"
"Notifications": {
"PlaceholderTitle": "सूचना"
},
"clipboard": {
"copy": "क्लिपबोर्ड पर कॉपी किया गया"
},
"input": {
"submit_text": "प्रस्तुत करें"
},
"placeable_object": {
"no_prop_defined": "आपने रखने के लिए कोई वस्तु परिभाषित नहीं की है",
"cant_place_here": "आप इस वस्तु को यहां नहीं रख सकते",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] रद्द करें \n",
"object_scroll_up": "[%s] दाएं मुड़ें \n",
"object_scroll_down": "[%s] बाएं मुड़ें \n",
"rotate_left": "बाएं मुड़ें",
"rotate_right": "दाएं मुड़ें",
"rotate_clockwise": "[%s] घड़ी की दिशा में घुमाएं \n",
"rotate_counter_clockwise": "[%s] घड़ी की विपरीत दिशा में घुमाएं \n",
"depth_modifier": "[%s] गहराई नियंत्रण संशोधक \n"
},
"target": {
"interact": "[E] बातचीत करें",
"title": "विकल्प",
"description": "कोई विवरण नहीं"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Unos količine",
"PurchaseAmount": "Količina kupnje",
"PurchasedItem": "Kupili ste ",
"PurchaseFailed": "Kupnja nije uspjela, inventar pun",
"CurrencySymbol": "%s kn",
"Confirm": "Potvrdi kupnju",
"AreYouSure": "Jeste li sigurni da želite kupiti %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Naziv trgovine"
},
"UNITTEST": {
"UNITTESTA": "Ja sam %s %s",
"locale-unit-test": "Ovo je test string"
"Notifications": {
"PlaceholderTitle": "Obavijest"
},
"clipboard": {
"copy": "Kopirano u međuspremnik"
},
"input": {
"submit_text": "Pošalji"
},
"placeable_object": {
"no_prop_defined": "Niste definirali nijedan objekt za postavljanje",
"cant_place_here": "Ne možete postaviti ovaj objekt ovdje",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Otkažи \n",
"object_scroll_up": "[%s] Okreni desno \n",
"object_scroll_down": "[%s] Okreni lijevo \n",
"rotate_left": "Okreni lijevo",
"rotate_right": "Okreni desno",
"rotate_clockwise": "[%s] Rotiraj u smjeru kazaljke na satu \n",
"rotate_counter_clockwise": "[%s] Rotiraj suprotno od kazaljke na satu \n",
"depth_modifier": "[%s] Modifikator kontrole dubine \n"
},
"target": {
"interact": "[E] Interakcija",
"title": "Opcije",
"description": "Nema opisa"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Mennyiség bevitel",
"PurchaseAmount": "Vásárlási mennyiség",
"PurchasedItem": "Megvásároltad ",
"PurchaseFailed": "Vásárlás sikertelen, leltár tele",
"CurrencySymbol": "$ %s",
"Confirm": "Vásárlás megerősítése",
"AreYouSure": "Biztosan meg akarsz vásárolni egy %s-t",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Bolt neve"
},
"UNITTEST": {
"UNITTESTA": "Én egy %s %s vagyok",
"locale-unit-test": "Ez egy teszt string"
"Notifications": {
"PlaceholderTitle": "Értesítés"
},
"clipboard": {
"copy": "Vágólapra másolva"
},
"input": {
"submit_text": "Elküld"
},
"placeable_object": {
"no_prop_defined": "Nem definiáltál semmilyen objektumot elhelyezésre",
"cant_place_here": "Nem helyezheted el ezt az objektumot itt",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Mégse \n",
"object_scroll_up": "[%s] Jobbra fordítás \n",
"object_scroll_down": "[%s] Balra fordítás \n",
"rotate_left": "Balra fordítás",
"rotate_right": "Jobbra fordítás",
"rotate_clockwise": "[%s] Forgatás óramutató járásával megegyezően \n",
"rotate_counter_clockwise": "[%s] Forgatás óramutató járásával ellentétesen \n",
"depth_modifier": "[%s] Mélység vezérlő módosító \n"
},
"target": {
"interact": "[E] Interakció",
"title": "Lehetőségek",
"description": "Nincs leírás"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Inserimento quantità",
"PurchaseAmount": "Quantità di acquisto",
"PurchasedItem": "Hai acquistato ",
"PurchaseFailed": "Acquisto fallito, inventario pieno",
"CurrencySymbol": "$ %s",
"Confirm": "Conferma acquisto",
"AreYouSure": "Sei sicuro di voler acquistare un %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Nome negozio"
},
"UNITTEST": {
"UNITTESTA": "Sono un %s %s",
"locale-unit-test": "Questa è una stringa di test"
"Notifications": {
"PlaceholderTitle": "Notifica"
},
"clipboard": {
"copy": "Copiato negli appunti"
},
"input": {
"submit_text": "Invia"
},
"placeable_object": {
"no_prop_defined": "Non hai definito alcun oggetto da posizionare",
"cant_place_here": "Non puoi posizionare questo oggetto qui",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Annulla \n",
"object_scroll_up": "[%s] Ruota a destra \n",
"object_scroll_down": "[%s] Ruota a sinistra \n",
"depth_modifier": "[%s] Modificatore controllo profondità \n"
"rotate_left": "Ruota a sinistra",
"rotate_right": "Ruota a destra",
"rotate_clockwise": "[%s] Ruota in senso orario \n",
"rotate_counter_clockwise": "[%s] Ruota in senso antiorario \n",
"depth_modifier": "[%s] Modificatore di controllo della profondità \n"
},
"target": {
"interact": "[E] Interagisci",
"title": "Opzioni",
"description": "Nessuna descrizione"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "数量入力",
"PurchaseAmount": "購入数量",
"PurchasedItem": "購入しました ",
"PurchaseFailed": "購入に失敗しました、インベントリがいっぱいです",
"CurrencySymbol": "$ %s",
"Confirm": "購入を確認",
"AreYouSure": "%sを購入してもよろしいですか",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "店舗名"
},
"UNITTEST": {
"UNITTESTA": "私は%s %sです",
"locale-unit-test": "これはテスト文字列です"
"Notifications": {
"PlaceholderTitle": "通知"
},
"clipboard": {
"copy": "クリップボードにコピーされました"
},
"input": {
"submit_text": "送信"
},
"placeable_object": {
"no_prop_defined": "配置するオブジェクトが定義されていません",
"cant_place_here": "このオブジェクトをここに配置することはできません",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] キャンセル \n",
"object_scroll_up": "[%s] 右回転 \n",
"object_scroll_down": "[%s] 左回転 \n",
"depth_modifier": "[%s] 深度制御修飾子 \n"
"rotate_left": "左回転",
"rotate_right": "右回転",
"rotate_clockwise": "[%s] 時計回りに回転 \n",
"rotate_counter_clockwise": "[%s] 反時計回りに回転 \n",
"depth_modifier": "[%s] 深さコントロール修飾子 \n"
},
"target": {
"interact": "[E] 対話",
"title": "オプション",
"description": "説明なし"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "수량 입력",
"PurchaseAmount": "구매 수량",
"PurchasedItem": "구매했습니다 ",
"PurchaseFailed": "구매 실패, 인벤토리가 가득 찼습니다",
"CurrencySymbol": "$ %s",
"Confirm": "구매 확인",
"AreYouSure": "%s를 구매하시겠습니까",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "상점 이름"
},
"UNITTEST": {
"UNITTESTA": "나는 %s %s입니다",
"locale-unit-test": "이것은 테스트 문자열입니다"
"Notifications": {
"PlaceholderTitle": "알림"
},
"clipboard": {
"copy": "클립보드에 복사됨"
},
"input": {
"submit_text": "제출"
},
"placeable_object": {
"no_prop_defined": "배치할 객체를 정의하지 않았습니다",
"cant_place_here": "이 객체를 여기에 배치할 수 없습니다",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] 취소 \n",
"object_scroll_up": "[%s] 오른쪽으로 회전 \n",
"object_scroll_down": "[%s] 왼쪽으로 회전 \n",
"rotate_left": "왼쪽으로 회전",
"rotate_right": "오른쪽으로 회전",
"rotate_clockwise": "[%s] 시계 방향으로 회전 \n",
"rotate_counter_clockwise": "[%s] 시계 반대 방향으로 회전 \n",
"depth_modifier": "[%s] 깊이 제어 수정자 \n"
},
"target": {
"interact": "[E] 상호작용",
"title": "옵션",
"description": "설명 없음"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Kiekio įvestis",
"PurchaseAmount": "Pirkimo kiekis",
"PurchasedItem": "Jūs nusipirkote ",
"PurchaseFailed": "Pirkimas nepavyko, inventorius pilnas",
"CurrencySymbol": "%s €",
"Confirm": "Patvirtinti pirkimą",
"AreYouSure": "Ar tikrai norite nusipirkti %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Parduotuvės pavadinimas"
},
"UNITTEST": {
"UNITTESTA": "Aš esu %s %s",
"locale-unit-test": "Tai yra testavimo eilutė"
"Notifications": {
"PlaceholderTitle": "Pranešimas"
},
"clipboard": {
"copy": "Nukopijuota į iškarpinę"
},
"input": {
"submit_text": "Pateikti"
},
"placeable_object": {
"no_prop_defined": "Nenurodėte jokio objekto, kurį reikia pastatyti",
"cant_place_here": "Čia negalite pastatyti šio objekto",
@@ -30,8 +33,17 @@
"place_object_scroll_down": "[Slinkti žemyn] Pasukti kairėn \n",
"object_place": "[%s] Pastatyti \n",
"object_cancel": "[%s] Atšaukti \n",
"object_scroll_up": "[%s] Pasukti dešinėn \n",
"object_scroll_down": "[%s] Pasukti kairėn \n",
"rotate_left": "Pasukti kairėn",
"rotate_right": "Pasukti dešinėn",
"rotate_clockwise": "[%s] Sukti pagal laikrodžio rodyklę \n",
"rotate_counter_clockwise": "[%s] Sukti prieš laikrodžio rodyklę \n",
"depth_modifier": "[%s] Gylio kontrolės modifikatorius \n"
},
"target": {
"interact": "[E] Sąveika",
"title": "Parinktys",
"description": "Nėra aprašymo"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Hoeveelheid invoer",
"PurchaseAmount": "Aankoop hoeveelheid",
"PurchasedItem": "Je hebt gekocht ",
"PurchaseFailed": "Aankoop mislukt, inventaris vol",
"CurrencySymbol": "$ %s",
"Confirm": "Aankoop bevestigen",
"AreYouSure": "Weet je zeker dat je een %s wilt kopen",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Winkelnaam"
},
"UNITTEST": {
"UNITTESTA": "Ik ben een %s %s",
"locale-unit-test": "Dit is een test string"
"Notifications": {
"PlaceholderTitle": "Melding"
},
"clipboard": {
"copy": "Gekopieerd naar klembord"
},
"input": {
"submit_text": "Indienen"
},
"placeable_object": {
"no_prop_defined": "Je hebt geen object gedefinieerd om te plaatsen",
"cant_place_here": "Je kunt dit object hier niet plaatsen",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Annuleren \n",
"object_scroll_up": "[%s] Rechtsom draaien \n",
"object_scroll_down": "[%s] Linksom draaien \n",
"rotate_left": "Linksom draaien",
"rotate_right": "Rechtsom draaien",
"rotate_clockwise": "[%s] Draai met de klok mee \n",
"rotate_counter_clockwise": "[%s] Draai tegen de klok in \n",
"depth_modifier": "[%s] Diepte controle modifier \n"
},
"target": {
"interact": "[E] Interactie",
"title": "Opties",
"description": "Geen beschrijving"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Mengde inndata",
"PurchaseAmount": "Kjøpsmengde",
"PurchasedItem": "Du har kjøpt ",
"PurchaseFailed": "Kjøp mislyktes, inventar fullt",
"CurrencySymbol": "$ %s",
"Confirm": "Bekreft kjøp",
"AreYouSure": "Er du sikker på at du vil kjøpe en %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Butikknavn"
},
"UNITTEST": {
"UNITTESTA": "Jeg er en %s %s",
"locale-unit-test": "Dette er en teststreng"
"Notifications": {
"PlaceholderTitle": "Varsling"
},
"clipboard": {
"copy": "Kopiert til utklippstavle"
},
"input": {
"submit_text": "Send inn"
},
"placeable_object": {
"no_prop_defined": "Du har ikke definert noe objekt å plassere",
"cant_place_here": "Du kan ikke plassere dette objektet her",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Avbryt \n",
"object_scroll_up": "[%s] Snu til høyre \n",
"object_scroll_down": "[%s] Snu til venstre \n",
"depth_modifier": "[%s] Dybdekontroll modifikator \n"
"rotate_left": "Roter til venstre",
"rotate_right": "Roter til høyre",
"rotate_clockwise": "[%s] Roter med klokken \n",
"rotate_counter_clockwise": "[%s] Roter mot klokken \n",
"depth_modifier": "[%s] Dybdekontroll Modifikator \n"
},
"target": {
"interact": "[E] Samhandle",
"title": "Alternativer",
"description": "Ingen beskrivelse"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Wprowadzanie ilości",
"PurchaseAmount": "Ilość zakupu",
"PurchasedItem": "Kupiłeś ",
"PurchaseFailed": "Zakup nieudany, ekwipunek pełny",
"CurrencySymbol": "$ %s",
"Confirm": "Potwierdź zakup",
"AreYouSure": "Czy na pewno chcesz kupić %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Nazwa sklepu"
},
"UNITTEST": {
"UNITTESTA": "Jestem %s %s",
"locale-unit-test": "To jest ciąg testowy"
"Notifications": {
"PlaceholderTitle": "Powiadomienie"
},
"clipboard": {
"copy": "Skopiowano do schowka"
},
"input": {
"submit_text": "Wyślij"
},
"placeable_object": {
"no_prop_defined": "Nie zdefiniowałeś żadnego obiektu do umieszczenia",
"cant_place_here": "Nie możesz umieścić tego obiektu tutaj",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Anuluj \n",
"object_scroll_up": "[%s] Obróć w prawo \n",
"object_scroll_down": "[%s] Obróć w lewo \n",
"rotate_left": "Obróć w lewo",
"rotate_right": "Obróć w prawo",
"rotate_clockwise": "[%s] Obróć zgodnie z ruchem wskazówek zegara \n",
"rotate_counter_clockwise": "[%s] Obróć przeciwnie do ruchu wskazówek zegara \n",
"depth_modifier": "[%s] Modyfikator kontroli głębokości \n"
},
"target": {
"interact": "[E] Interakcja",
"title": "Opcje",
"description": "Brak opisu"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Entrada de quantidade",
"PurchaseAmount": "Quantidade de compra",
"PurchasedItem": "Você comprou ",
"PurchaseFailed": "Compra falhou, inventário cheio",
"CurrencySymbol": "$ %s",
"Confirm": "Confirmar compra",
"AreYouSure": "Você tem certeza que quer comprar um %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Nome da loja"
},
"UNITTEST": {
"UNITTESTA": "Eu sou um %s %s",
"locale-unit-test": "Esta é uma string de teste"
"Notifications": {
"PlaceholderTitle": "Notificação"
},
"clipboard": {
"copy": "Copiado para a área de transferência"
},
"input": {
"submit_text": "Enviar"
},
"placeable_object": {
"no_prop_defined": "Você não definiu nenhum objeto para colocar",
"cant_place_here": "Você não pode colocar este objeto aqui",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Cancelar \n",
"object_scroll_up": "[%s] Girar para a direita \n",
"object_scroll_down": "[%s] Girar para a esquerda \n",
"rotate_left": "Girar para a esquerda",
"rotate_right": "Girar para a direita",
"rotate_clockwise": "[%s] Girar no sentido horário \n",
"rotate_counter_clockwise": "[%s] Girar no sentido anti-horário \n",
"depth_modifier": "[%s] Modificador de controle de profundidade \n"
},
"target": {
"interact": "[E] Interagir",
"title": "Opções",
"description": "Sem descrição"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Introducere cantitate",
"PurchaseAmount": "Cantitate de cumpărare",
"PurchasedItem": "Ai cumpărat ",
"PurchaseFailed": "Achiziție eșuată, inventar plin",
"CurrencySymbol": "$ %s",
"Confirm": "Confirmă cumpărarea",
"AreYouSure": "Ești sigur că vrei să cumperi un %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Numele magazinului"
},
"UNITTEST": {
"UNITTESTA": "Sunt un %s %s",
"locale-unit-test": "Acesta este un șir de test"
"Notifications": {
"PlaceholderTitle": "Notificare"
},
"clipboard": {
"copy": "Copiat în clipboard"
},
"input": {
"submit_text": "Trimit"
},
"placeable_object": {
"no_prop_defined": "Nu ai definit niciun obiect de plasat",
"cant_place_here": "Nu poți plasa acest obiect aici",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Anulează \n",
"object_scroll_up": "[%s] Rotește la dreapta \n",
"object_scroll_down": "[%s] Rotește la stânga \n",
"depth_modifier": "[%s] Modificator control adâncime \n"
"rotate_left": "Rotește la stânga",
"rotate_right": "Rotește la dreapta",
"rotate_clockwise": "[%s] Rotește în sensul acelor de ceasornic \n",
"rotate_counter_clockwise": "[%s] Rotește în sens invers acelor de ceasornic \n",
"depth_modifier": "[%s] Modificator de control al adâncimii \n"
},
"target": {
"interact": "[E] Interacționează",
"title": "Opțiuni",
"description": "Fără descriere"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "Ввод количества",
"PurchaseAmount": "Количество покупки",
"PurchasedItem": "Вы купили ",
"PurchaseFailed": "Покупка не удалась, инвентарь полон",
"CurrencySymbol": "$ %s",
"Confirm": "Подтвердить покупку",
"AreYouSure": "Вы уверены, что хотите купить %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Название магазина"
},
"UNITTEST": {
"UNITTESTA": "Я %s %s",
"locale-unit-test": "Это тестовая строка"
"Notifications": {
"PlaceholderTitle": "Уведомление"
},
"clipboard": {
"copy": "Скопировано в буфер обмена"
},
"input": {
"submit_text": "Отправить"
},
"placeable_object": {
"no_prop_defined": "Вы не определили никакого объекта для размещения",
"cant_place_here": "Вы не можете разместить этот объект здесь",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Отменить \n",
"object_scroll_up": "[%s] Повернуть вправо \n",
"object_scroll_down": "[%s] Повернуть влево \n",
"rotate_left": "Повернуть влево",
"rotate_right": "Повернуть вправо",
"rotate_clockwise": "[%s] Вращать по часовой стрелке \n",
"rotate_counter_clockwise": "[%s] Вращать против часовой стрелки \n",
"depth_modifier": "[%s] Модификатор контроля глубины \n"
},
"target": {
"interact": "[E] Взаимодействовать",
"title": "Опции",
"description": "Нет описания"
}
}
+16 -4
View File
@@ -4,6 +4,7 @@
"Input": "Mängd inmatning",
"PurchaseAmount": "Inköpsmängd",
"PurchasedItem": "Du har köpt ",
"PurchaseFailed": "Köp misslyckades, inventarium fullt",
"CurrencySymbol": "$ %s",
"Confirm": "Bekräfta köp",
"AreYouSure": "Är du säker på att du vill köpa en %s",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Butiksnamn"
},
"UNITTEST": {
"UNITTESTA": "Jag är en %s %s",
"locale-unit-test": "Detta är en teststräng"
"Notifications": {
"PlaceholderTitle": "Avisering"
},
"clipboard": {
"copy": "Kopierat till urklipp"
},
"input": {
"submit_text": "Skicka"
},
"placeable_object": {
"no_prop_defined": "Du har inte definierat något objekt att placera",
"cant_place_here": "Du kan inte placera detta objekt här",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] Avbryt \n",
"object_scroll_up": "[%s] Vrid höger \n",
"object_scroll_down": "[%s] Vrid vänster \n",
"depth_modifier": "[%s] Djupkontroll modifierare \n"
"rotate_left": "Rotera vänster",
"rotate_right": "Rotera höger",
"rotate_clockwise": "[%s] Rotera medurs \n",
"rotate_counter_clockwise": "[%s] Rotera moturs \n",
"depth_modifier": "[%s] Djupkontroll Modifierare \n"
},
"target": {
"interact": "[E] Interagera",
"title": "Alternativ",
"description": "Ingen beskrivning"
}
}
+17 -7
View File
@@ -4,6 +4,7 @@
"Input": "ป้อนจำนวน",
"PurchaseAmount": "จำนวนที่ซื้อ",
"PurchasedItem": "คุณได้ซื้อ ",
"PurchaseFailed": "การซื้อล้มเหลว คลังเต็ม",
"CurrencySymbol": "$ %s",
"Confirm": "ยืนยันการซื้อ",
"AreYouSure": "คุณแน่ใจหรือว่าต้องการซื้อ %s",
@@ -13,14 +14,14 @@
"CashIcon": "fa-solid fa-money-bill-wave",
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "ชื่อร้าน"
},
"UNITTEST": {
"UNITTESTA": "ฉันเป็น %s %s",
"locale-unit-test": "นี่คือสตริงทดสอบ"
},
"clipboard": {
}, "Notifications": {
"PlaceholderTitle": "การแจ้งเตือน"
}, "clipboard": {
"copy": "คัดลอกไปยังคลิปบอร์ด"
},
"input": {
"submit_text": "ส่ง"
},
"placeable_object": {
"no_prop_defined": "คุณไม่ได้กำหนดวัตถุใดๆ เพื่อวาง",
"cant_place_here": "คุณไม่สามารถวางวัตถุนี้ที่นี่",
@@ -32,6 +33,15 @@
"object_cancel": "[%s] ยกเลิก \n",
"object_scroll_up": "[%s] หมุนไปทางขวา \n",
"object_scroll_down": "[%s] หมุนไปทางซ้าย \n",
"depth_modifier": "[%s] ตัวปรับเปลี่ยนการควบคุมความลึก \n"
"rotate_left": "หมุนไปทางซ้าย",
"rotate_right": "หมุนไปทางขวา",
"rotate_clockwise": "[%s] หมุนตามเข็มนาฬิกา \n",
"rotate_counter_clockwise": "[%s] หมุนทวนเข็มนาฬิกา \n",
"depth_modifier": "[%s] ตัวปรับควบคุมความลึก \n"
},
"target": {
"interact": "[E] โต้ตอบ",
"title": "ตัวเลือก",
"description": "ไม่มีคำอธิบาย"
}
}
+17 -7
View File
@@ -4,6 +4,7 @@
"Input": "Miktar girişi",
"PurchaseAmount": "Satın alma miktarı",
"PurchasedItem": "Satın aldınız ",
"PurchaseFailed": "Satın alma başarısız, envanter dolu",
"CurrencySymbol": "$ %s",
"Confirm": "Satın almayı onayla",
"AreYouSure": "Bir %s satın almak istediğinizden emin misiniz",
@@ -13,14 +14,14 @@
"CashIcon": "fa-solid fa-money-bill-wave",
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "Mağaza adı"
},
"UNITTEST": {
"UNITTESTA": "Ben bir %s %s'yim",
"locale-unit-test": "Bu bir test dizesidir"
},
"clipboard": {
}, "Notifications": {
"PlaceholderTitle": "Bildirim"
}, "clipboard": {
"copy": "Panoya kopyalandı"
},
"input": {
"submit_text": "Gönder"
},
"placeable_object": {
"no_prop_defined": "Yerleştirmek için herhangi bir nesne tanımlamadınız",
"cant_place_here": "Bu nesneyi buraya yerleştiremezsiniz",
@@ -32,6 +33,15 @@
"object_cancel": "[%s] İptal \n",
"object_scroll_up": "[%s] Sağa döndür \n",
"object_scroll_down": "[%s] Sola döndür \n",
"depth_modifier": "[%s] Derinlik kontrol düzenleyicisi \n"
"rotate_left": "Sola döndür",
"rotate_right": "Sağa döndür",
"rotate_clockwise": "[%s] Saat yönünde döndür \n",
"rotate_counter_clockwise": "[%s] Saat yönünün tersine döndür \n",
"depth_modifier": "[%s] Derinlik Kontrol Değiştirici \n"
},
"target": {
"interact": "[E] Etkileşim",
"title": "Seçenekler",
"description": "Açıklama yok"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "数量输入",
"PurchaseAmount": "购买数量",
"PurchasedItem": "您已购买 ",
"PurchaseFailed": "购买失败,库存已满",
"CurrencySymbol": "$ %s",
"Confirm": "确认购买",
"AreYouSure": "您确定要购买 %s 吗",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "商店名称"
},
"UNITTEST": {
"UNITTESTA": "我是一个 %s %s",
"locale-unit-test": "这是一个测试字符串"
"Notifications": {
"PlaceholderTitle": "通知"
},
"clipboard": {
"copy": "已复制到剪贴板"
},
"input": {
"submit_text": "提交"
},
"placeable_object": {
"no_prop_defined": "您没有定义任何要放置的对象",
"cant_place_here": "您不能在此处放置此对象",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] 取消 \n",
"object_scroll_up": "[%s] 向右转 \n",
"object_scroll_down": "[%s] 向左转 \n",
"rotate_left": "向左旋转",
"rotate_right": "向右旋转",
"rotate_clockwise": "[%s] 顺时针旋转 \n",
"rotate_counter_clockwise": "[%s] 逆时针旋转 \n",
"depth_modifier": "[%s] 深度控制修改器 \n"
},
"target": {
"interact": "[E] 互动",
"title": "选项",
"description": "无描述"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "數量輸入",
"PurchaseAmount": "購買數量",
"PurchasedItem": "您已購買 ",
"PurchaseFailed": "購買失敗,庫存已滿",
"CurrencySymbol": "$ %s",
"Confirm": "確認購買",
"AreYouSure": "您確定要購買 %s 嗎",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "商店名稱"
},
"UNITTEST": {
"UNITTESTA": "我是一個 %s %s",
"locale-unit-test": "這是一個測試字符串"
"Notifications": {
"PlaceholderTitle": "通知"
},
"clipboard": {
"copy": "已復制到剪貼板"
},
"input": {
"submit_text": "提交"
},
"placeable_object": {
"no_prop_defined": "您沒有定義任何要放置的對象",
"cant_place_here": "您不能在此處放置此對象",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] 取消 \n",
"object_scroll_up": "[%s] 向右轉 \n",
"object_scroll_down": "[%s] 向左轉 \n",
"rotate_left": "向左旋轉",
"rotate_right": "向右旋轉",
"rotate_clockwise": "[%s] 順時針旋轉 \n",
"rotate_counter_clockwise": "[%s] 逆時針旋轉 \n",
"depth_modifier": "[%s] 深度控制修改器 \n"
},
"target": {
"interact": "[E] 互動",
"title": "選項",
"description": "無描述"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "數量輸入",
"PurchaseAmount": "購買數量",
"PurchasedItem": "您已購買 ",
"PurchaseFailed": "購買失敗,庫存已滿",
"CurrencySymbol": "$ %s",
"Confirm": "確認購買",
"AreYouSure": "您確定要購買 %s 嗎",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "商店名稱"
},
"UNITTEST": {
"UNITTESTA": "我是一個 %s %s",
"locale-unit-test": "這是一個測試字符串"
"Notifications": {
"PlaceholderTitle": "通知"
},
"clipboard": {
"copy": "已複製到剪貼簿"
},
"input": {
"submit_text": "提交"
},
"placeable_object": {
"no_prop_defined": "您沒有定義任何要放置的物件",
"cant_place_here": "您不能在此處放置此物件",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] 取消 \n",
"object_scroll_up": "[%s] 向右轉 \n",
"object_scroll_down": "[%s] 向左轉 \n",
"rotate_left": "向左旋轉",
"rotate_right": "向右旋轉",
"rotate_clockwise": "[%s] 順時針旋轉 \n",
"rotate_counter_clockwise": "[%s] 逆時針旋轉 \n",
"depth_modifier": "[%s] 深度控制修改器 \n"
},
"target": {
"interact": "[E] 互動",
"title": "選項",
"description": "無描述"
}
}
+15 -3
View File
@@ -4,6 +4,7 @@
"Input": "数量输入",
"PurchaseAmount": "购买数量",
"PurchasedItem": "您已购买 ",
"PurchaseFailed": "购买失败,库存已满",
"CurrencySymbol": "$ %s",
"Confirm": "确认购买",
"AreYouSure": "您确定要购买 %s 吗",
@@ -14,13 +15,15 @@
"ShopIcon": "fa-solid fa-basket-shopping",
"ShopName": "商店名称"
},
"UNITTEST": {
"UNITTESTA": "我是一个 %s %s",
"locale-unit-test": "这是一个测试字符串"
"Notifications": {
"PlaceholderTitle": "通知"
},
"clipboard": {
"copy": "已复制到剪贴板"
},
"input": {
"submit_text": "提交"
},
"placeable_object": {
"no_prop_defined": "您没有定义任何要放置的对象",
"cant_place_here": "您不能在此处放置此对象",
@@ -32,6 +35,15 @@
"object_cancel": "[%s] 取消 \n",
"object_scroll_up": "[%s] 向右转 \n",
"object_scroll_down": "[%s] 向左转 \n",
"rotate_left": "向左旋转",
"rotate_right": "向右旋转",
"rotate_clockwise": "[%s] 顺时针旋转 \n",
"rotate_counter_clockwise": "[%s] 逆时针旋转 \n",
"depth_modifier": "[%s] 深度控制修改器 \n"
},
"target": {
"interact": "[E] 互动",
"title": "选项",
"description": "无描述"
}
}
+1
View File
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
+1
View File
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
+1
View File
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
+1
View File
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
+1
View File
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
+1
View File
@@ -2,6 +2,7 @@
if GetResourceState('qb-clothing') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
@@ -1,5 +1,6 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('rcore_clothing') == 'missing' then return end
if GetResourceState('17mov_CharacterSystem') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
+2 -2
View File
@@ -22,7 +22,7 @@ function Dialogue.Close(name)
-- Wait brief moment to see if new dialogue opens
CreateThread(function()
Wait(50) -- Small delay to allow new dialogue to open
Wait(200) -- Small delay to allow new dialogue to open
if pendingCameraDestroy and not activeDialogue then
-- No new dialogue opened, safe to destroy camera
RenderScriptCams(false, 1, 1000, 1, 0)
@@ -56,7 +56,7 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel
-- camera magic!
if entity then
Wait(500)
local endLocation = GetOffsetFromEntityInWorldCoords(entity, offset.x, offset.y + 2.0, offset.z + 0.5)
local endLocation = GetOffsetFromEntityInWorldCoords(entity, offset.x, offset.y + 2.0, offset.z)
local pedHeading = GetEntityHeading(entity)
-- Get position in front of ped based on their heading
@@ -0,0 +1,25 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('emergencydispatch') == 'missing' then return end
Dispatch = Dispatch or {}
---This will send an alert to currently supported dispatch systems.
---@param data table The data to send to the dispatch system.
---@return nil
Dispatch.SendAlert = function(data)
local ped = PlayerPedId()
local job = data.job or data.jobs[1] or 'police'
local message = data.message or "An Alert Has Been Made"
local coords = data.coords or GetEntityCoords(ped)
-- The last boolean argument is unknown. The developer always uses true.
TriggerServerEvent('emergencydispatch:emergencycall:new', job, message, coords, true)
end
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'emergencydispatch'
end
return Dispatch
@@ -0,0 +1,18 @@
if GetResourceState('emergencydispatch') == 'missing' then return end
Dispatch = Dispatch or {}
RegisterNetEvent("community_bridge:server:dispatch:sendAlert", function(data)
local job = data.job or data.jobs[1] or 'police'
local message = data.message or "An Alert Has Been Made"
local coords = data.coords or vector3(0, 0, 0)
TriggerEvent('emergencydispatch:emergencycall:new', job, message, coords, true)
end)
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'emergencydispatch'
end
return Dispatch
@@ -0,0 +1,42 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fd_dispatch') == 'missing' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local metadata = {}
if data.vehicle then
table.insert(metadata, {
type = 'vehicle',
model = data.vehicle or locale('unknown_vehicle_model'),
plate = data.plate or nil,
color = data.colorHex or nil
})
end
local coords = data.coords or GetEntityCoords(PlayerPedId())
local alertData = {
title = data.message or "No message provided",
description = data.message or "",
groups = data.jobs or data.job or "police",
location = {coords = coords, street = GetStreetNameFromHashKey(GetStreetNameAtCoord(coords.x, coords.y, coords.z))},
code = data.code or '10-80',
priority = data.priority or 2,
metadata = metadata,
blip = {
radius = data.blipData and data.blipData.radius or 0,
sprite = data.blipData and data.blipData.sprite or 161,
color = data.blipData and data.blipData.color or 84,
scale = data.blipData and data.blipData.scale or 1.0,
time = data.time and (data.time / 1000) or nil,
},
}
exports["fd_dispatch"]:CustomAlert(alertData)
end
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'fd_dispatch'
end
return Dispatch
@@ -0,0 +1,11 @@
if GetResourceState('fd_dispatch') == 'missing' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {}
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'fd_dispatch'
end
return Dispatch
@@ -3,7 +3,7 @@ if GetResourceState('tk_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
exports.tk_dispatch:addCall({
local alertData = {
title = data.message,
code = data.code or '10-80',
priority = 'Priority 3',
@@ -17,7 +17,8 @@ Dispatch.SendAlert = function(data)
scale = data.blipData.scale or 0.8,
},
jobs = data.jobs or {'police'},
})
}
exports.tk_dispatch:addCall(alertData)
end
---This will get the name of the in use resource.
@@ -0,0 +1,23 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('wasabi_mdt') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local fallbackCoords = GetEntityCoords(PlayerPedId())
local alertData = {
type = data.code or '10-80',
title = data.code or '10-80',
description = data.message or "No message provided",
location = {data.coords.x, data.coords.y, data.coords.z} or {fallbackCoords.x, fallbackCoords.y, fallbackCoords.z},
coords = {data.coords.x, data.coords.y, data.coords.z} or {fallbackCoords.x, fallbackCoords.y, fallbackCoords.z},
}
exports.wasabi_mdt:CreateDispatch(alertData)
end
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'wasabi_mdt'
end
return Dispatch
@@ -0,0 +1,10 @@
if GetResourceState('wasabi_mdt') == 'missing' then return end
Dispatch = Dispatch or {}
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'wasabi_mdt'
end
return Dispatch
+7 -3
View File
@@ -3,18 +3,22 @@ Framework = Framework or {}
local currentJobCounts = GlobalState.jobcounts or {}
---@description State bag change handler to update job counts when global state changes
---@param bagName string
---@param key string
---@param value table|nil
AddStateBagChangeHandler('jobcounts', 'global', function(bagName, key, value)
if not value then currentJobCounts = {} return end
currentJobCounts = value
end)
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'default'
end
---This is an internal function that will be used to retrieve job counts later.
---@description This is an internal function that will be used to retrieve job counts later.
---@param jobName string
---@return number
Framework.GetJobCount = function(jobName)
@@ -22,7 +26,7 @@ Framework.GetJobCount = function(jobName)
return currentJobCounts[jobName]
end
---This will allow passing a table of job names and returning a sum of the total count.
---@description This will allow passing a table of job names and returning a sum of the total count.
---@param tbl table
---@return number
Framework.GetJobCountTotal = function(tbl)
+12 -7
View File
@@ -7,13 +7,13 @@ local globalState = GlobalState
globalState.jobcounts = {}
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'default'
end
---This is an internal function that will be used to retrieve job counts later.
---@description This is an internal function that will be used to retrieve job counts later.
---@param jobName string
---@return number
Framework.GetJobCount = function(jobName)
@@ -25,7 +25,7 @@ Framework.GetJobCount = function(jobName)
return count
end
---This will allow passing a table of job names and returning a sum of the total count.
---@description This will allow passing a table of job names and returning a sum of the total count.
---@param tbl any
---@return number
Framework.GetJobCountTotal = function(tbl)
@@ -36,7 +36,7 @@ Framework.GetJobCountTotal = function(tbl)
return total
end
---This will return a list of player sources for a given job.
---@description This will return a list of player sources for a given job.
---@param jobName string
---@return table
Framework.GetPlayerSourcesByJob = function(jobName)
@@ -48,7 +48,7 @@ Framework.GetPlayerSourcesByJob = function(jobName)
return sources
end
---This will update the cached tables for job counts.
---@description This will update the cached tables for job counts.
---This is used to track how many players are in a job.
---@param src number
---@param jobName string
@@ -69,13 +69,13 @@ Framework.AddJobCount = function(src, jobName)
return true
end
---This will return the job name for a given source.
---@description This will return the job name for a given source.
---@param src number
Framework.SearchJobCountBySource = function(src)
return invertedJobsRegisteredTable[src]
end
---This will remove the job count for a given source.
---@description This will remove the job count for a given source.
---@param src number
---@param jobName string | nil
Framework.RemoveJobCount = function(src, jobName)
@@ -101,12 +101,17 @@ Framework.RemoveJobCount = function(src, jobName)
return true
end
---@description Event handler for when a player's job changes, updates job counts accordingly
---@param src number
---@param newJobName string
AddEventHandler('community_bridge:Server:OnPlayerJobChange', function(src, newJobName)
local previousJob = invertedJobsRegisteredTable[src]
if previousJob then Framework.RemoveJobCount(src, previousJob) end
if newJobName then Framework.AddJobCount(src, newJobName) end
end)
---@description Event handler for when a player unloads, removes them from job counts
---@param src number
AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
Framework.RemoveJobCount(src)
end)
+86 -96
View File
@@ -8,7 +8,7 @@ Framework = Framework or {}
local cachedItemList = nil
--- @description This is an internal function, its here to attempt to emulate qbs shared items mainly
---@description This is an internal function, its here to attempt to emulate qbs shared items mainly. This should not be used outside of bridge.
Framework.ItemList = function()
if cachedItemList then return cachedItemList end
local items = Callback.Trigger('community_bridge:Callback:GetFrameworkItems', false)
@@ -16,100 +16,101 @@ Framework.ItemList = function()
return cachedItemList
end
--- @description This will get the name of the framework being used (if a supported framework).
--- @return string
---@description This will get the name of the framework being used (if a supported framework).
---@return string
Framework.GetFrameworkName = function()
return 'es_extended'
print("This is depricated, please use Framework.GetResourceName() instead.")
return Framework.GetResourceName()
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'es_extended'
end
--- @description This will return true if the player is loaded, false otherwise.
--- This could be useful in scripts that rely on player loaded events and offer a debug mode to hit this function
--- @return boolean
---@description This will return true if the player is loaded, false otherwise.
---This could be useful in scripts that rely on player loaded events and offer a debug mode to hit this function.
---@return boolean
Framework.GetIsPlayerLoaded = function()
return ESX.IsPlayerLoaded()
end
--- @description This will return a table of the player data, this will be in the framework format
--- This is mainly for internal bridge use and should be avoided.
---@description This is an internal function, do not use this outside of bridge as there is no standard format between the frameworks.
--- @return table
Framework.GetPlayerData = function()
return ESX.GetPlayerData()
end
--- @description This will return a table of all the jobs in the framework.
--- @return table
---@description This will return a table of all the jobs in the framework.
---@return table
Framework.GetFrameworkJobs = function()
local jobs = Callback.Trigger('community_bridge:Callback:GetFrameworkJobs', false)
return jobs
end
--- @description This will return the players birth date
--- @return string
---@description This will get the players birth date
---@return string
Framework.GetPlayerDob = function()
local playerData = Framework.GetPlayerData()
local dob = playerData.dateofbirth
return dob
end
--- @description This will return the players metadata for the specified metadata key.
--- @param metadata table | string
---@description This will return the players metadata for the specified metadata key.
---@param metadata table | string
---@return table | string | number | boolean
Framework.GetPlayerMetaData = function(metadata)
return Framework.GetPlayerData().metadata[metadata]
end
--- @description This will send a notification to the player.
--- @param message string
--- @param type string
--- @param time number
--- @return nil
---@description This will send a notification to the player.
---@param message string
---@param type string
---@param time number
---@return nil
Framework.Notify = function(message, type, time)
return ESX.ShowNotification(message, type, time)
end
--- @description This will display the help text message on the screen
--- @param message string
--- @param _ unknown
--- @return nil
Framework.ShowHelpText = function(message, _)
---@description Will Display the help text message on the screen
---@param message string
---@param _position unknown
---@return nil
Framework.ShowHelpText = function(message, _position)
return exports.esx_textui:TextUI(message, "info")
end
--- @description This will hide the help text message on the screen
--- @return nil
---@description This will hide the help text message on the screen
---@return nil
Framework.HideHelpText = function()
return exports.esx_textui:HideUI()
end
--- @description This will get the players identifier (citizenid) etc.
---@description This will get the players identifier (citizenid) etc.
---@return string
Framework.GetPlayerIdentifier = function()
local playerData = Framework.GetPlayerData()
return playerData.identifier
end
--- @description This will get the players name (first and last).
--- @return string
--- @return string
---@description This will get the players name (first and last).
---@return string
---@return string
Framework.GetPlayerName = function()
local playerData = Framework.GetPlayerData()
return playerData.firstName, playerData.lastName
end
--- @deprecated This will return the players job name, job label, job grade label and job grade level
--- @return string returns job name
--- @return string returns job label
--- @return string returns job grade label
--- @return string returns job grade level
---@description Depricated : This will return the players job name, job label, job grade label and job grade level
---@return string
---@return string
---@return string
---@return string
Framework.GetPlayerJob = function()
local playerData = Framework.GetPlayerData()
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
local jobData = Framework.GetPlayerJobData()
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
end
--- @description This will return the players job name, job label, job grade label job grade level,
@@ -130,7 +131,7 @@ Framework.GetPlayerJobData = function()
}
end
--This is an internal function to get status data
---@description This is an internal function to get status data
--- @param search string
Framework.GetStatusData = function(search)
local playerData = Framework.GetPlayerData()
@@ -144,29 +145,30 @@ Framework.GetStatusData = function(search)
return 0
end
---This will get the hunger of a player
---@description This will get the hunger of a player
---@return number
Framework.GetHunger = function()
local status = Framework.GetStatusData("hunger")
return math.floor((status) + 0.5) or 0
end
---This will get the thirst of a player
---@description This will get the thirst of a player
---@return number
Framework.GetThirst = function()
local status = Framework.GetStatusData("thirst")
return math.floor((status) + 0.5) or 0
end
--- @description This will return if the player has the specified item in their inventory
--- @param item string
--- @return boolean
Framework.HasItem = function(item)
---@description Will return boolean if the player has the item.
---@param item string
---@param requiredCount number (optional)
---@return boolean
Framework.HasItem = function(item, requiredCount)
local hasItem = ESX.SearchInventory(item, true)
return hasItem > 0 and true or false
return hasItem >= (requiredCount or 1)
end
--- @description This will return the item count for the specified item in the players inventory
---@description This is an internal function used as a fallback, please use the Inventory.GetItemCount instead.
--- @param item string
--- @return number
Framework.GetItemCount = function(item)
@@ -175,16 +177,38 @@ Framework.GetItemCount = function(item)
return inventory[item].count or 0
end
--- @description This will return a table of the players inventory
--- @return table
Framework.GetPlayerInventory = function()
local playerData = Framework.GetPlayerData()
return playerData.inventory
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
---@param item string
---@return table
Framework.GetItemInfo = function(item)
return {}, print("ESX has not implemented GetItemInfo for this framework. Please ensure the inventory you are using is supported and start order is correct.")
end
--- @description This will return the players money by type, I recommend not using this as its the client and not secure or to be trusted
--- @param _type string
--- @return number
---@description This is an internal function used as a fallback, please use the Inventory.GetPlayerInventory instead.
--- @return table {name, label, count, slot, metadata, stack, close, weight}
Framework.GetPlayerInventory = function()
local playerData = Framework.GetPlayerData()
if not playerData then return {} end
local repack = {}
for k, v in pairs(playerData.inventory) do
repack[k] = {
name = v.name,
label = v.label,
count = v.count,
slot = 0,
metadata = {},
stack = false,
close = v.usable or false,
weight = v.weight or 0,
}
end
return repack
end
---@description This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---Use case is for a ui or a menu I guess.
---@param _type string
---@return number
Framework.GetAccountBalance = function(_type)
local player = Framework.GetPlayerData()
if not player then return 0 end
@@ -192,52 +216,13 @@ Framework.GetAccountBalance = function(_type)
if _type == 'cash' then _type = 'money' end
for _, account in ipairs(accounts) do
if account.name == _type then
if not account.money or account.money <= 0 then return 0 end
return account.money or 0
end
end
return 0
end
--- @description This will return the vehicle properties for the specified vehicle
--- @param vehicle number
--- @return table
Framework.GetVehicleProperties = function(vehicle)
if not vehicle or not DoesEntityExist(vehicle) then return {} end
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
return vehicleProps or {}
end
--- @description This will set the vehicle properties for the specified vehicle
--- @param vehicle number
--- @param properties table
--- @return boolean
Framework.SetVehicleProperties = function(vehicle, properties)
if not vehicle or not DoesEntityExist(vehicle) then return false end
if not properties then return false end
if NetworkGetEntityIsNetworked(vehicle) then
local vehNetID = NetworkGetNetworkIdFromEntity(vehicle)
local entOwner = GetPlayerServerId(NetworkGetEntityOwner(vehNetID))
if entOwner ~= GetPlayerServerId(PlayerId()) then
NetworkRequestControlOfEntity(vehicle)
local count = 0
while not NetworkHasControlOfEntity(vehicle) and count < 3000 do
Wait(1)
count = count + 1
end
end
end
-- Every framework version does this just a diffrent key I guess?
if properties.color1 and type(properties.color1) == 'table' then
properties.customPrimaryColor = {properties.color1[1], properties.color1[2], properties.color1[3]}
properties.color1 = nil
end
if properties.color2 and type(properties.color2) == 'table' then
properties.customSecondaryColor = {properties.color2[1], properties.color2[2], properties.color2[3]}
properties.color2 = nil
end
return true, ESX.Game.SetVehicleProperties(vehicle, properties)
end
--- @description This will get a players dead status
--- @return boolean
Framework.GetIsPlayerDead = function()
@@ -245,15 +230,20 @@ Framework.GetIsPlayerDead = function()
return playerData.dead
end
---@description Event handler for when player is loaded in ESX framework
---@param xPlayer table
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
Wait(1500)
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
end)
---@description Event handler for when player logs out in ESX framework
RegisterNetEvent('esx:onPlayerLogout', function()
TriggerEvent('community_bridge:Client:OnPlayerUnload')
end)
---@description Event handler for when player job is updated in ESX framework
---@param data table Job data containing name, label, grade_label, and grade
RegisterNetEvent('esx:setJob', function(data)
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
end)
+174 -88
View File
@@ -13,16 +13,17 @@ local cachedItemList = nil
--- @description This will return the name of the framework in use
--- @return string
Framework.GetFrameworkName = function()
return 'es_extended'
print("This is deprecated, please use Framework.GetResourceName() instead.")
return Framework.GetResourceName()
end
---This will get the name of the in use resource.
---@return string
---@description This will get the name of the in use resource.
--- @return string
Framework.GetResourceName = function()
return 'es_extended'
end
--- @description This is an internal function, its here to attempt to emulate qbs shared items mainly
---@description This is an internal function, its here to attempt to emulate qbs shared items mainly, do not use this outside of bridge.
Framework.ItemList = function()
if cachedItemList then return cachedItemList end
local items = ESX.Items
@@ -46,9 +47,9 @@ Framework.ItemList = function()
return cachedItemList
end
--- @description This will return if the player is an admin in the framework
--- @param src any
--- @return boolean
---@description This will return if the player is an admin in the framework.
---@param src number
---@return boolean
Framework.GetIsFrameworkAdmin = function(src)
if not src then return false end
local xPlayer = Framework.GetPlayer(src)
@@ -58,7 +59,8 @@ Framework.GetIsFrameworkAdmin = function(src)
return false
end
--- @description This will get the players birth date
---@description Returns the player date of birth.
--- @param src number
--- @return string|nil
Framework.GetPlayerDob = function(src)
local xPlayer = Framework.GetPlayer(src)
@@ -99,7 +101,7 @@ Framework.GetPlayerName = function(src)
return xPlayer.variables.firstName, xPlayer.variables.lastName
end
--- @description This will return a table of all logged in players
---@description This will return a table of all logged in players
--- @return table
Framework.GetPlayers = function()
local players = ESX.GetExtendedPlayers()
@@ -110,14 +112,16 @@ Framework.GetPlayers = function()
return playerList
end
--- @description This will return a table of items matching the specified name and if passed metadata from the player's inventory
---@description Returns a table of items matching the specified name and if passed metadata from the player's inventory.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
--- @param src number
--- @param item string
--- @param _ table
--- @return table|nil returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, _)
--- @param metadata table
--- @return table {name, count, metadata, slot}
Framework.GetItem = function(src, item, metadata)
print("ESX does not support item metadata searches, please ensure you are using a supported inventory system or that you have the correct start order.")
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return {} end
local playerItems = xPlayer.getInventory()
local repackedTable = {}
for _, v in pairs(playerItems) do
@@ -125,40 +129,57 @@ Framework.GetItem = function(src, item, _)
table.insert(repackedTable, {
name = v.name,
count = v.count,
--metadata = v.metadata,
--slot = v.slot,
metadata = {}, -- ESX does not support item metadata
slot = 0, -- ESX does not support item slots
})
end
end
return repackedTable
end
--- @param src number
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
--- @param item string
--- @param _ table
--- @return number returns the count of the item in the players inventory, if not found will return 0.
--- If metadata is passed it will find the matching items count (esx_core does not feature metadata items)
Framework.GetItemCount = function(src, item, _)
--- @return table {name, label, stack, weight, description, image}
Framework.GetItemInfo = function(item)
local items = Framework.ItemList()
if not items[item] then return {} end
return {name = item, label = items[item].label, stack = false, weight = items[item].weight, description = items[item].description, image = items[item].image}
end
---@description This will return the count of the item in the players inventory, if not found will return 0.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param metadata table (optional)
---@return number
Framework.GetItemCount = function(src, item, metadata)
if metadata then
print("ESX does not support item metadata searches, please ensure you are using a supported inventory system or that you have the correct start order.")
end
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return 0 end
return xPlayer.getInventoryItem(item).count
end
--- @description This will return true if the player has the item, false otherwise
---@description This will return a boolean if the player has the item.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
--- @param src number
--- @param item string
--- @return boolean returns true if the player has the item, false otherwise.
--- @return boolean
Framework.HasItem = function(src, item)
local getCount = Framework.GetItemCount(src, item, nil)
return getCount > 0
end
--- @description This will return the player's inventory as a table
--- @param src number
--- @return table | nil returns the player's inventory as a table in format: {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
---@description Returns the entire inventory of the player as a table.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@return table {name, count, metadata, slot}
Framework.GetPlayerInventory = function(src)
print("ESX does not support item metadata or slots, please ensure you are using a supported inventory system or that you have the correct start order.")
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return {} end
local playerItems = xPlayer.getInventory()
local repackedTable = {}
for _, v in pairs(playerItems) do
@@ -166,15 +187,25 @@ Framework.GetPlayerInventory = function(src)
table.insert(repackedTable, {
name = v.name,
count = v.count,
--metadata = v.metadata,
--slot = v.slot,
metadata = {}, -- ESX does not support item metadata
slot = 0, -- ESX does not support item slots
})
end
end
return repackedTable
end
--- @description Adds the specified metadata key and number value to the player's data.
---@description This will return the item data for the specified slot.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
--- @param src number
--- @param slot number
--- @return table {name, label, weight, count, metadata, slot, stack, description}
Framework.GetItemBySlot = function(src, slot)
print("ESX does not support item slots, please ensure you are using a supported inventory system or that you have the correct start order.")
return {} -- ESX does not support item slots
end
---@description Adds the specified metadata key and number value to the player's data.
--- @param src number
--- @param metadata string
--- @param value any
@@ -186,8 +217,7 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
return true
end
-- Framework.GetMetadata(src, metadata)
--- @description Gets the specified metadata key to the player's data.
---@description Gets the specified metadata key to the player's data.
--- @param src number
--- @param metadata string
--- @return any|nil
@@ -197,7 +227,7 @@ Framework.GetPlayerMetadata = function(src, metadata)
return xPlayer.getMeta(metadata) or false
end
--- @description This will return the specified status column of the player.
---@description This is an internal function and should not be used outside of bridge, this is only present in the esx portion.
--- @param src number
--- @param column string
--- @return string|nil
@@ -213,16 +243,16 @@ Framework.GetStatus = function(src, column)
return xPlayer.get(column) or nil
end
--- @description This will return a boolean if the player is dead or in last stand
---@description This will return a boolean if the player is dead or in last stand.
--- @param src number
--- @return boolean|nil
--- @return boolean
Framework.GetIsPlayerDead = function(src)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return false end
return xPlayer.get("is_dead") or false
end
--- @description This will revive a player, if the player is dead or in last stand
---@description This will revive a player, if the player is dead or in last stand.
--- @param src number
--- @return boolean
Framework.RevivePlayer = function(src)
@@ -254,13 +284,13 @@ Framework.AddHunger = function(src, value)
return levelForEsx
end
--- @description This will get the hunger of a player (ESX we get the percent of the status)
---@description This will get the hunger of a player
--- @param src number
--- @return number | nil
--- @return number
Framework.GetHunger = function(src)
local status = Framework.GetStatus(src, "status")
if not status then return end
if type(status) ~= "table" then return end
if not status then return 0 end
if type(status) ~= "table" then return 0 end
for _, entry in ipairs(status) do
if entry.name == "hunger" then
return math.floor((entry.percent) + 0.5) or 0
@@ -268,13 +298,13 @@ Framework.GetHunger = function(src)
end
end
--- @description This will get the thirst of a player (ESX we get the percent of the status)
---@description This will get the thirst of a player
--- @param src any
--- @return number | nil
--- @return number
Framework.GetThirst = function(src)
local status = Framework.GetStatus(src, "status")
if not status then return nil end
if type(status) ~= "table" then return end
if not status then return 0 end
if type(status) ~= "table" then return 0 end
for _, entry in ipairs(status) do
if entry.name == "thirst" then
return math.floor((entry.percent) + 0.5) or 0
@@ -282,16 +312,17 @@ Framework.GetThirst = function(src)
end
end
--- @description This will get the phone number of a player
---@description Returns the phone number of the player.
--- @param src number
--- @return string | nil return the phone number of the player
--- @return string | nil
Framework.GetPlayerPhone = function(src)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
return xPlayer.get("phone_number")
end
---@deprecated This will return the job name, label, grade name, and grade level of the player.
---@description This will return the job name, label, grade name, and grade level of the player.
---@deprecated
---@param src number
---@return string | nil
---@return string | nil
@@ -304,13 +335,12 @@ Framework.GetPlayerJob = function(src)
return job.name, job.label, job.grade_label, job.grade
end
--- @description This will return the players job name, job label, job grade label job grade level,
--- boss status, and duty status in a table
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
--- @param src number
--- @return table | nil
--- @return table {jobName, jobLabel, gradeName, gradeLabel, gradeRank, boss, onDuty}
Framework.GetPlayerJobData = function(src)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return {} end
local job = xPlayer.getJob()
local isBoss = (job.grade_name == "boss")
return {
@@ -324,9 +354,9 @@ Framework.GetPlayerJobData = function(src)
}
end
--- @description This will return the players duty status, true if on duty false otherwise
---@description Returns the players duty status.
--- @param src number
--- @return boolean return the players duty status
--- @return boolean
Framework.GetPlayerDuty = function(src)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return false end
@@ -335,7 +365,7 @@ Framework.GetPlayerDuty = function(src)
return true
end
--- @description This will toggle a players duty status
---@description This will toggle a players duty status
--- @param src number
--- @param status boolean
--- @return boolean
@@ -348,95 +378,131 @@ Framework.SetPlayerDuty = function(src, status)
return true
end
--- @description This will get a table of player sources that have the specified job name
---@description Returns the gang name of the player.
---@param src number
---@return string | nil
Framework.GetPlayerGang = function(src)
print("ESX does not support gangs, please ensure you are using a supported gang system or that you have the correct start order.")
return
end
---@description This will get a table of player sources that have the specified job name.
--- @param job string
--- @return table
Framework.GetPlayersByJob = function(job)
return Framework.GetPlayerSourcesByJob(job) or {}
end
--- @description This will set the player's job to the specified name and grade
---@description Sets the player's job to the specified name and grade.
--- @param src number
--- @param name string
--- @param grade string
--- @return nil
Framework.SetPlayerJob = function(src, name, grade)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not ESX.DoesJobExist(name, grade) then
Prints.Error("Job Does Not Exsist In Framework :NAME " .. name .. " Grade:" .. grade)
print("^6 Job Does Not Exsist In Framework :NAME " .. name .. " Grade:" .. grade .. " ^0 ")
return
end
xPlayer.setJob(name, grade, true)
return true
end
--- @description This will add money based on the type of account (money/bank)
---@description This will add money based on the type of account (money/bank)
--- @param src number
--- @param _type string
--- @param amount number
--- @return boolean | nil
--- @return boolean
Framework.AddAccountBalance = function(src, _type, amount)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return false end
if _type == 'cash' then _type = 'money' end
if amount <= 0 then return false end
xPlayer.addAccountMoney(_type, amount)
return true
end
--- @description This will remove money based on the type of account (money/bank)
---@description This will remove money based on the type of account (money/bank)
--- @param src number
--- @param _type string
--- @param amount number
--- @return boolean | nil
--- @return boolean
Framework.RemoveAccountBalance = function(src, _type, amount)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return false end
if _type == 'cash' then _type = 'money' end
if amount <= 0 then return false end
local accountVal = Framework.GetAccountBalance(src, _type)
if accountVal < amount then return false end
xPlayer.removeAccountMoney(_type, amount)
return true
end
--- @description This will get the account balance based on the type of account (money/bank)
---@description This will get money based on the type of account (money/bank)
--- @param src number
--- @param _type string
--- @return string | nil
--- @return number
Framework.GetAccountBalance = function(src, _type)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return 0 end
if _type == 'cash' then _type = 'money' end
return xPlayer.getAccount(_type).money
local balance = xPlayer.getAccount(_type).money or 0
if balance <= 0 then return 0 end
return balance
end
--- @description Adds the specified item to the player's inventory
--- @param src number
--- @param item string
--- @param amount number
--- @param slot number
--- @param metadata table
--- @return boolean | nil
Framework.AddItem = function(src, item, amount, slot, metadata)
---@description This will add an item, and return true or false based on success
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param count number
---@param slot number (optional)
---@param metadata table (optional)
---@return boolean
Framework.AddItem = function(src, item, count, slot, metadata)
if slot then print("ESX does not support item slots, please ensure you are using a supported inventory system or that you have the correct start order.") end
if metadata then print("ESX does not support item metadata, please ensure you are using a supported inventory system or that you have the correct start order.") end
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
xPlayer.addInventoryItem(item, amount)
if not xPlayer then return false end
xPlayer.addInventoryItem(item, count)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = count, slot = slot, metadata = metadata })
return true
end
--- @description Removes the specified item from the player's inventory
---@description Removes the specified item from the player's inventory.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
--- @param src number
--- @param item string
--- @param amount number
--- @param slot number
--- @param metadata table
---@return boolean | nil
--- @param slot number (optional)
--- @param metadata table (optional)
--- @return boolean
Framework.RemoveItem = function(src, item, amount, slot, metadata)
if slot then
print("ESX does not support item slots, please ensure you are using a supported inventory system or that you have the correct start order.")
end
if metadata then
print("ESX does not support item metadata, please ensure you are using a supported inventory system or that you have the correct start order.")
end
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if not xPlayer then return false end
xPlayer.removeInventoryItem(item, amount)
return true
end
--- @description This will get all owned vehicles for the player
---@description Sets the metadata for the specified item in the player's inventory.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
--- @param src number
--- @param item string
--- @param slot number
--- @param metadata table
--- @return boolean
Framework.SetMetadata = function(src, item, slot, metadata)
print("ESX does not support item metadata, please ensure you are using a supported inventory system or that you have the correct start order.")
return false
end
---@description This will get all owned vehicles for the player
--- @param src number
--- @return table
Framework.GetOwnedVehicles = function(src)
@@ -452,7 +518,7 @@ Framework.GetOwnedVehicles = function(src)
return vehicles
end
--- @description Registers a usable item with a callback function
---@description Registers a usable item with a callback function.
--- @param itemName string
--- @param cb function
Framework.RegisterUsableItem = function(itemName, cb)
@@ -465,6 +531,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
ESX.RegisterUsableItem(itemName, func)
end
---@description Event handler for when a player is loaded in ESX framework
---@param src number
RegisterNetEvent("esx:playerLoaded", function(src)
src = src or source
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
@@ -473,32 +541,50 @@ RegisterNetEvent("esx:playerLoaded", function(src)
Framework.AddJobCount(src, jobData.jobName)
end)
---@description Event handler for when a player logs out in ESX framework
---@param src number
RegisterNetEvent("esx:playerLogout", function(src)
src = src or source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
---@description Event handler for when a player's job is updated in ESX framework
---@param src number
---@param job table
---@param lastJob table
RegisterNetEvent("esx:setJob", function(src, job, lastJob)
src = src or source
if not job or not lastJob then return end
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
end)
---@description Event handler for when a player disconnects from the server
AddEventHandler("playerDropped", function()
local src = source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
---@description Callback to get framework jobs list
---@param source number
Callback.Register('community_bridge:Callback:GetFrameworkJobs', function(source)
return Framework.GetFrameworkJobs() or {}
end)
-- This is linked to an internal function, its an attempt to standardize the item list across frameworks.
---@description This is linked to an internal function, its an attempt to standardize the item list across frameworks.
---@param source number
Callback.Register('community_bridge:Callback:GetFrameworkItems', function(source)
return Framework.ItemList() or {}
end)
Framework.Commands = {}
---@description Adds a command to the ESX framework
---@param name string
---@param help string
---@param arguments table
---@param argsrequired boolean
---@param callback function
---@param permission string
---@param ... any
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
ESX.RegisterCommand(name, permission, function(xPlayer, args, showError)
callback(xPlayer, args)
+40 -44
View File
@@ -8,33 +8,34 @@ QBCore = exports['qb-core']:GetCoreObject()
Framework.Shared = QBCore.Shared
---This will get the name of the framework being used (if a supported framework).
---@description This will get the name of the framework being used (if a supported framework).
---@return string
Framework.GetFrameworkName = function()
return 'qb-core'
print("This is depricated, please use Framework.GetResourceName() instead.")
return Framework.GetResourceName()
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'qb-core'
end
---This will return true if the player is loaded, false otherwise.
---@description This will return true if the player is loaded, false otherwise.
---This could be useful in scripts that rely on player loaded events and offer a debug mode to hit this function.
---@return boolean
Framework.GetIsPlayerLoaded = function()
return LocalPlayer.state.isLoggedIn or false
end
---This will return a table of the player data, this will be in the framework format.
---@description This will return a table of the player data, this will be in the framework format.
---This is mainly for internal bridge use and should be avoided.
---@return table
Framework.GetPlayerData = function()
return QBCore.Functions.GetPlayerData()
end
---This will return a table of all the jobs in the framework.
---@description This will return a table of all the jobs in the framework.
---@return table
Framework.GetFrameworkJobs = function()
local jobs = {}
@@ -48,7 +49,7 @@ Framework.GetFrameworkJobs = function()
return jobs
end
---This will get the players birth date
---@description This will get the players birth date
---@return string
Framework.GetPlayerDob = function()
local player = Framework.GetPlayerData()
@@ -56,14 +57,14 @@ Framework.GetPlayerDob = function()
return playerData.charinfo.birthdate
end
---This will return the players metadata for the specified metadata key.
---@description This will return the players metadata for the specified metadata key.
---@param metadata table | string
---@return table | string | number | boolean
Framework.GetPlayerMetaData = function(metadata)
return Framework.GetPlayerData().metadata[metadata]
end
---This will send a notification to the player.
---@description This will send a notification to the player.
---@param message string
---@param type string
---@param time number
@@ -72,7 +73,7 @@ Framework.Notify = function(message, type, time)
TriggerEvent('QBCore:Notify', message, 'primary', time)
end
---Will Display the help text message on the screen
---@description This will display the help text message on the screen
---@param message string
---@param _position unknown
---@return nil
@@ -80,14 +81,14 @@ Framework.ShowHelpText = function(message, _position)
return exports['qb-core']:DrawText(message, _position)
end
---This will hide the help text message on the screen
---@description This will hide the help text message on the screen
---@return nil
Framework.HideHelpText = function()
return exports['qb-core']:HideText()
end
---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---Use case is for a ui or a menu I guess.
---@description This will return the players money by type, I recommend not using this
---as its the client and not secure or to be trusted. Use case is for a ui or a menu I guess.
---@param _type string
---@return number
Framework.GetAccountBalance = function(_type)
@@ -98,7 +99,7 @@ Framework.GetAccountBalance = function(_type)
return account[_type] or 0
end
---This will return the item data for the specified item.
---@description This will return the item data for the specified item.
---@param item string
---@return table
Framework.GetItemInfo = function(item)
@@ -115,27 +116,27 @@ Framework.GetItemInfo = function(item)
return repackedTable
end
---This will get the hunger of a player
---@description This will get the hunger of a player
---@return number
Framework.GetHunger = function()
local hunger = Framework.GetPlayerMetaData("hunger") or 0
return math.floor((hunger) + 0.5) or 0
end
---This will get the thirst of a player
---@description This will get the thirst of a player
---@return number
Framework.GetThirst = function()
local thirst = Framework.GetPlayerMetaData("thirst") or 0
return math.floor((thirst) + 0.5) or 0
end
---This will get the players identifier (citizenid) etc.
---@description This will get the players identifier (citizenid) etc.
---@return string
Framework.GetPlayerIdentifier = function()
return Framework.GetPlayerData().citizenid
end
---This will get the players name (first and last).
---@description This will get the players name (first and last).
---@return string
---@return string
Framework.GetPlayerName = function()
@@ -143,17 +144,18 @@ Framework.GetPlayerName = function()
return playerData.charinfo.firstname, playerData.charinfo.lastname
end
---Depricated : This will return the players job name, job label, job grade label and job grade level
---@deprecated Deprecated: This will return the players job name, job label, job grade label and job grade level
---@return string
---@return string
---@return string
---@return string
Framework.GetPlayerJob = function()
local playerData = Framework.GetPlayerData()
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
local jobData = Framework.GetPlayerJobData()
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
end
---This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@return table
Framework.GetPlayerJobData = function()
local playerData = Framework.GetPlayerData()
@@ -169,14 +171,15 @@ Framework.GetPlayerJobData = function()
}
end
---This will return if the player has the specified item in their inventory.
---@description Will return boolean if the player has the item.
---@param item string
---@param requiredCount number (optional)
---@return boolean
Framework.HasItem = function(item)
return QBCore.Functions.HasItem(item)
Framework.HasItem = function(item, requiredCount)
return QBCore.Functions.HasItem(item, requiredCount or 1)
end
---This will return the item count for the specified item in the players inventory.
---@description This will return the item count for the specified item in the players inventory
---@param item string
---@return number
Framework.GetItemCount = function(item)
@@ -184,13 +187,13 @@ Framework.GetItemCount = function(item)
local count = 0
for _, v in pairs(frameworkInv) do
if v.name == item then
count = count + v.amount
count = count + (v.amount or v.count)
end
end
return count
end
---This will return the players inventory as a table in the ox_inventory style flormat.
---@description This will return the players inventory as a table in the ox_inventory style format
---@return table
Framework.GetPlayerInventory = function()
local items = {}
@@ -199,9 +202,9 @@ Framework.GetPlayerInventory = function()
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
count = v.amount or v.count,
slot = v.slot,
metadata = v.info,
metadata = v.info or v.metadata or {},
stack = v.unique,
close = v.useable,
weight = v.weight
@@ -210,7 +213,7 @@ Framework.GetPlayerInventory = function()
return items
end
---This will return the vehicle properties for the specified vehicle.
---@description This will return the vehicle properties for the specified vehicle
---@param vehicle number
---@return table
Framework.GetVehicleProperties = function(vehicle)
@@ -219,7 +222,7 @@ Framework.GetVehicleProperties = function(vehicle)
return vehicleProps or {}
end
---This will set the vehicle properties for the specified vehicle.
---@description This will set the vehicle properties for the specified vehicle
---@param vehicle number
---@param properties table
---@return boolean
@@ -241,35 +244,28 @@ Framework.SetVehicleProperties = function(vehicle, properties)
return true, QBCore.Functions.SetVehicleProperties(vehicle, properties)
end
---This will get a players dead status.
---@description This will get a players dead status
---@return boolean
Framework.GetIsPlayerDead = function()
local playerData = Framework.GetPlayerData()
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
end
---@description Event handler for when player is loaded in QB-Core framework
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
Wait(1500)
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
end)
---@description Event handler for when player is unloaded in QB-Core framework
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
TriggerEvent('community_bridge:Client:OnPlayerUnload')
end)
---@description Event handler for when player job is updated in QB-Core framework
---@param data table Job data containing name, label, grade_label, and grade
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(data)
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade_label, data.grade)
end)
RegisterNetEvent('QBCore:Client:OnGangUpdate', function(data)
-- Unsure what data is passed in this, but considering the gang data isnt updating I doubt this was tested.
--[[
PlayerJobName = data.name
PlayerJobLabel = data.label
PlayerJobGradeName = data.grade.name
PlayerJobGradeLevel = data.grade.level
TriggerEvent('community_bridge:Client:OnPlayerGangUpdate', PlayerGangName, PlayerGangLabel, PlayerGangGradeName, PlayerGangGradeLevel)
--]]
end)
return Framework
+222 -120
View File
@@ -8,19 +8,20 @@ QBCore = exports['qb-core']:GetCoreObject()
Framework.Shared = QBCore.Shared
---This will return the name of the framework in use.
---@description This will return the name of the framework in use.
---@return string
Framework.GetFrameworkName = function()
return 'qb-core'
print("[Community Bridge] Warning: Framework.GetFrameworkName is deprecated, use Framework.GetResourceName instead.")
return Framework.GetResourceName()
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'qb-core'
end
---This will return if the player is an admin in the framework.
---@description This will return if the player is an admin in the framework.
---@param src any
---@return boolean
Framework.GetIsFrameworkAdmin = function(src)
@@ -28,8 +29,7 @@ Framework.GetIsFrameworkAdmin = function(src)
return QBCore.Functions.HasPermission(src, 'admin')
end
-- Framework.GetPlayerIdentifier(src)
-- Returns the citizen ID of the player.
---@description This will return the citizen ID of the player.
---@param src number
---@return string | nil
Framework.GetPlayerIdentifier = function(src)
@@ -39,7 +39,7 @@ Framework.GetPlayerIdentifier = function(src)
return playerData.citizenid
end
--- Returns the player data of the specified source in the framework defualt format.
---@description Returns the player data of the specified source in the framework defualt format.
---@param src any
---@return table | nil
Framework.GetPlayer = function(src)
@@ -48,10 +48,8 @@ Framework.GetPlayer = function(src)
return player
end
---This will return the jobs registered in the framework in a table.
---Format of the table is:
---{name = jobName, label = jobLabel, grade = {name = gradeName, level = gradeLevel}}
---@return table
---@description This will return the jobs registered in the framework in a table.
---@return table {name = jobName, label = jobLabel, grade = {name = gradeName, level = gradeLevel}}
Framework.GetFrameworkJobs = function()
local jobs = {}
for k, v in pairs(QBCore.Shared.Jobs) do
@@ -64,8 +62,7 @@ Framework.GetFrameworkJobs = function()
return jobs
end
-- Framework.GetPlayerName(src)
-- Returns the first and last name of the player.
---@description Returns the first and last name of the player.
---@return string|nil, string|nil
Framework.GetPlayerName = function(src)
local player = Framework.GetPlayer(src)
@@ -74,7 +71,7 @@ Framework.GetPlayerName = function(src)
return playerData.charinfo.firstname, playerData.charinfo.lastname
end
---Returns the player date of birth.
---@description Returns the player date of birth.
---@param src number
---@return string|nil
Framework.GetPlayerDob = function(src)
@@ -84,12 +81,11 @@ Framework.GetPlayerDob = function(src)
return playerData.charinfo.birthdate
end
---Returns a table of items matching the specified name and if passed metadata from the player's inventory.
---returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
---@description Returns a table of items matching the specified name and if passed metadata from the player's inventory.
---@param src number
---@param item string
---@param metadata table
---@return table|nil
---@return table|nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
@@ -100,7 +96,7 @@ Framework.GetItem = function(src, item, metadata)
if v.name == item and (not metadata or v.info == metadata) then
table.insert(repackedTable, {
name = v.name,
count = v.amount,
count = v.amount or v.count,
metadata = v.info,
slot = v.slot,
})
@@ -109,9 +105,9 @@ Framework.GetItem = function(src, item, metadata)
return repackedTable
end
---This will return a table with the item info, {name, label, stack, weight, description, image}
---@description This will return a table with the item info
---@param item string
---@return table
---@return table {name, label, stack, weight, description, image}
Framework.GetItemInfo = function(item)
local itemData = QBCore.Shared.Items[item]
if not itemData then return {} end
@@ -126,8 +122,7 @@ Framework.GetItemInfo = function(item)
return repackedTable
end
---This will return the count of the item in the players inventory, if not found will return 0.
---
---@description This will return the count of the item in the players inventory, if not found will return 0
---if metadata is passed it will find the matching items count.
---@param src number
---@param item string
@@ -141,13 +136,13 @@ Framework.GetItemCount = function(src, item, metadata)
local count = 0
for _, v in pairs(playerInventory) do
if v.name == item and (not metadata or v.info == metadata) then
count = count + v.amount
count = count + (v.amount or v.count)
end
end
return count
end
---This will return a boolean if the player has the item.
---@description This will return a boolean if the player has the item.
---@param src number
---@param item string
---@return boolean
@@ -156,11 +151,9 @@ Framework.HasItem = function(src, item)
return getCount > 0
end
-- Framework.GetPlayerInventory(src)
-- Returns the entire inventory of the player as a table.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
---@description Returns the entire inventory of the player as a table.
---@param src number
---@return table | nil
---@return table | nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetPlayerInventory = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
@@ -170,7 +163,7 @@ Framework.GetPlayerInventory = function(src)
for _, v in pairs(playerInventory) do
table.insert(repackedTable, {
name = v.name,
count = v.amount,
count = v.amount or v.count,
metadata = v.info,
slot = v.slot,
})
@@ -178,7 +171,7 @@ Framework.GetPlayerInventory = function(src)
return repackedTable
end
---This will return a table of all logged in players
---@description This will return a table of all logged in players
---@return table
Framework.GetPlayers = function()
local players = QBCore.Functions.GetPlayers()
@@ -189,11 +182,10 @@ Framework.GetPlayers = function()
return playerList
end
---This will return the item data for the specified slot.
---Format {name, label, weight, count, metadata, slot, stack, description}
---@description This will return the item data for the specified slot.
---@param src number
---@param slot number
---@return table|nil
---@return table|nil {name, label, weight, count, metadata, slot, stack, description}
Framework.GetItemBySlot = function(src, slot)
local player = Framework.GetPlayer(src)
if not player then return end
@@ -206,7 +198,7 @@ Framework.GetItemBySlot = function(src, slot)
name = v.name,
label = v.label,
weight = v.weight,
count = v.amount,
count = v.amount or v.count,
metadata = v.info,
slot = v.slot,
stack = v.unique or false,
@@ -217,8 +209,7 @@ Framework.GetItemBySlot = function(src, slot)
return repack
end
-- Framework.SetMetadata(src, metadata, value)
-- Adds the specified metadata key and number value to the player's data.
---@description Adds the specified metadata key and number value to the player's data.
---@return boolean|nil
Framework.SetPlayerMetadata = function(src, metadata, value)
local player = Framework.GetPlayer(src)
@@ -227,8 +218,7 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
return true
end
-- Framework.GetMetadata(src, metadata)
-- Gets the specified metadata key to the player's data.
---@description Gets the specified metadata key to the player's data.
---@param src number
---@param metadata string
---@return any|nil
@@ -239,8 +229,7 @@ Framework.GetPlayerMetadata = function(src, metadata)
return playerData.metadata[metadata] or false
end
-- Framework.AddStress(src, value)
-- Adds the specified value to the player's stress level and updates the client HUD.
---@description Adds the specified value to the player's stress level and updates the client HUD.
---@param src number
---@param value number
---@return number | nil
@@ -254,8 +243,7 @@ Framework.AddStress = function(src, value)
return newStress
end
-- Framework.RemoveStress(src, value)
-- Removes the specified value from the player's stress level and updates the client HUD.
---@description Removes the specified value from the player's stress level and updates the client HUD.
---@param src number
---@param value number
---@return number | nil
@@ -269,8 +257,7 @@ Framework.RemoveStress = function(src, value)
return newStress
end
-- Framework.AddHunger(src, value)
-- Adds the specified value from the player's hunger level.
---@description Adds the specified value from the player's hunger level.
---@param src number
---@param value number
---@return number | nil
@@ -281,12 +268,10 @@ Framework.AddHunger = function(src, value)
local newHunger = (playerData.metadata.hunger or 0) + value
player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100))
TriggerClientEvent('hud:client:UpdateNeeds', src, newHunger, playerData.metadata.thirst)
--TriggerClientEvent('hud:client:UpdateStress', src, newStress)
return newHunger
end
-- Framework.AddThirst(src, value)
-- Adds the specified value from the player's thirst level.
---@description Adds the specified value from the player's thirst level.
---@param src number
---@param value number
---@return number | nil
@@ -297,11 +282,10 @@ Framework.AddThirst = function(src, value)
local newThirst = (playerData.metadata.thirst or 0) + value
player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100))
TriggerClientEvent('hud:client:UpdateNeeds', src, playerData.metadata.hunger, newThirst)
--TriggerClientEvent('hud:client:UpdateStress', src, newStress)
return newThirst
end
---This will get the hunger of a player
---@description This will get the hunger of a player
---@param src number
---@return number | nil
Framework.GetHunger = function(src)
@@ -312,17 +296,17 @@ Framework.GetHunger = function(src)
return math.floor((newHunger) + 0.5) or 0
end
---This will return a boolean if the player is dead or in last stand.
---@description This will return a boolean if the player is dead or in last stand.
---@param src number
---@return boolean|nil
Framework.GetIsPlayerDead = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return false end
local playerData = player.PlayerData
return playerData.metadata.isdead or playerData.metadata.inlaststand or false
end
---This will revive a player, if the player is dead or in last stand.
---@description This will revive a player, if the player is dead or in last stand.
---@param src number
---@return boolean
Framework.RevivePlayer = function(src)
@@ -332,20 +316,29 @@ Framework.RevivePlayer = function(src)
return true
end
--- @description This will get the hunger of a player
--- @param src number
--- @return number
Framework.GetHunger = function(src)
local player = Framework.GetPlayer(src)
if not player then return 0 end
local playerData = player.PlayerData
local newHunger = (playerData.metadata.hunger or 0)
return math.floor((newHunger) + 0.5) or 0
end
---This will get the thirst of a player
---@description This will get the thirst of a player
---@param src any
---@return number | nil
Framework.GetThirst = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return 0 end
local playerData = player.PlayerData
local newThirst = (playerData.metadata.thirst or 0)
return math.floor((newThirst) + 0.5) or 0
end
-- Framework.GetPlayerPhone(src)
-- Returns the phone number of the player.
---@description Returns the phone number of the player.
---@param src number
---@return string | nil
Framework.GetPlayerPhone = function(src)
@@ -355,8 +348,7 @@ Framework.GetPlayerPhone = function(src)
return playerData.charinfo.phone
end
-- Framework.GetPlayerGang(src)
-- Returns the gang name of the player.
---@description Returns the gang name of the player.
---@param src number
---@return string | nil
Framework.GetPlayerGang = function(src)
@@ -366,32 +358,33 @@ Framework.GetPlayerGang = function(src)
return playerData.gang.name
end
---This will get a table of player sources that have the specified job name.
---@description This will get a table of player sources that have the specified job name.
---@param job string
---@return table
Framework.GetPlayersByJob = function(job)
return Framework.GetPlayerSourcesByJob(job) or {}
end
---Depricated: Returns the job name, label, grade name, and grade level of the player.
---@deprecated Deprecated: Returns the job name, label, grade name, and grade level of the player.
---@param src number
---@return string | string | string | number | nil
---@return string | string | string | number | nil
---@return string | string | string | number | nil
---@return string | string | string | number | nil
Framework.GetPlayerJob = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
print("[Community Bridge] Warning: Framework.GetPlayerJob is deprecated, use Framework.GetPlayerJobData instead.")
local jobData = Framework.GetPlayerJobData(src)
if not jobData then return end
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeLevel
end
---This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@description This will return the players job name, job label, job grade label job grade level, boss status,
---and duty status in a table
---@param src number
---@return table | nil
Framework.GetPlayerJobData = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return { } end
local playerData = player.PlayerData
local jobData = playerData.job
return {
@@ -405,21 +398,21 @@ Framework.GetPlayerJobData = function(src)
}
end
---Returns the players duty status.
---@description Returns the players duty status.
---@param src number
---@return boolean | nil
Framework.GetPlayerDuty = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return false end
local playerData = player.PlayerData
if not playerData.job.onduty then return false end
return true
end
---This will toggle a players duty status
---@param src number
---@param status boolean
---@return boolean
--- @description This will toggle a players duty status
--- @param src number
--- @param status boolean
--- @return boolean
Framework.SetPlayerDuty = function(src, status)
local player = Framework.GetPlayer(src)
if not player then return false end
@@ -428,86 +421,108 @@ Framework.SetPlayerDuty = function(src, status)
return true
end
-- Sets the player's job to the specified name and grade.
---@description Sets the player's job to the specified name and grade.
---@param src number
---@param name string
---@param grade string
---@return nil
Framework.SetPlayerJob = function(src, name, grade)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return false end
return player.Functions.SetJob(name, grade)
end
---This will add money based on the type of account (money/bank)
---@description This will add money based on the type of account (money/bank)
---@param src number
---@param _type string
---@param amount number
---@return boolean | nil
Framework.AddAccountBalance = function(src, _type, amount)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return false end
if _type == 'money' then _type = 'cash' end
if amount <= 0 then return false end
return player.Functions.AddMoney(_type, amount)
end
---This will remove money based on the type of account (money/bank)
---@description This will remove money based on the type of account (money/bank)
---@param src number
---@param _type string
---@param amount number
---@return boolean | nil
Framework.RemoveAccountBalance = function(src, _type, amount)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return false end
if _type == 'money' then _type = 'cash' end
return player.Functions.RemoveMoney(_type, amount)
end
---This will remove money based on the type of account (money/bank)
---@description This will remove money based on the type of account (money/bank)
---@param src number
---@param _type string
---@return string | nil
Framework.GetAccountBalance = function(src, _type)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return 0 end
local playerData = player.PlayerData
if _type == 'money' then _type = 'cash' end
return playerData.money[_type]
end
-- Framework.AddItem(src, item, amount, slot, metadata)
-- Adds the specified item to the player's inventory.
---@description This will add an item, and return true or false based on success
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.AddItem = function(src, item, amount, slot, metadata)
---@param count number
---@param slot number (optional)
---@param metadata table (optional)
---@return boolean
Framework.AddItem = function(src, item, count, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = amount, slot = slot, metadata = metadata })
return player.Functions.AddItem(item, amount, slot, metadata)
if not player then return false end
local success = player.Functions.AddItem(item, count, slot, metadata)
if not success then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = count, slot = slot, metadata = metadata })
return success
end
-- Framework.RemoveItem(src, item, amount, slot, metadata)
-- Removes the specified item from the player's inventory.
---@description Internal function to search for items with specific metadata in player inventory
---@param src number
---@param metadata table
---@return boolean, number|nil
local function runMetadataSearch(src, metadata)
local inv = Framework.GetPlayerInventory(src) or {}
for k, v in pairs(inv) do
if v.metadata and v.metadata == metadata then
return true, v.slot
end
end
return false
end
---@description This will remove an item, and return true or false based on success
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.RemoveItem = function(src, item, amount, slot, metadata)
---@param count number
---@param slot number (optional)
---@param metadata table (optional)
---@return boolean
Framework.RemoveItem = function(src, item, count, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "remove", item = item, count = amount, slot = slot, metadata = metadata })
return player.Functions.RemoveItem(item, amount, slot or nil)
if not player then return false end
if metadata then
local found, itemSlot = runMetadataSearch(src, metadata)
if found then
slot = itemSlot
end
end
local success = player.Functions.RemoveItem(item, count, slot)
if not success then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "remove", item = item, count = count, slot = slot, metadata = metadata })
return success
end
-- Framework.SetMetadata(src, item, slot, metadata)
-- Sets the metadata for the specified item in the player's inventory.
-- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
---@description This will set the metadata of an item in the inventory.
---@param src number
---@param item string
---@param slot number
@@ -515,23 +530,95 @@ end
---@return boolean | nil
Framework.SetMetadata = function(src, item, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
local slotFinder = Framework.GetPlayerInventory(src)
local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder)
local itemSlot = slot or nil
if itemSlot == nil then
for _, v in pairs(slotFinder) do
if v.name == item then
slot = v.slot
break
end
end
end
if not player.Functions.RemoveItem(item, 1, itemSlot) then return false end
return player.Functions.AddItem(item, 1, slot, metadata)
if not player then return false end
local success = Framework.RemoveItem(src, item, 1, slot, nil)
if not success then return false end
Framework.AddItem(src, item, 1, slot, metadata)
end
---This will get all owned vehicles for the player
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
---@param item string
---@return table
Framework.GetItemInfo = function(item)
local itemData = QBCore.Shared.Items[item]
if not itemData then return {} end
return {
name = itemData.name,
label = itemData.label or itemData.name,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = itemData.image
}
end
---@description This will return the count of the item in the players inventory, if not found will return 0.
--- This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param metadata table (optional)
---@return number
Framework.GetItemCount = function(src, item, metadata)
local player = Framework.GetPlayer(src)
if not player then return 0 end
local playerData = player.PlayerData
local playerInventory = playerData.items
local count = 0
for _, v in pairs(playerInventory) do
if v.name == item and (not metadata or v.info == metadata) then
count = count + (v.amount or v.count)
end
end
return count
end
---@description This will return a boolean if the player has the item.
---@param src number
---@param item string
---@param requiredCount number (optional)
---@return boolean
Framework.HasItem = function(src, item, requiredCount)
local getCount = Framework.GetItemCount(src, item, nil)
return getCount >= (requiredCount or 1)
end
---@description This wil return the players inventory.
---@param src number
---@return table
Framework.GetPlayerInventory = function(src)
local player = Framework.GetPlayer(src)
if not player then return {} end
local playerData = player.PlayerData
local playerInventory = playerData.items
local repackedTable = {}
for _, v in pairs(playerInventory) do
table.insert(repackedTable, {
name = v.name,
count = v.amount or v.count,
metadata = v.info,
slot = v.slot,
})
end
return repackedTable
end
---@description Returns the specified slot data as a table.
---@param src number
---@param slot number
---@return table {name, label, weight, count, metadata, slot, stack, description, image}
Framework.GetItemBySlot = function(src, slot)
local inventory = Framework.GetPlayerInventory(src)
if not inventory or #inventory == 0 then return {} end
for _, v in pairs(inventory) do
if v.slot == slot then
local itemInfo = Framework.GetItemInfo(v.name)
return {v.name, itemInfo.label or v.name, itemInfo.weight or 0, v.count or 0, v.metadata or {}, v.slot, itemInfo.stack or false, itemInfo.description or "No description available", itemInfo.image or nil}
end
end
return {}
end
---@description This will get all owned vehicles for the player
---@param src number
---@return table
Framework.GetOwnedVehicles = function(src)
@@ -546,8 +633,7 @@ Framework.GetOwnedVehicles = function(src)
return vehicles
end
-- Framework.RegisterUsableItem(item, cb)
-- Registers a usable item with a callback function.
---@description Registers a usable item with a callback function.
---@param itemName string
---@param cb function
Framework.RegisterUsableItem = function(itemName, cb)
@@ -560,6 +646,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
QBCore.Functions.CreateUseableItem(itemName, func)
end
---@description Event handler for when a player is loaded in QB-Core framework
---@param src number
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
src = src or source
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
@@ -568,23 +656,37 @@ RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
Framework.AddJobCount(src, jobData.jobName)
end)
---@description Event handler for when a player is unloaded in QB-Core framework
---@param src number
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
src = src or source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
---@description Event handler for when a player's job is updated in QB-Core framework
---@param src number
---@param job table
RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job)
src = src or source
if not job then return end
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
end)
---@description Event handler for when a player disconnects from the server
AddEventHandler("playerDropped", function()
local src = source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
Framework.Commands = {}
---@description Adds a command to the QB-Core framework
---@param name string
---@param help string
---@param arguments table
---@param argsrequired boolean
---@param callback function
---@param permission string
---@param ... any
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission, ...)
end
+51 -62
View File
@@ -5,46 +5,45 @@ QBox = exports.qbx_core
Framework = Framework or {}
---This will get the name of the framework being used (if a supported framework).
---@description This will get the name of the framework being used (if a supported framework).
---@return string
Framework.GetFrameworkName = function()
return 'qbx_core'
print("This is depricated, please use Framework.GetResourceName() instead.")
return Framework.GetResourceName()
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'qbx_core'
end
---This will return true if the player is loaded, false otherwise.
---This could be useful in scripts that rely on player loaded events and offer a debug mode to hit this function.
---@description This will return true if the player is loaded, false otherwise.
---@return boolean
Framework.GetIsPlayerLoaded = function()
return LocalPlayer.state.isLoggedIn or false
end
---This will return a table of the player data, this will be in the framework format.
---This is mainly for internal bridge use and should be avoided.
---@description This is an internal function, do not use this outside of bridge as there is no standard format between the frameworks.
---@return table
Framework.GetPlayerData = function()
return QBox.GetPlayerData()
end
---This will return a table of all the jobs in the framework.
---@description This will return a table of all the jobs in the framework.
---@return table
Framework.GetFrameworkJobs = function()
return QBox.GetJobs()
end
---This will get the players birth date
---@description This will get the players birth date
---@return string
Framework.GetPlayerDob = function()
local playerData = Framework.GetPlayerData()
return playerData.charinfo.birthdate
end
---Will Display the help text message on the screen
---@description Will Display the help text message on the screen
---@param message string
---@param position string
---@return nil
@@ -52,20 +51,20 @@ Framework.ShowHelpText = function(message, position)
return exports.ox_lib:showTextUI(message, { position = position or 'top-center' })
end
---This will hide the help text message on the screen
---@description This will hide the help text message on the screen
---@return nil
Framework.HideHelpText = function()
return exports.ox_lib:hideTextUI()
end
---This will return the players metadata for the specified metadata key.
---@description This will return the players metadata for the specified metadata key.
---@param metadata table | string
---@return table | string | number | boolean
Framework.GetPlayerMetaData = function(metadata)
return Framework.GetPlayerData().metadata[metadata]
end
---This will send a notification to the player.
---@description This will send a notification to the player.
---@param message string
---@param type string
---@param time number
@@ -74,27 +73,27 @@ Framework.Notify = function(message, type, time)
return QBox:Notify("Notification", type, time, message)
end
---This will get the hunger of a player
---@description This will get the hunger of a player
---@return number
Framework.GetHunger = function()
local hunger = Framework.GetPlayerMetaData("hunger") or 0
return math.floor((hunger) + 0.5) or 0
end
---This will get the thirst of a player
---@description This will get the thirst of a player
---@return number
Framework.GetThirst = function()
local thirst = Framework.GetPlayerMetaData("thirst") or 0
return math.floor((thirst) + 0.5) or 0
end
---This will get the players identifier (citizenid) etc.
---@description This will get the players identifier (citizenid) etc.
---@return string
Framework.GetPlayerIdentifier = function()
return Framework.GetPlayerData().citizenid
end
---This will get the players name (first and last).
---@description This will get the players name (first and last).
---@return string
---@return string
Framework.GetPlayerName = function()
@@ -102,17 +101,18 @@ Framework.GetPlayerName = function()
return playerData.charinfo.firstname, playerData.charinfo.lastname
end
---Depricated : This will return the players job name, job label, job grade label and job grade level
---@description Depricated : This will return the players job name, job label, job grade label and job grade level
---@return string
---@return string
---@return string
---@return string
Framework.GetPlayerJob = function()
local playerData = Framework.GetPlayerData()
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
print("This is depricated, please use Framework.GetPlayerJobData() instead.")
local jobData = Framework.GetPlayerJobData()
return jobData.jobName, jobData.jobLabel, jobData.gradeName, jobData.gradeRank
end
---This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@return table
Framework.GetPlayerJobData = function()
local playerData = Framework.GetPlayerData()
@@ -128,13 +128,13 @@ Framework.GetPlayerJobData = function()
}
end
---This will return the players inventory as a table in the ox_inventory style flormat.
---@return table
---@description This is an internal function used as a fallback, please use the Inventory.GetPlayerInventory instead.
---@return table {name, label, count, slot, metadata, stack, close, weight}
Framework.GetPlayerInventory = function()
return Framework.GetPlayerData().items
end
---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---@description This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---Use case is for a ui or a menu I guess.
---@param _type string
---@return number
@@ -143,64 +143,53 @@ Framework.GetAccountBalance = function(_type)
if not player then return 0 end
local account = player.money
if _type == 'money' then _type = 'cash' end
return account[_type] or 0
local balance = account[_type] or 0
if balance <= 0 then return 0 end
return balance
end
---This will return the vehicle properties for the specified vehicle.
---@param vehicle number
---@return table
Framework.GetVehicleProperties = function(vehicle)
if not vehicle or not DoesEntityExist(vehicle) then return {} end
local vehicleProps = lib.getVehicleProperties(vehicle)
return vehicleProps or {}
end
---This will set the vehicle properties for the specified vehicle.
---@param vehicle number
---@param properties table
---@return boolean
Framework.SetVehicleProperties = function(vehicle, properties)
if not vehicle or not DoesEntityExist(vehicle) then return false end
if not properties then return false end
if NetworkGetEntityIsNetworked(vehicle) then
local vehNetID = NetworkGetNetworkIdFromEntity(vehicle)
local entOwner = GetPlayerServerId(NetworkGetEntityOwner(vehNetID))
if entOwner ~= GetPlayerServerId(PlayerId()) then
NetworkRequestControlOfEntity(vehicle)
local count = 0
while not NetworkHasControlOfEntity(vehicle) and count < 3000 do
Wait(1)
count = count + 1
end
end
end
return true, lib.setVehicleProperties(vehicle, properties)
end
---This will return the item count for the specified item in the players inventory.
---@param item string
---@return number
---@description This is an internal function used as a fallback, please use the Inventory.GetItemCount instead.
--- @param item string
--- @return number
Framework.GetItemCount = function(item)
-- This seems to be exclusively for ox_inventory, if other inventories are used, they need to be bridged in the inventory module. Until then we will return 0 and a print.
return 0, print("Community_bridge:WARN: GetItemCount is not implemented for this framework, please use the inventory module to get the item count. If you are using a diffrent inventory please let us know so we can bridge it and have less nonsense.")
return 0, print("Qbox has not implemented GetItemCount for this framework. Please ensure the inventory you are using is supported and start order is correct.")
end
---This will get a players dead status.
---@description This will return the item data for the specified item.
--- @param item string
--- @return table {name, label, stack, weight, description, image}
Framework.GetItemInfo = function(item)
return {}, print("Qbox has not implemented GetItemInfo for this framework. Please ensure the inventory you are using is supported and start order is correct.")
end
---@description Will return boolean if the player has the item.
---@param item string
---@param requiredCount number (optional)
---@return boolean
Framework.HasItem = function(item, requiredCount)
return false, print("Qbox has not implemented HasItem for this framework, Please ensure the inventory you are using is supported and start order is correct.")
end
---@description This will get a players dead status.
---@return boolean
Framework.GetIsPlayerDead = function()
local playerData = Framework.GetPlayerData()
return playerData.metadata["isdead"] or playerData.metadata["inlaststand"]
end
---@description Event handler for when player is loaded in QBX Core framework
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
Wait(1500)
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
end)
---@description Event handler for when player is unloaded in QBX Core framework
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
TriggerEvent('community_bridge:Client:OnPlayerUnload')
end)
---@description Event handler for when player job is updated in QBX Core framework
---@param data table Job data containing name, label, and grade information
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(data)
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', data.name, data.label, data.grade.name, data.grade.level)
end)
+114 -94
View File
@@ -5,27 +5,27 @@ Framework = Framework or {}
local QBox = exports.qbx_core
---Returns the name of the framework being used (if a supported framework).
---@description Returns the name of the framework being used (if a supported framework).
---@return string
Framework.GetFrameworkName = function()
return 'qbx_core'
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'qbx_core'
end
---This will return if the player is an admin in the framework.
---@param src any
---@description This will return if the player is an admin in the framework.
---@param src number
---@return boolean
Framework.GetIsFrameworkAdmin = function(src)
if not src then return false end
return IsPlayerAceAllowed(src, 'admin')
end
---Returns the player date of birth.
---@description Returns the player date of birth.
---@param src number
---@return string|nil
Framework.GetPlayerDob = function(src)
@@ -35,7 +35,7 @@ Framework.GetPlayerDob = function(src)
return playerData.charinfo.birthdate
end
--- Returns the player data of the specified source.
---@description Returns the player data of the specified source.
---@param src any
---@return table | nil
Framework.GetPlayer = function(src)
@@ -44,13 +44,13 @@ Framework.GetPlayer = function(src)
return player
end
---Returns a table of the jobs in the framework.
---@description Returns a table of the jobs in the framework.
---@return table
Framework.GetFrameworkJobs = function()
return QBox.GetJobs()
end
---Returns the citizen ID of the player.
---@description Returns the citizen ID of the player.
---@param src number
---@return string | boolean | nil
Framework.GetPlayerIdentifier = function(src)
@@ -61,7 +61,7 @@ Framework.GetPlayerIdentifier = function(src)
return playerData.citizenid
end
---This will return a table of all logged in players
---@description This will return a table of all logged in players
---@return table
Framework.GetPlayers = function()
local players = QBox:GetQBPlayers()
@@ -72,7 +72,7 @@ Framework.GetPlayers = function()
return playerList
end
---Returns the first and last name of the player.
---@description Returns the first and last name of the player.
---@param src number
---@return string | nil
---@return string | nil
@@ -83,63 +83,110 @@ Framework.GetPlayerName = function(src)
return playerData.charinfo.firstname, playerData.charinfo.lastname
end
---Returns a table of items matching the specified name and if passed metadata from the player's inventory.
---@description Adds the specified item to the player's inventory.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.AddItem = function(src, item, amount, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = amount, slot = slot, metadata = metadata })
return player.Functions.AddItem(item, amount, slot, metadata)
end
---@description Removes the specified item from the player's inventory.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "remove", item = item, count = amount, slot = slot, metadata = metadata })
return player.Functions.RemoveItem(item, amount, slot)
end
---@description Sets the metadata for the specified item in the player's inventory.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.SetMetadata = function(src, item, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return false end
player.Functions.RemoveItem(item, 1, slot)
return player.Functions.AddItem(item, 1, slot, metadata)
end
---@description Returns a table of items matching the specified name and if passed metadata from the player's inventory.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
---@param src number
---@param item string
---@param metadata table
---@return table|nil
---@return table|nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
local playerInventory = player.PlayerData.items
if not player then return { } end
local repackedTable = {}
for _, v in pairs(playerInventory) do
for _, v in pairs(player.PlayerData.items) do
if v.name == item and (not metadata or v.info == metadata) then
table.insert(repackedTable, {
repackedTable[#repackedTable + 1] = {
name = v.name,
count = v.amount,
metadata = v.info,
count = v.amount or v.count,
metadata = v.info or v.metadata,
slot = v.slot,
})
}
end
end
return repackedTable
end
---Returns the count of items matching the specified name and if passed metadata from the player's inventory.
---@description Returns the count of items matching the specified name and if passed metadata from the player's inventory.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@param metadata table
---@return number | nil
Framework.GetItemCount = function(src, item, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return 0 end
local playerInventory = player.PlayerData.items
local count = 0
for _, v in pairs(playerInventory) do
if v.name == item and (not metadata or v.info == metadata) then
count = count + v.amount
count = count + (v.amount or v.count)
end
end
return count
end
---Returns boolean if the player has the specified item in their inventory.
---@description Returns boolean if the player has the specified item in their inventory.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@param item string
---@return boolean
Framework.HasItem = function(src, item)
local getCount = Framework.GetItemCount(src, item, nil)
local getCount = Framework.GetItemCount(src, item)
return getCount > 0
end
---Returns the entire inventory of the player as a table.
---@description Returns the entire inventory of the player as a table.
---This is an internal function and should not be used outside of bridge, use the Inventory module instead when dealing with items.
---@param src number
---@return table | nil
Framework.GetPlayerInventory = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return { } end
local playerItems = player.PlayerData.items
local repackedTable = {}
for _, v in pairs(playerItems) do
@@ -153,7 +200,7 @@ Framework.GetPlayerInventory = function(src)
return repackedTable
end
---Adds the specified metadata key and number value to the player's data.
---@description Adds the specified metadata key and number value to the player's data.
---@param src number
---@param metadata string
---@param value string
@@ -165,7 +212,7 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
return true
end
---Gets the specified metadata key to the player's data.
---@description Gets the specified metadata key to the player's data.
---@param src number
---@param metadata string
---@return string | boolean | nil
@@ -176,7 +223,7 @@ Framework.GetPlayerMetadata = function(src, metadata)
return playerData.metadata[metadata] or false
end
---Adds the specified value to the player's stress level and updates the client HUD.
---@description Adds the specified value to the player's stress level and updates the client HUD.
---@param src number
---@param value number
---@return number | nil
@@ -190,7 +237,7 @@ Framework.AddStress = function(src, value)
return newStress
end
---Removes the specified value from the player's stress level and updates the client HUD.
---@description Removes the specified value from the player's stress level and updates the client HUD.
---@param src number
---@param value number
---@return number | nil
@@ -204,7 +251,7 @@ Framework.RemoveStress = function(src, value)
return newStress
end
---Adds the specified value from the player's hunger level.
---@description Adds the specified value from the player's hunger level.
---@param src number
---@param value number
---@return number | nil
@@ -218,7 +265,7 @@ Framework.AddHunger = function(src, value)
return newHunger
end
---Adds the specified value from the player's thirst level.
---@description Adds the specified value from the player's thirst level.
---@param src number
---@param value number
---@return number | nil
@@ -232,28 +279,28 @@ Framework.AddThirst = function(src, value)
return newThirst
end
---This will return the players hunger level.
---@description This will return the players hunger level.
---@param src number
---@return number | nil
Framework.GetHunger = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return 0 end
local playerData = player.PlayerData
local newHunger = (playerData.metadata.hunger or 0)
return math.floor((newHunger) + 0.5) or 0
end
---This will return a boolean if the player is dead or in last stand.
---@description This will return a boolean if the player is dead or in last stand.
---@param src number
---@return boolean|nil
Framework.GetIsPlayerDead = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return false end
local playerData = player.PlayerData
return playerData.metadata.isdead or false
end
---This will revive a player, if the player is dead or in last stand.
---@description This will revive a player, if the player is dead or in last stand.
---@param src number
---@return boolean
Framework.RevivePlayer = function(src)
@@ -263,18 +310,18 @@ Framework.RevivePlayer = function(src)
return true
end
---This will return the players thirst level.
---@description This will return the players thirst level.
---@param src number
---@return number| nil
Framework.GetThirst = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
if not player then return 0 end
local playerData = player.PlayerData
local newThirst = (playerData.metadata.thirst or 0)
return math.floor((newThirst) + 0.5) or 0
end
---Returns the phone number of the player.
---@description Returns the phone number of the player.
---@param src number
---@return string | nil
Framework.GetPlayerPhone = function(src)
@@ -284,7 +331,7 @@ Framework.GetPlayerPhone = function(src)
return playerData.charinfo.phone
end
---Returns the gang name of the player.
---@description Returns the gang name of the player.
---@param src number
---@return string | nil
Framework.GetPlayerGang = function(src)
@@ -292,14 +339,15 @@ Framework.GetPlayerGang = function(src)
return player.gang.name
end
---This will get a table of player sources that have the specified job name.
---@description This will get a table of player sources that have the specified job name.
---@param job string
---@return table
Framework.GetPlayersByJob = function(job)
return Framework.GetPlayerSourcesByJob(job) or {}
end
---Depricated: Returns the job name, label, grade name, and grade level of the player.
---@description Depricated: Returns the job name, label, grade name, and grade level of the player.
---Please use GetPlayerJobData instead.
---@param src number
---@return string | string | string | number | nil
---@return string | string | string | number | nil
@@ -309,10 +357,11 @@ Framework.GetPlayerJob = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
print("This function is depricated, please use GetPlayerJobData instead.")
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
end
---This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@description This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@param src number
---@return table | nil
Framework.GetPlayerJobData = function(src)
@@ -331,7 +380,7 @@ Framework.GetPlayerJobData = function(src)
}
end
---Sets the player's job to the specified name and grade.
---@description Sets the player's job to the specified name and grade.
---@param src number
---@param name string
---@param grade string
@@ -342,7 +391,7 @@ Framework.SetPlayerJob = function(src, name, grade)
return player.Functions.SetJob(name, grade)
end
---This will toggle the duty status of the player.
---@description This will toggle the duty status of the player.
---@param src number
---@param status boolean
Framework.SetPlayerDuty = function(src, status)
@@ -353,7 +402,7 @@ Framework.SetPlayerDuty = function(src, status)
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
end
---Returns the players duty status.
---@description Returns the players duty status.
---@param src number
---@return boolean | nil
Framework.GetPlayerDuty = function(src)
@@ -364,7 +413,7 @@ Framework.GetPlayerDuty = function(src)
return true
end
---Adds the specified amount to the player's account balance of the specified type.
---@description Adds the specified amount to the player's account balance of the specified type.
---@param src number
---@param _type string
---@param amount number
@@ -373,10 +422,11 @@ Framework.AddAccountBalance = function(src, _type, amount)
local player = Framework.GetPlayer(src)
if not player then return end
if _type == 'money' then _type = 'cash' end
if amount <= 0 then return false end
return player.Functions.AddMoney(_type, amount)
end
---Removes the specified amount from the player's account balance of the specified type.
---@description Removes the specified amount from the player's account balance of the specified type.
---@param src number
---@param _type string
---@param amount number
@@ -385,10 +435,11 @@ Framework.RemoveAccountBalance = function(src, _type, amount)
local player = Framework.GetPlayer(src)
if not player then return end
if _type == 'money' then _type = 'cash' end
if amount <= 0 then return false end
return player.Functions.RemoveMoney(_type, amount)
end
---Returns the player's account balance of the specified type.
---@description Returns the player's account balance of the specified type.
---@param src number
---@param _type string
---@return number | nil
@@ -397,51 +448,12 @@ Framework.GetAccountBalance = function(src, _type)
if not player then return end
local playerData = player.PlayerData
if _type == 'money' then _type = 'cash' end
return playerData.money[_type]
local balance = playerData.money[_type] or 0
if balance <= 0 then return 0 end
return balance
end
---Adds the specified item to the player's inventory.
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.AddItem = function(src, item, amount, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "add", item = item, count = amount, slot = slot, metadata = metadata })
return player.Functions.AddItem(item, amount, slot, metadata)
end
---Removes the specified item from the player's inventory.
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, { action = "remove", item = item, count = amount, slot = slot, metadata = metadata })
return player.Functions.RemoveItem(item, amount, slot)
end
---Sets the metadata for the specified item in the player's inventory.
---@param src number
---@param item string
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.SetMetadata = function(src, item, slot, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
player.Functions.RemoveItem(item, 1, slot)
return player.Functions.AddItem(item, 1, slot, metadata)
end
---Returns a table of owned vehicles for the player. format is {vehicle = vehicle, plate = plate}
---@description Returns a table of owned vehicles for the player. format is {vehicle = vehicle, plate = plate}
---@param src number
---@return table
Framework.GetOwnedVehicles = function(src)
@@ -456,7 +468,7 @@ Framework.GetOwnedVehicles = function(src)
return vehicles
end
---Registers a usable item with a callback function.
---@description Registers a usable item with a callback function.
---@param itemName string
---@param cb function
---@return function
@@ -470,6 +482,8 @@ Framework.RegisterUsableItem = function(itemName, cb)
return QBox:CreateUseableItem(itemName, func)
end
---@description Event handler for when a player is loaded in QBX Core framework
---@param src number
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
src = src or source
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
@@ -478,17 +492,23 @@ RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function(src)
Framework.AddJobCount(src, jobData.jobName)
end)
---@description Event handler for when a player is unloaded in QBX Core framework
---@param src number
RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src)
src = src or source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
---@description Event handler for when a player's job is updated in QBX Core framework
---@param src number
---@param job table
RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job)
src = src or source
if not job then return end
TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name)
end)
---@description Event handler for when a player disconnects from the server
AddEventHandler("playerDropped", function()
local src = source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
+3 -4
View File
@@ -2,14 +2,13 @@
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return 'default'
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -17,7 +16,7 @@ Fuel.GetFuel = function(vehicle)
return GetVehicleFuelLevel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "BigDaddy-Fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['BigDaddy-Fuel']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "cdn-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['cdn-fuel']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "esx-sna-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['esx-sna-fuel']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "lc_fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports["lc_fuel"]:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -4,14 +4,13 @@ if GetResourceState(resourceName) == 'missing' then return end
if GetResourceState("qb-fuel") == 'started' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -19,7 +18,7 @@ Fuel.GetFuel = function(vehicle)
return exports['LegacyFuel']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "okokGasStation"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['okokGasStation']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "ox_fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return Entity(vehicle).state.fuel
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "ps-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports["ps-fuel"]:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "qb-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['qb-fuel']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "qs-fuelstations"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['qs-fuelstations']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "Renewed-Fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -18,7 +17,7 @@ Fuel.GetFuel = function(vehicle)
return exports['Renewed-Fuel']:GetFuel(vehicle)
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "ti_fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -19,7 +18,7 @@ Fuel.GetFuel = function(vehicle)
return level
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+3 -4
View File
@@ -3,14 +3,13 @@ local resourceName = "x-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@description Returns the name of the active fuel resource.
---@return string
Fuel.GetResourceName = function()
return resourceName
end
---Returns the current fuel level of a vehicle.
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
@@ -19,7 +18,7 @@ Fuel.GetFuel = function(vehicle)
return level
end
---Sets the fuel level of a vehicle.
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
+18 -21
View File
@@ -1,40 +1,41 @@
---@diagnostic disable: duplicate-set-field
Inventory = Inventory or {}
---Return the item info in oxs format, {name, label, stack, weight, description, image}
---@description This will get the name of the in use resource.
---@return string
Inventory.GetResourceName = function()
return "default"
end
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
---@param item string
---@return table
Inventory.GetItemInfo = function(item)
return Framework.GetItemInfo(item)
end
---This will get the name of the in use resource.
---@return string
Inventory.GetResourceName = function()
return "default"
end
---Will return boolean if the player has the item.
---@description Will return boolean if the player has the item.
---@param item string
---@param requiredCount number (optional)
---@return boolean
Inventory.HasItem = function(item)
return Framework.HasItem(item)
Inventory.HasItem = function(item, requiredCount)
return Framework.HasItem(item, requiredCount)
end
---This will return th count of the item in the players inventory, if not found will return 0.
---@description This will return their count of the item in the players inventory, if not found will return 0.
---@param item string
---@return number
Inventory.GetItemCount = function(item)
return Framework.GetItemCount(item)
end
---This will return the players inventory in the format of {name, label, count, slot, metadata}
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
---@return table
Inventory.GetPlayerInventory = function()
return Framework:GetPlayerInventory()
end
---This will get the image path for this item, if not found will return placeholder.
---@description This will get the image path for this item, if not found will return placeholder.
---@param item string
---@return string
Inventory.GetImagePath = function(item)
@@ -42,8 +43,7 @@ Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135"
end
---This will remove the file extension from the item name if present.
---example: "item.png" will become "item"
---@description This will remove the file extension from the item name if present.
---@param item string
---@return string
Inventory.StripPNG = function(item)
@@ -53,8 +53,7 @@ Inventory.StripPNG = function(item)
return item
end
---This will remove the file extension from the item name if present.
---example: "item.webp" will become "item"
---@description This will remove the file extension from the item name if present.
---@param item string
---@return string
Inventory.StripWebp = function(item)
@@ -64,8 +63,8 @@ Inventory.StripWebp = function(item)
return item
end
---This will return the entire items table from the inventory.
---@return table
---@description This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
if not Framework.Shared or not Framework.Shared.Items then
local itemList = Framework.ItemList() or { Items = {} }
@@ -74,6 +73,4 @@ Inventory.Items = function()
return Framework.Shared.Items
end
return Inventory
+54 -61
View File
@@ -1,7 +1,14 @@
---@diagnostic disable: duplicate-set-field
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
---This will add an item, and return true or false based on success
---@description This will get the name of the in use resource.
---@return string
Inventory.GetResourceName = function()
return "default"
end
---@description This will add an item, and return true or false based on success
---@param src number
---@param item string
---@param count number
@@ -9,18 +16,13 @@ Inventory = Inventory or {}
---@param metadata table
---@return boolean
Inventory.AddItem = function(src, item, count, slot, metadata)
local success = Framework.AddItem(src, item, count, slot, metadata)
if not success then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return Framework.AddItem(src, item, count, slot, metadata)
return success
end
---This will get the name of the in use resource.
---@return string
Inventory.GetResourceName = function()
return "default"
end
---This will remove an item, and return true or false based on success
---@description This will remove an item, and return true or false based on success
---@param src number
---@param item string
---@param count number
@@ -29,36 +31,36 @@ end
---@return boolean
Inventory.RemoveItem = function(src, item, count, slot, metadata)
item = type(item) == "table" and item.name or item
local success = Framework.RemoveItem(src, item, count, slot, metadata)
if not success then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return Framework.RemoveItem(src, item, count, slot, metadata)
return success
end
---This will add items to a trunk, and return true or false based on success
---@description This will add items to a trunk, and return true or false based on success
---@param identifier string
---@param items table
---@return boolean
Inventory.AddTrunkItems = function(identifier, items)
return false, Prints.Error("This Inventory Has Not Been Bridged For A Trunk Feature.")
return false, print("This Inventory Has Not Been Bridged For A Trunk Feature.")
end
---This will clear the specified inventory, will return success or failure.
---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly.
---@param id string
---@return boolean
Inventory.ClearStash = function(id, _type)
if type(id) ~= "string" then return false end
if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end
return false, Prints.Error("This Inventory Has Not Been Bridged For A ClearStash Feature.")
return false, print("This Inventory Has Not Been Bridged For A ClearStash Feature.")
end
---This will return a table with the item info,
---example: {name = "coolitem", label = "a cool item name", stack = false, weight = 1000, description = "some item description", image = "coolitem.png"}
---@description This will return a table with the item info, {name, label, stack, weight, description, image}
---@param item string
---@return table
Inventory.GetItemInfo = function(item)
return Framework.GetItemInfo(item)
end
---This will return the entire items table from the inventory.
---@description This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
if not Framework.Shared or not Framework.Shared.Items then
@@ -68,35 +70,31 @@ Inventory.Items = function()
return Framework.Shared.Items
end
---This will return the count of the item in the players inventory, if not found will return 0.
---if metadata is passed it will find the matching items count.
---example: 0
---@description This will return the count of the item in the players inventory, if not found will return 0.
---@param src number
---@param item string
---@param metadata table
---@param metadata table (optional)
---@return number
Inventory.GetItemCount = function(src, item, metadata)
return Framework.GetItemCount(src, item, metadata)
end
---This wil return the players inventory.
---example: {{weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}, {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 2, label = "stinky", count = 1}}
---@description This wil return the players inventory.
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src)
return Framework.GetPlayerInventory(src)
end
---Returns the specified slot data as a table.
---example {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}
---@description Returns the specified slot data as a table.
---@param src number
---@param slot number
---@return table
---@return table {weight, name, metadata, slot, label, count}
Inventory.GetItemBySlot = function(src, slot)
return Framework.GetItemBySlot(src, slot)
end
---This will set the metadata of an item in the inventory.
---@description This will set the metadata of an item in the inventory.
---@param src number
---@param item string
---@param slot number
@@ -106,74 +104,65 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
return Framework.SetMetadata(src, item, slot, metadata)
end
---This will open the specified stash for the src passed.
---@description This will open the specified stash for the src passed.
---@param src number
---@param _type string
---@param id number|string
---@param _type string "stash", "trunk", "glovebox"
---@param id string
---@return nil
Inventory.OpenStash = function(src, _type, id)
_type = _type or "stash"
local tbl = Inventory.Stashes[id]
return false, Prints.Error("This Inventory Has Not Been Bridged For A Stash Feature.")
return false, print("This Inventory Has Not Been Bridged For A Stash Feature.")
end
---This will register a stash
---@description This will register a stash
---@param id number|string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@param owner string (optional)
---@param groups table (optional)
---@param coords table (optional)
---@return boolean
---@return string|number
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true, id end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
Inventory.Stashes[id] = {id = id, label = label, slots = slots, weight = weight, owner = owner, groups = groups, coords = coords}
return true, id
end
---This will return a boolean if the player has the item.
---@description This will return a boolean if the player has the item.
---@param src number
---@param item string
---@param requiredCount number (optional)
---@return boolean
Inventory.HasItem = function(src, item)
return Framework.HasItem(src, item)
Inventory.HasItem = function(src, item, requiredCount)
return Framework.HasItem(src, item, requiredCount)
end
---This is to get if there is available space in the inventory, will return boolean.
---@description This is to get if there is available space in the inventory, will return boolean.
---@param src number
---@param item string
---@param count number
---@return boolean
Inventory.CanCarryItem = function(src, item, count)
return false, Prints.Error("This Inventory Has Not Been Bridged For A CanCarryItem Feature.")
return true, print("This Inventory Has Not Been Bridged For A CanCarryItem Feature.")
end
---This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it)
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate)
return false, Prints.Error("This Inventory Has Not Been Bridged For A UpdatePlate Feature.")
return false, print("This Inventory Has Not Been Bridged For A UpdatePlate Feature.")
end
-- This will open the specified shop for the src passed.
---@description This will open the specified shop for the src passed.
---@param src number
---@param shopTitle string
Inventory.OpenShop = function(src, shopTitle)
return Bridge.Shops.OpenShop(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
---@description This will register a shop, if it already exists it will return true.
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
@@ -182,14 +171,14 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou
return Bridge.Shops.CreateShop(shopTitle, shopInventory, shopCoords, shopGroups)
end
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
---@param item string
---@return string
Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135"
end
---This will remove the file extension from the item name if present.
---@description This will remove the file extension from the item name if present.
---example: "item.png" will become "item"
---@param item string
---@return string
@@ -200,7 +189,7 @@ Inventory.StripPNG = function(item)
return item
end
---This will remove the file extension from the item name if present.
---@description This will remove the file extension from the item name if present.
---example: "item.webp" will become "item"
---@param item string
---@return string
@@ -211,8 +200,12 @@ Inventory.StripWebp = function(item)
return item
end
---@description Opens another player's inventory for inspection/interaction
---@param src number The source player who is opening the inventory
---@param targetSrc number The target player whose inventory is being opened
---@return boolean
Inventory.OpenPlayerInventory = function(src, targetSrc)
return false, Prints.Error("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.")
return false, print("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.")
end
return Inventory
+30 -36
View File
@@ -1,61 +1,60 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('codem-inventory') ~= 'started' then return end
if GetResourceState('codem-inventory') == 'missing' then return end
Inventory = Inventory or {}
local codem = exports['codem-inventory']
---Return the item info in oxs format, {name, label, stack, weight, description, image}
---@param item string
---@return table
Inventory.GetItemInfo = function(item)
local itemData = codem:GetItemList(item)
if not itemData then return {} end
local image = itemData.image and Inventory.GetImagePath(itemData.image) or Inventory.GetImagePath(item)
return {
name = itemData.name or "Missing Name",
label = itemData.label or "Missing Label",
stack = itemData.unique or "false",
weight = itemData.weight or "0",
description = itemData.description or "none",
image = image,
}
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Inventory.GetResourceName = function()
return "codem-inventory"
end
---This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return codem:GetItemList()
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
---@param item string
---@return table
Inventory.GetItemInfo = function(item)
local itemData = Inventory.Items()
if not itemData or not itemData[item] then return {} end
local image = Inventory.GetImagePath(itemData[item].image) or Inventory.GetImagePath(item)
return {
name = itemData[item].name or "Missing Name",
label = itemData[item].label or "Missing Label",
stack = itemData[item].unique or "false",
weight = itemData[item].weight or "0",
description = itemData[item].description or "none",
image = image,
}
end
---This will get the image path for this item, if not found will return placeholder.
---@description This will return the entire items table from the inventory.
---@return table
Inventory.Items = function()
return codem:GetItemList() or {}
end
---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
---@param item string
---@return string
Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item)
local file = LoadResourceFile("codem-inventory", string.format("html/itemimages/%s.png", item))
local imagePath = file and string.format("nui://codem-inventory/html/itemimages/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end
---This will return the players inventory in the format of {name, label, count, slot, metadata}
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
---@return table
Inventory.GetPlayerInventory = function()
local items = {}
local inventory = codem:getUserInventory()
local inventory = codem:GetClientPlayerInventory()
for _, v in pairs(inventory) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
count = v.amount or v.count,
slot = v.slot,
metadata = v.info,
metadata = v.info or v.metadata or {},
stack = v.unique,
close = v.useable,
weight = v.weight
@@ -64,9 +63,4 @@ Inventory.GetPlayerInventory = function()
return items
end
RegisterNetEvent('community_bridge:client:codem-inventory:openStash', function(id, data)
if source ~= 65535 then return end
TriggerServerEvent('codem-inventory:server:openstash', id, data.slots, data.weight, data.label)
end)
return Inventory
Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff. Show more