add bridge
This commit is contained in:
parent
4de2931f58
commit
3e967debe4
8
client/bridge.lua
Normal file
8
client/bridge.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
function GetJob()
|
||||
if Config.Framework == 'ProjectStarboy' then
|
||||
return Framework.PlayerData.job
|
||||
end
|
||||
if Config.Framework == "esx" then
|
||||
return Framework.GetPlayerData().job
|
||||
end
|
||||
end
|
|
@ -35,11 +35,13 @@ shared_scripts {
|
|||
|
||||
client_scripts {
|
||||
"client/utils.lua",
|
||||
"client/bridge.lua",
|
||||
"client/classes/*",
|
||||
"client/impl/*"
|
||||
}
|
||||
server_script {
|
||||
"server/utils.lua",
|
||||
"server/bridge.lua",
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
"server/classes/*",
|
||||
"server/impl/*"
|
||||
|
|
43
server/bridge.lua
Normal file
43
server/bridge.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
function HasItem(player, itemName, amount)
|
||||
if Config.Framework == 'ProjectStarboy' then
|
||||
return player.hasItem({
|
||||
itemName = itemName,
|
||||
amount = amount
|
||||
})
|
||||
elseif Config.Framework == 'esx' then
|
||||
local xItem = player.hasItem(itemName)
|
||||
if not xItem then return false end
|
||||
return xItem.count >= amount
|
||||
end
|
||||
end
|
||||
|
||||
function RemoveItem(player, itemName, amount)
|
||||
if Config.Framework == 'ProjectStarboy' then
|
||||
return player.removeInventoryItem({
|
||||
itemName = itemName,
|
||||
amount = amount
|
||||
})
|
||||
elseif Config.Framework == 'esx' then
|
||||
return player.removeInventoryItem(itemName, amount)
|
||||
end
|
||||
end
|
||||
|
||||
function AddMoney(player, amount)
|
||||
if Config.Framework == 'ProjectStarboy' then
|
||||
return player.addAccountMoney("money", amount)
|
||||
elseif Config.Framework == 'esx' then
|
||||
return player.addMoney(amount)
|
||||
end
|
||||
end
|
||||
|
||||
function GetPlayerFromId(playerSrc)
|
||||
if Config.Framework == 'ProjectStarboy' then
|
||||
return Framework.GetPlayerFromSource(playerSrc)
|
||||
elseif Config.Framework == 'esx' then
|
||||
return Framework.GetPlayerFromId(playerSrc)
|
||||
end
|
||||
end
|
||||
|
||||
function ShowNotification(player, msg)
|
||||
return player.showNotification(msg)
|
||||
end
|
Loading…
Reference in New Issue
Block a user