40 lines
1.7 KiB
Lua
40 lines
1.7 KiB
Lua
|
|
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
RegisterNetEvent('qb-target:server:givemoneytoanuotherplayer', function(money, playerid)
|
|
local src = source
|
|
local id = playerid
|
|
local amount = money
|
|
if id and amount then
|
|
local xPlayer = QBCore.Functions.GetPlayer(src)
|
|
local xReciv = QBCore.Functions.GetPlayer(id)
|
|
if xReciv and xPlayer then
|
|
if src == id then
|
|
TriggerClientEvent('QBCore:Notify', src, 'Du kan ikke give dig selv penge', 'error')
|
|
else
|
|
if xPlayer.Functions.RemoveMoney('cash', amount) then
|
|
if xReciv.Functions.AddMoney('cash', amount) then
|
|
TriggerClientEvent('QBCore:Notify', src, 'Du gav '.. tostring(amount) .. ',-', 'success')
|
|
TriggerClientEvent('QBCore:Notify', id, 'Du modtog ' .. tostring(amount) .. ',-', 'success')
|
|
TriggerClientEvent('inventory:client:Giveitemanim', src)
|
|
TriggerClientEvent('inventory:client:Reciveitemanim', id)
|
|
else
|
|
TriggerClientEvent('QBCore:Notify', src, 'Der opstod et problem', 'error')
|
|
end
|
|
else
|
|
TriggerClientEvent('QBCore:Notify', src, 'Du har ikke nok penge', 'error')
|
|
end
|
|
end
|
|
else
|
|
TriggerClientEvent('QBCore:Notify', src, 'Kontroller ID', 'error')
|
|
end
|
|
end
|
|
end)
|
|
|
|
QBCore.Functions.CreateCallback('qb-target:GetPlayerInfo', function(source, cb, playerId)
|
|
local Player = QBCore.Functions.GetPlayer(playerId)
|
|
cb(Player.PlayerData.metadata['ishandcuffed'], Player.PlayerData.metadata['isdead'] or Player.PlayerData.metadata['inlaststand'], Player.PlayerData.metadata['isdead'], Player.PlayerData.citizenid)
|
|
end)
|
|
|
|
|