mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-11-16 03:03:56 +00:00
minor adjustments for backend code
This commit is contained in:
1 parent
71c0abb32c
commit
b891701359
5 files changed
+34
-6
No files matched your search
+1
-1
@@ -462,7 +462,7 @@ local invWeightTable = {
|
||||
[Exports.PSInv] = { file = "config.lua", path = { "MaxInventoryWeight" }, slotPath = { "MaxInventorySlots" } },
|
||||
[Exports.TgiannInv] = { file = "configs/config.lua", path = { "slotsMaxWeights", "player", "maxWeight" }, slotPath = { "slotsMaxWeights", "player", "slots" } },
|
||||
[Exports.CodeMInv] = { file = "config/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
||||
[Exports.RSGInv] = { file = "config/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
||||
[Exports.RSGInv] = { file = "shared/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
||||
--[Exports.OrigenInv] = { file = "config.lua", path = { "MaxWeight" } },
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ function RegisterNetEvent(name, funct)
|
||||
end
|
||||
|
||||
function TriggerEvent(name, ...)
|
||||
local data = {...}
|
||||
if Config.System.EventDebug then
|
||||
local data = {...}
|
||||
if name:find("__cfx_export") then
|
||||
print("^6Bridge^7: "..GetPrintTime().." ^2Triggering ^3"..(isServer() and "Server" or "Client").." ^2Export^7: ^6"..name:gsub("__cfx_export_", ""):gsub("%:", "^7:^4").."^7"..getDebugInfo(debug.getinfo(2, "nSl")))
|
||||
else
|
||||
@@ -74,8 +74,8 @@ function TriggerEvent(name, ...)
|
||||
end
|
||||
|
||||
function TriggerServerEvent(name, ...) -- Client side, trigger a server event
|
||||
local data = {...}
|
||||
if Config.System.EventDebug then
|
||||
local data = {...}
|
||||
if name:find("__ox_cb") then
|
||||
print("^6Bridge^7: "..GetPrintTime().." ^2Triggered ^3Server ^2Callback: ^6"..name:gsub("__ox_cb_", "").."^7"..getDebugInfo(debug.getinfo(2, "nSl")))
|
||||
else
|
||||
@@ -91,8 +91,8 @@ function TriggerServerEvent(name, ...) -- Client side, trigger a server event
|
||||
end
|
||||
|
||||
function TriggerClientEvent(name, ...) -- Server side, trigger a client event
|
||||
local data = {...}
|
||||
if Config.System.EventDebug then
|
||||
local data = {...}
|
||||
if name:find("__ox_cb") then
|
||||
print("^6Bridge^7: "..GetPrintTime().." ^2Triggered ^3Client ^2Callback: ^6"..name:gsub("__ox_cb_", "").."^7"..getDebugInfo(debug.getinfo(2, "nSl")))
|
||||
else
|
||||
|
||||
@@ -33,8 +33,9 @@ if not SUPPRESS_UPDATES then
|
||||
end
|
||||
|
||||
local scriptName = ("^2"..capitalize(getScript()):gsub("%-", "^7-^2"):gsub("%_", "^7_^2")) or ""
|
||||
local scriptVersion = ("^5"..GetResourceMetadata(getScript(), 'version', nil):gsub("%.", "^7.^5")) or ""
|
||||
local scriptDescription = ("^2"..GetResourceMetadata(getScript(), 'description', nil)) or ""
|
||||
local rawVersion = GetResourceMetadata(getScript(), 'version', nil) or "?"
|
||||
local scriptVersion = ("^5"..rawVersion:gsub("%.", "^7.^5")) or ""
|
||||
local scriptDescription = ("^2"..(GetResourceMetadata(getScript(), 'description', nil) or "")) or ""
|
||||
local scriptAuthor = ("^2by ^4"..GetResourceMetadata(getScript(), 'author', nil):gsub("%and", "^7and^4")) or ""
|
||||
|
||||
print(scriptName.." ^7v"..scriptVersion.."^7 - "..scriptDescription.." "..scriptAuthor.."^7")
|
||||
|
||||
@@ -117,8 +117,10 @@ function triggerNotify(title, message, type, src)
|
||||
end
|
||||
|
||||
if src then
|
||||
if Config.System.EventDebug then print(tostring(title).." - "..tostring(message).." - "..tostring(type).." - "..tostring(src)) end
|
||||
notifyFunc[Config.System.Notify].server(title, message, type, src)
|
||||
else
|
||||
if Config.System.EventDebug then print(tostring(title).." - "..tostring(message).." - "..tostring(type).." - "..tostring(src)) end
|
||||
notifyFunc[Config.System.Notify].client(title, message, type)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -929,6 +929,31 @@ function getPlayer(source)
|
||||
return Player
|
||||
end
|
||||
|
||||
--- Finds an online player by their citizen ID.
|
||||
---
|
||||
--- Iterates all connected players and returns the matching player info table
|
||||
--- (the same shape as getPlayer()). Returns nil if nobody matches.
|
||||
--- @param citizenId string The citizen ID to search for.
|
||||
--- @return table|nil player The matching player info table.
|
||||
--- @return number|nil src The matching player's server ID.
|
||||
---
|
||||
--- @usage
|
||||
--- ```lua
|
||||
--- local player, src = getPlayerByCitizenId("ABC12345")
|
||||
--- if player then print("Found", player.name) end
|
||||
--- ```
|
||||
function getPlayerByCitizenId(citizenId)
|
||||
if not citizenId then return nil, nil end
|
||||
for _, v in ipairs(GetPlayers()) do
|
||||
local src = tonumber(v)
|
||||
local Player = getPlayer(src)
|
||||
if Player and Player.citizenId == citizenId then
|
||||
return Player, src
|
||||
end
|
||||
end
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
--- Retrieves all active players within a given radius from the specified coordinates.
|
||||
---
|
||||
--- @param coords vector3 The reference coordinates.
|
||||
|
||||
Reference in new issue
Block a user