mirror of
https://github.com/RoccoMyTacco/qb-pefcl.git
synced 2026-03-31 06:33:57 -04:00
feat: card as item
This commit is contained in:
28
server.lua
28
server.lua
@@ -56,9 +56,37 @@ local function UniqueAccounts(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function getCards(source)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local cards = Player.Functions.GetItemsByName('visa')
|
||||
local retval = {}
|
||||
if cards then
|
||||
for k, v in pairs(cards) do
|
||||
retval[#retval+1] = {
|
||||
id = v.info.id,
|
||||
holder = v.info.holder,
|
||||
number = v.info.number
|
||||
}
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
local function giveCard(source, card)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local info = {
|
||||
id = card.id,
|
||||
holder = card.holder,
|
||||
number = card.number
|
||||
}
|
||||
Player.Functions.AddItem('visa', 1, nil, info)
|
||||
end
|
||||
|
||||
exports("addCash", addCash)
|
||||
exports("removeCash", removeCash)
|
||||
exports("getCash", getCash)
|
||||
exports("giveCard", giveCard)
|
||||
exports("getCards", getCards)
|
||||
|
||||
AddEventHandler("QBCore:Server:PlayerLoaded", function(player)
|
||||
if not player then
|
||||
|
||||
Reference in New Issue
Block a user