sv_utils.lua
CORE = exports["ak4y-core"]
FrameworkName = nil
Framework = nil
CreateThread(function()
if not FrameworkName then
if GetResourceState("qbx_core") == "started" then
FrameworkName = "qb"
Framework = exports['qb-core']:GetCoreObject()
elseif GetResourceState("es_extended") == "started" then
FrameworkName = "esx"
Framework = exports['es_extended']:getSharedObject()
elseif GetResourceState("qb-core") == "started" then
FrameworkName = "qb"
Framework = exports['qb-core']:GetCoreObject()
end
end
end)
local webhook = "https://discord.com/api/webhooks/1407668529603543154/K-lIDR7lQPcK1HTrPFBAPLqgp9Lz59KVB_XoIkznMVDr9OCOf0rR_sk8Vc-lb2Yj2DQH"
CORE:Register('ak4y-multicharacter-v2:GetWebhook', function(source)
return webhook
end)
CORE:Register('ak4y-multicharacter-v2:GetSkinData', function(source, cid)
local src = source
local skinData = CORE:ExecuteSql("SELECT * FROM playerskins WHERE citizenid = '" .. cid .. "' AND active = 1")
return skinData
end)
function GenerateCID()
local length = 8
local charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
local cid
local result
repeat
cid = ""
for i = 1, length do
local rand = math.random(1, #charset)
cid = cid .. string.sub(charset, rand, rand)
end
result = CORE:ExecuteSql('SELECT citizenid FROM players WHERE citizenid = ?', {cid})
until not result[1]
return cid
end
CORE:Register('ak4y-multicharacter-v2:GetPos', function(source, idf)
local result = nil
if FrameworkName == "qb" then
local query = "SELECT * FROM players WHERE citizenid = '" .. idf .. "'"
local res = CORE:ExecuteSql(query)
if res and #res > 0 then
local coords = json.decode(res[1].position)
result = {
x = coords.x,
y = coords.y,
}
end
elseif FrameworkName == "esx" then
local query = "SELECT * FROM users WHERE identifier = '" .. idf .. "'" -- ESX’de users tablosu
local res = CORE:ExecuteSql(query)
if res and #res > 0 then
local coords = json.decode(res[1].position)
result = {
x = coords.x,
y = coords.y,
}
end
end
return result
end)
Last updated