Skip to content

Commit

Permalink
Update v2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Musiker15 committed Aug 31, 2024
1 parent 217ab9e commit 6011fa3
Show file tree
Hide file tree
Showing 26 changed files with 1,322 additions and 737 deletions.
75 changes: 75 additions & 0 deletions client/bridge/esx.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
if MSK.Bridge.Framework.Type ~= 'ESX' then return end

AddEventHandler('onResourceStart', function(resource)
if GetCurrentResourceName() ~= resource then return end

if ESX.IsPlayerLoaded() then
MSK.Bridge.isPlayerLoaded = true
end
end)

GetPlayerData = function()
if not MSK.Bridge.isPlayerLoaded then return end
local player = ESX.GetPlayerData()
if not player then return end
local self = player

self.dob = self.dateofbirth

local job = self.job
self.job = {
name = job.name,
label = job.name,
grade = job.grade,
grade_name = job.grade_name,
grade_label = job.grade_label,
grade_salary = job.grade_salary,
isBoss = job.grade_name == 'boss'
}

if MSK.Bridge.Inventory == 'ox_inventory' then
self.inventory = exports.ox_inventory:GetPlayerItems()
self.loadout = self.inventory
end

self.Notification = function(title, message, typ, duration)
MSK.Notification(title, message, typ, duration)
end
self.Notify = self.Notification

self.GetAccount = function(account)
for i = 1, #self.accounts do
if self.accounts[i].name == account then
return self.accounts[i]
end
end
return nil
end

self.SetMeta = function(key, val)
ESX.SetPlayerData(key, val)
end

self.GetMeta = function(val)
return self[val]
end

self.IsDead = function()
local isDead = IsPlayerDead(PlayerId()) or IsEntityDead(PlayerPedId())

if GetResourceState("visn_are") ~= "missing" then
local healthBuffer = exports.visn_are:GetHealthBuffer()
isDead = healthBuffer.unconscious
end

if GetResourceState("osp_ambulance") ~= "missing" then
local data = exports.osp_ambulance:GetAmbulanceData(GetPlayerServerId(PlayerId()))
isDead = data.isDead or data.inLastStand
end

return isDead
end

return self
end
MSK.Bridge.Player = GetPlayerData
84 changes: 84 additions & 0 deletions client/bridge/qbcore.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
if MSK.Bridge.Framework.Type ~= 'QBCore' then return end

AddEventHandler('onResourceStart', function(resource)
if GetCurrentResourceName() ~= resource then return end

if QBCore.Functions.GetPlayerData() then
MSK.Bridge.isPlayerLoaded = true
end
end)

GetPlayerData = function()
if not MSK.Bridge.isPlayerLoaded then return end
local player = QBCore.Functions.GetPlayerData()
if not player then return end
local job = player.PlayerData.job
local self = {}

self.identifier = player.PlayerData.citizenid
self.firstName = player.PlayerData.charinfo.firstname
self.lastName = player.PlayerData.charinfo.lastname
self.name = player.PlayerData.charinfo.firstname .. ' ' .. player.PlayerData.charinfo.lastname
self.dob = player.PlayerData.charinfo.birthdate
self.sex = player.PlayerData.charinfo.gender == 1 and 'male' or 'female'
self.phone = player.PlayerData.charinfo.phone
self.metadata = player.PlayerData.metadata
self.inventory = player.PlayerData.items

if MSK.Bridge.Inventory == 'ox_inventory' then
self.inventory = exports.ox_inventory:GetPlayerItems()
self.loadout = self.inventory
end

self.accounts = {
money = {name = 'money', money = player.PlayerData.money['cash']},
black_money = {name = 'black_money', money = player.PlayerData.money['black_money']},
bank = {name = 'bank', money = player.PlayerData.money['bank']},
}

self.job = {
name = job.name,
label = job.label,
grade = job.grade.level,
grade_name = job.grade.name,
grade_label = job.grade.name,
grade_salary = job.payment,
isBoss = job.isboss,
}

self.Notification = function(title, message, typ, duration)
MSK.Notification(title, message, typ, duration)
end
self.Notify = self.Notification

self.GetAccount = function(account)
return self.accounts[account:lower()]
end

self.SetMeta = function(key, val)
QBCore.Functions.SetMetaData(key, val)
end

self.GetMeta = function(val)
return self.metadata[val]
end

self.IsDead = function()
local isDead = IsPlayerDead(PlayerId()) or IsEntityDead(PlayerPedId())

if GetResourceState("visn_are") ~= "missing" then
local healthBuffer = exports.visn_are:GetHealthBuffer()
isDead = healthBuffer.unconscious
end

if GetResourceState("osp_ambulance") ~= "missing" then
local data = exports.osp_ambulance:GetAmbulanceData(GetPlayerServerId(PlayerId()))
isDead = data.isDead or data.inLastStand
end

return isDead
end

return self
end
MSK.Bridge.Player = GetPlayerData
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ local display = function(data)
local showDisplay = true
local timeout = MSK.SetTimeout(60000, function()
showDisplay = false
MSK.DelTimeout(timeout)
end)
local text = ('%s (ID: %s)\n%s'):format(data.playerName, data.playerId, data.reason)

Expand Down
File renamed without changes.
Loading

0 comments on commit 6011fa3

Please sign in to comment.