mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
input compat fixes
This commit is contained in:
@@ -58,7 +58,7 @@ function onPlayerLoaded(func, onStart)
|
|||||||
if onPlayerFramework ~= "" then
|
if onPlayerFramework ~= "" then
|
||||||
debugPrint("^6Bridge^7: ^2Registering ^3onPlayerLoaded^7()^2 with ^3" .. onPlayerFramework.."^7")
|
debugPrint("^6Bridge^7: ^2Registering ^3onPlayerLoaded^7()^2 with ^3" .. onPlayerFramework.."^7")
|
||||||
else
|
else
|
||||||
print("^4ERROR^7: No supported core detected for onPlayerLoaded - Check exports.lua")
|
print("^4ERROR^7: No supported core detected for onPlayerLoaded - Check starter.lua")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -143,6 +143,18 @@ function waitForLogin()
|
|||||||
end
|
end
|
||||||
Wait(100)
|
Wait(100)
|
||||||
end
|
end
|
||||||
|
elseif isStarted(OXCoreExport) then
|
||||||
|
if OxPlayer["stateId"] then
|
||||||
|
loggedIn = true
|
||||||
|
end
|
||||||
|
while not OxPlayer["stateId"] do
|
||||||
|
Wait(1000)
|
||||||
|
debugPrint("Waiting for stateId to class as logged in")
|
||||||
|
if OxPlayer.get["stateId"] then
|
||||||
|
loggedIn = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- For other frameworks, use LocalPlayer.state.isLoggedIn.
|
-- For other frameworks, use LocalPlayer.state.isLoggedIn.
|
||||||
while not LocalPlayer.state.isLoggedIn and (GetGameTimer() - startTime) < timeout do
|
while not LocalPlayer.state.isLoggedIn and (GetGameTimer() - startTime) < timeout do
|
||||||
@@ -159,3 +171,8 @@ function waitForLogin()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--local OxPlayer = Ox.GetPlayer()
|
||||||
|
--jsonPrint(OxPlayer)
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ for _, v in pairs(Exports) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
OxPlayer = nil
|
||||||
|
if isStarted(OXCoreExport) then
|
||||||
|
if not isServer() then
|
||||||
|
OxPlayer = Ox.GetPlayer()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Resource Variables for Items, Jobs, and Vehicles
|
-- Resource Variables for Items, Jobs, and Vehicles
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
@@ -186,12 +193,12 @@ elseif isStarted(OXCoreExport) then
|
|||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
local TempJobs = triggerCallback(getScript()..":getOxGroups")
|
local TempJobs = triggerCallback(getScript()..":getOxGroups")
|
||||||
Jobs = TempJobs or {}
|
Jobs = {}
|
||||||
for k, v in pairs(TempJobs) do
|
for k, v in pairs(TempJobs) do
|
||||||
local grades = {}
|
local grades = {}
|
||||||
for i = 1, #v.grades do
|
--for i = 1, #v.grades do
|
||||||
grades[i] = { name = v.grades[i], isboss = (i == #v.grades) }
|
-- grades[i] = { name = v.grades[i], isboss = (i == #v.grades) }
|
||||||
end
|
--end
|
||||||
Jobs[v.name] = { label = v.label, grades = grades }
|
Jobs[v.name] = { label = v.label, grades = grades }
|
||||||
end
|
end
|
||||||
Gangs = Jobs
|
Gangs = Jobs
|
||||||
|
|||||||
@@ -64,6 +64,15 @@ function drawText(image, input, style, oxStyleTable)
|
|||||||
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
|
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
|
||||||
end
|
end
|
||||||
ESX.TextUI(text, nil)
|
ESX.TextUI(text, nil)
|
||||||
|
|
||||||
|
elseif Config.System.drawText == "jim" then
|
||||||
|
for k, v in pairs(input) do
|
||||||
|
input[k] = v.."<br>"
|
||||||
|
end
|
||||||
|
exports["jim-nui"]:drawText({
|
||||||
|
icon = nil,
|
||||||
|
text = text,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -39,15 +39,17 @@
|
|||||||
function createInput(title, opts)
|
function createInput(title, opts)
|
||||||
local dialog = nil
|
local dialog = nil
|
||||||
local options = {}
|
local options = {}
|
||||||
|
local currentNum = 0
|
||||||
if Config.System.Menu == "ox" then
|
if Config.System.Menu == "ox" then
|
||||||
for i = 1, #opts do
|
for i = 1, #opts do
|
||||||
|
currentNum += 1
|
||||||
|
if opts[i] == nil then currentNum -= 1 goto skip end
|
||||||
if opts[i].type == "radio" then
|
if opts[i].type == "radio" then
|
||||||
-- Convert radio options to select type for OX
|
-- Convert radio options to select type for OX
|
||||||
for k in pairs(opts[i].options) do
|
for k in pairs(opts[i].options) do
|
||||||
opts[i].options[k].label = opts[i].options[k].text
|
opts[i].options[k].label = opts[i].options[k].text
|
||||||
end
|
end
|
||||||
options[i] = {
|
options[currentNum] = {
|
||||||
type = "select",
|
type = "select",
|
||||||
isRequired = opts[i].isRequired,
|
isRequired = opts[i].isRequired,
|
||||||
label = opts[i].label or opts[i].text,
|
label = opts[i].label or opts[i].text,
|
||||||
@@ -57,8 +59,8 @@ function createInput(title, opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
if opts[i].type == "number" then
|
if opts[i].type == "number" then
|
||||||
options[i] = {
|
options[currentNum] = {
|
||||||
type = "number",
|
type = opts[i].type,
|
||||||
label = (opts[i].label or opts[i].text)..(opts[i].txt and " - "..opts[i].txt or ""),
|
label = (opts[i].label or opts[i].text)..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
isRequired = opts[i].isRequired,
|
isRequired = opts[i].isRequired,
|
||||||
name = opts[i].name,
|
name = opts[i].name,
|
||||||
@@ -66,7 +68,7 @@ function createInput(title, opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
if opts[i].type == "text" then
|
if opts[i].type == "text" then
|
||||||
options[i] = {
|
options[currentNum] = {
|
||||||
type = "input",
|
type = "input",
|
||||||
label = opts[i].text..(opts[i].txt and " - "..opts[i].txt or ""),
|
label = opts[i].text..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
default = opts[i].default,
|
default = opts[i].default,
|
||||||
@@ -74,8 +76,8 @@ function createInput(title, opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
if opts[i].type == "select" then
|
if opts[i].type == "select" then
|
||||||
options[i] = {
|
options[currentNum] = {
|
||||||
type = "select",
|
type = opts[i].type,
|
||||||
label = opts[i].text..(opts[i].txt and " - "..opts[i].txt or ""),
|
label = opts[i].text..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
isRequired = opts[i].isRequired,
|
isRequired = opts[i].isRequired,
|
||||||
name = opts[i].name,
|
name = opts[i].name,
|
||||||
@@ -85,6 +87,17 @@ function createInput(title, opts)
|
|||||||
default = opts[i].default,
|
default = opts[i].default,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts[i].type == "color" then
|
||||||
|
options[currentNum] = {
|
||||||
|
type = opts[i].type,
|
||||||
|
label = opts[i].label,
|
||||||
|
isRequired = opts[i].isRequired,
|
||||||
|
format = opts[i].format,
|
||||||
|
default = opts[i].default,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
::skip::
|
||||||
end
|
end
|
||||||
dialog = exports[OXLibExport]:inputDialog(title, options)
|
dialog = exports[OXLibExport]:inputDialog(title, options)
|
||||||
return dialog
|
return dialog
|
||||||
|
|||||||
@@ -10,6 +10,23 @@
|
|||||||
|
|
||||||
When running client-side (not on the server), the module checks the player's Ped after they load.
|
When running client-side (not on the server), the module checks the player's Ped after they load.
|
||||||
|
|
||||||
|
Usage Examples:
|
||||||
|
-- Check if the player's Ped is an animal:
|
||||||
|
local animalStatus = isPedAnimal()
|
||||||
|
|
||||||
|
-- Check if a given Ped is a cat:
|
||||||
|
if isCat(somePed) then print("This is a cat!") end
|
||||||
|
|
||||||
|
-- Determine if a Ped is a dog and whether it's big or small:
|
||||||
|
local isDogFlag, isBig = isDog(somePed)
|
||||||
|
|
||||||
|
-- Retrieve a flat list of all animal model hashes:
|
||||||
|
local allAnimalModels = getAnimalModels()
|
||||||
|
|
||||||
|
File Separation Suggestion:
|
||||||
|
For scalability, consider separating this module into two files:
|
||||||
|
• AnimalDetection.lua (for functions and callbacks)
|
||||||
|
• AnimalPedsData.lua (for the AnimalPeds table)
|
||||||
]]
|
]]
|
||||||
|
|
||||||
-- Global animal classification flags.
|
-- Global animal classification flags.
|
||||||
|
|||||||
@@ -61,6 +61,13 @@ function triggerNotify(title, message, type, src)
|
|||||||
else
|
else
|
||||||
TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
|
TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif Config.System.Notify == "jim" then
|
||||||
|
if not src then
|
||||||
|
exports["jim-nui"]:Notify(type, message)
|
||||||
|
else
|
||||||
|
TriggerClientEvent("jim-nui:client:notify'", src, type, message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -380,7 +380,8 @@ function hasJob(job, source, grade)
|
|||||||
if info.name == job then hasJobFlag = true end
|
if info.name == job then hasJobFlag = true end
|
||||||
|
|
||||||
elseif isStarted(OXCoreExport) then
|
elseif isStarted(OXCoreExport) then
|
||||||
for k, v in pairs(exports[OXCoreExport]:GetPlayerData().groups) do
|
local info = OxPlayer.getGroups()
|
||||||
|
for k, v in pairs(info) do
|
||||||
if k == job then hasJobFlag = true break end
|
if k == job then hasJobFlag = true break end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -482,7 +483,9 @@ function getPlayer(source)
|
|||||||
source = info.PlayerData.source,
|
source = info.PlayerData.source,
|
||||||
job = info.PlayerData.job.name,
|
job = info.PlayerData.job.name,
|
||||||
jobBoss = info.PlayerData.job.isboss,
|
jobBoss = info.PlayerData.job.isboss,
|
||||||
|
jobInfo = info.PlayerData.job,
|
||||||
gang = info.PlayerData.gang.name,
|
gang = info.PlayerData.gang.name,
|
||||||
|
gangInfo = info.PlayerData.gang,
|
||||||
gangBoss = info.PlayerData.gang.isboss,
|
gangBoss = info.PlayerData.gang.isboss,
|
||||||
onDuty = info.PlayerData.job.onduty,
|
onDuty = info.PlayerData.job.onduty,
|
||||||
account = info.PlayerData.charinfo.account,
|
account = info.PlayerData.charinfo.account,
|
||||||
@@ -500,25 +503,10 @@ function getPlayer(source)
|
|||||||
source = info.source,
|
source = info.source,
|
||||||
job = info.job.name,
|
job = info.job.name,
|
||||||
jobBoss = info.job.isboss,
|
jobBoss = info.job.isboss,
|
||||||
|
jobInfo = info.job,
|
||||||
gang = info.gang.name,
|
gang = info.gang.name,
|
||||||
gangBoss = info.gang.isboss,
|
gangBoss = info.gang.isboss,
|
||||||
onDuty = info.job.onduty,
|
gangInfo = info.gang,
|
||||||
account = info.charinfo.account,
|
|
||||||
citizenId = info.citizenid,
|
|
||||||
}
|
|
||||||
else
|
|
||||||
local info = exports[QBExport]:GetPlayer(src).PlayerData
|
|
||||||
Player = {
|
|
||||||
firstname = info.charinfo.firstname,
|
|
||||||
lastname = info.charinfo.lastname,
|
|
||||||
name = info.charinfo.firstname.." "..info.charinfo.lastname,
|
|
||||||
cash = info.money["cash"],
|
|
||||||
bank = info.money["bank"],
|
|
||||||
source = info.source,
|
|
||||||
job = info.job.name,
|
|
||||||
jobBoss = info.job.isboss,
|
|
||||||
gang = info.gang.name,
|
|
||||||
gangBoss = info.gang.isboss,
|
|
||||||
onDuty = info.job.onduty,
|
onDuty = info.job.onduty,
|
||||||
account = info.charinfo.account,
|
account = info.charinfo.account,
|
||||||
citizenId = info.citizenid,
|
citizenId = info.citizenid,
|
||||||
@@ -554,11 +542,23 @@ function getPlayer(source)
|
|||||||
bank = bank,
|
bank = bank,
|
||||||
}
|
}
|
||||||
elseif isStarted(OXCoreExport) then
|
elseif isStarted(OXCoreExport) then
|
||||||
local info = exports[OXCoreExport]:GetPlayerData()
|
--local info = exports[OXCoreExport]:GetPlayerData()
|
||||||
|
|
||||||
Player = {
|
Player = {
|
||||||
name = info.firstName.." "..info.lastName,
|
firstname = OxPlayer.get("firstName"),
|
||||||
|
lastname = OxPlayer.get("lastName"),
|
||||||
|
name = OxPlayer.get("firstName").." "..OxPlayer.get("lastName"),
|
||||||
cash = exports[OXInv]:Search('count', "money"),
|
cash = exports[OXInv]:Search('count', "money"),
|
||||||
bank = 0,
|
bank = 0,
|
||||||
|
--source = info.source,
|
||||||
|
job = OxPlayer.getGroups(),
|
||||||
|
--jobBoss = info.job.isboss,
|
||||||
|
gang = OxPlayer.getGroups(),
|
||||||
|
--gangBoss = info.gang.isboss,
|
||||||
|
--onDuty = info.job.onduty,
|
||||||
|
--account = info.charinfo.account,
|
||||||
|
citizenId = OxPlayer.get("stateId"),
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif isStarted(QBXExport) then
|
elseif isStarted(QBXExport) then
|
||||||
local info = exports[QBXExport]:GetPlayerData()
|
local info = exports[QBXExport]:GetPlayerData()
|
||||||
@@ -571,8 +571,10 @@ function getPlayer(source)
|
|||||||
source = info.source,
|
source = info.source,
|
||||||
job = info.job.name,
|
job = info.job.name,
|
||||||
jobBoss = info.job.isboss,
|
jobBoss = info.job.isboss,
|
||||||
|
jobInfo = info.job,
|
||||||
gang = info.gang.name,
|
gang = info.gang.name,
|
||||||
gangBoss = info.gang.isboss,
|
gangBoss = info.gang.isboss,
|
||||||
|
gangInfo = info.gang,
|
||||||
onDuty = info.job.onduty,
|
onDuty = info.job.onduty,
|
||||||
account = info.charinfo.account,
|
account = info.charinfo.account,
|
||||||
citizenId = info.citizenid,
|
citizenId = info.citizenid,
|
||||||
@@ -589,8 +591,10 @@ function getPlayer(source)
|
|||||||
source = info.source,
|
source = info.source,
|
||||||
job = info.job.name,
|
job = info.job.name,
|
||||||
jobBoss = info.job.isboss,
|
jobBoss = info.job.isboss,
|
||||||
|
jobInfo = info.job,
|
||||||
gang = info.gang.name,
|
gang = info.gang.name,
|
||||||
gangBoss = info.gang.isboss,
|
gangBoss = info.gang.isboss,
|
||||||
|
gangInfo = info.gang,
|
||||||
onDuty = info.job.onduty,
|
onDuty = info.job.onduty,
|
||||||
account = info.charinfo.account,
|
account = info.charinfo.account,
|
||||||
citizenId = info.citizenid,
|
citizenId = info.citizenid,
|
||||||
|
|||||||
Reference in New Issue
Block a user