Auto-sync 2026-04-15 20:40

This commit is contained in:
root 2026-04-15 20:40:02 +02:00
parent 24b522c959
commit 40fb303e3f

View File

@ -185,8 +185,8 @@ function RemoveMoney(source, type, value)
Player.removeMoney(value) Player.removeMoney(value)
end end
if type == 'black_money' then if type == 'black_money' then
Player.removeAccountMoney('black_money', value) Player.removeAccountMoney('black_money', value)
end end
elseif Config.Framework == 'qb' or Config.Framework == 'oldqb' then elseif Config.Framework == 'qb' or Config.Framework == 'oldqb' then
if type == 'bank' then if type == 'bank' then
Player.Functions.RemoveMoney('bank', value) Player.Functions.RemoveMoney('bank', value)
@ -209,8 +209,8 @@ function AddMoney(source, type, value)
Player.addMoney(value) Player.addMoney(value)
end end
if type == 'black_money' then if type == 'black_money' then
Player.addAccountMoney('black_money', value) Player.addAccountMoney('black_money', value)
end end
elseif Config.Framework == 'qb' or Config.Framework == 'oldqb' then elseif Config.Framework == 'qb' or Config.Framework == 'oldqb' then
if type == 'bank' then if type == 'bank' then
Player.Functions.AddMoney('bank', value) Player.Functions.AddMoney('bank', value)
@ -232,7 +232,6 @@ function GetPlayerMoney(source, value)
if value == 'cash' then if value == 'cash' then
return Player.getMoney() return Player.getMoney()
end end
-- FÜGE DIESE ZEILEN HINZU:
if value == 'black_money' then if value == 'black_money' then
return Player.getAccount('black_money').money return Player.getAccount('black_money').money
end end
@ -264,7 +263,6 @@ Citizen.CreateThread(function()
if itemData then if itemData then
if itemData.name == 'cash' then if itemData.name == 'cash' then
AddMoney(Player.PlayerData.source, 'cash', amount) AddMoney(Player.PlayerData.source, 'cash', amount)
-- AddItem(Player.PlayerData.source, 'cash', amount)
else else
AddItem(Player.PlayerData.source, itemData.name, amount) AddItem(Player.PlayerData.source, itemData.name, amount)
end end
@ -290,7 +288,6 @@ Citizen.CreateThread(function()
end end
end, "admin") end, "admin")
Core.Commands.Add(Config.Commands['clearinv'], "Clear Player Inventory (Admin Only)", Core.Commands.Add(Config.Commands['clearinv'], "Clear Player Inventory (Admin Only)",
{ { name = "id", help = "Player ID" } }, false, function(source, args) { { name = "id", help = "Player ID" } }, false, function(source, args)
local id = tonumber(args[1]) local id = tonumber(args[1])
@ -361,13 +358,12 @@ Citizen.CreateThread(function()
local Player = Core.GetPlayerFromId(id) local Player = Core.GetPlayerFromId(id)
if Player then if Player then
if itemData then if itemData then
-- ✅ FIX: black_money geht jetzt als normales Item ins Inventar
if itemData.name == 'cash' then if itemData.name == 'cash' then
Player.addMoney(amount) Player.addMoney(amount)
elseif itemData.name == 'black_money' then else
Player.addAccountMoney('black_money', amount) AddItem(Player.source, itemData.name, amount)
else end
AddItem(Player.source, itemData.name, amount)
end
if Config.UseDiscordWebhooks then if Config.UseDiscordWebhooks then
local discorddata = { local discorddata = {
playername = GetName(Player.source), playername = GetName(Player.source),
@ -476,6 +472,7 @@ end)
AddEventHandler('playerDropped', function() AddEventHandler('playerDropped', function()
handlePlayerUnload(source) handlePlayerUnload(source)
end) end)
function SavePlayerInventory(id) function SavePlayerInventory(id)
local identifier = Identifier[tonumber(id)] local identifier = Identifier[tonumber(id)]
if not identifier then if not identifier then
@ -512,14 +509,10 @@ end
function CheckIfAdmin(source) function CheckIfAdmin(source)
local src = source local src = source
local Player = GetPlayer(src) local Player = GetPlayer(src)
-- Add this check to prevent indexing a nil 'Player'
if not Player then if not Player then
return false return false
end end
if Config.Framework == 'esx' or Config.Framework == 'oldesx' then if Config.Framework == 'esx' or Config.Framework == 'oldesx' then
-- Also check if getGroup exists, just in case
if Player.getGroup then if Player.getGroup then
return CheckPermissions(Player.getGroup()) return CheckPermissions(Player.getGroup())
end end
@ -568,7 +561,6 @@ Citizen.CreateThread(function()
return return
end end
end end
if not item.ammotype then if not item.ammotype then
item.ammotype = Config.Itemlist[item.name].ammotype or nil item.ammotype = Config.Itemlist[item.name].ammotype or nil
end end
@ -589,7 +581,6 @@ Citizen.CreateThread(function()
return return
end end
end end
if not item.ammotype then if not item.ammotype then
item.ammotype = Config.Itemlist[item.name].ammotype or nil item.ammotype = Config.Itemlist[item.name].ammotype or nil
end end
@ -626,42 +617,6 @@ Citizen.CreateThread(function()
end end
end) end)
-- RegisterServerEvent('codem-inventory:server:UseItem', function(slot, name)
-- local src = source
-- local identifier = Identifier[tonumber(src)]
-- if not identifier then
-- TriggerClientEvent('codem-inventory:client:notification', src,
-- Locales[Config.Language].notification['IDENTIFIERNOTFOUND'])
-- return
-- end
-- local playerInventory = PlayerServerInventory[identifier] and PlayerServerInventory[identifier].inventory
-- if not playerInventory then
-- TriggerClientEvent('codem-inventory:client:notification', src,
-- Locales[Config.Language].notification['PLAYERINVENTORYNOTFOUND'])
-- debugprint('DİKKAT ENVANTER BULUNAMADI 1415 SATIR')
-- return
-- end
-- local itemData = playerInventory[tostring(slot)]
-- if not itemData then
-- TriggerClientEvent('codem-inventory:client:notification', src,
-- Locales[Config.Language].notification['ITEMNOTFOUNDINGIVENSLOT'])
-- return
-- end
-- if itemData.name == name then
-- if itemData.shouldClose then
-- TriggerClientEvent('codem-inventory:client:closeInventory', src)
-- end
-- if Config.Framework == 'qb' or Config.Framework == 'oldqb' then
-- UseItem(itemData.name, src, itemData)
-- else
-- Core.UseItem(src, itemData.name, itemData)
-- end
-- end
-- end)
RegisterServerEvent('codem-inventory:server:UseItem', function(slot, name) RegisterServerEvent('codem-inventory:server:UseItem', function(slot, name)
local src = source local src = source
local identifier = Identifier[tonumber(src)] local identifier = Identifier[tonumber(src)]
@ -747,7 +702,6 @@ Citizen.CreateThread(function()
end end
end) end)
Citizen.CreateThread(function() Citizen.CreateThread(function()
local niltable = {} local niltable = {}
local result = ExecuteSql("SELECT * FROM codem_new_stash") local result = ExecuteSql("SELECT * FROM codem_new_stash")