1
0
Fork 0
forked from Simnation/Main
Main/resources/[freizeit]/[gym]/mz-skills/client/main.lua

28 lines
737 B
Lua
Raw Normal View History

2025-08-11 16:51:34 +02:00
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
Citizen.CreateThread(function()
FetchSkills()
while true do
local seconds = Config.UpdateFrequency * 1000
Citizen.Wait(seconds)
for skill, value in pairs(Config.Skills) do
UpdateSkill(skill, value["RemoveAmount"])
end
TriggerServerEvent("skillsystem:update", json.encode(Config.Skills))
end
end)
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
for skill, value in pairs(Config.Skills) do
Config.Skills[skill]["Current"] = 0
end
end)
end)
AddEventHandler('onResourceStart', function(resource)
if resource == GetCurrentResourceName() then
Wait(100)
FetchSkills()
end
end)