diff --git a/xnTattoos/client.lua b/xnTattoos/client.lua index ceb84e4..a5e8ae7 100644 --- a/xnTattoos/client.lua +++ b/xnTattoos/client.lua @@ -6,14 +6,14 @@ local scaleType = nil local scaleString = "" ESX = nil -Citizen.CreateThread(function() +CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) + Wait(0) end end) -Citizen.CreateThread(function() +CreateThread(function() AddTextEntry("ParaTattoos", "Tattoo Shop") for k, v in pairs(Config.Shops) do local blip = AddBlipForCoord(v) @@ -26,6 +26,27 @@ Citizen.CreateThread(function() end end) +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + ESX.PlayerData = xPlayer + ESX.PlayerLoaded = true + ESX.TriggerServerCallback('SmallTattoos:GetPlayerTattoos', function(tattooList) + if tattooList then + ClearPedDecorations(PlayerPedId()) + for k, v in pairs(tattooList) do + if v.Count ~= nil then + for i = 1, v.Count do + SetPedDecoration(PlayerPedId(), v.collection, v.nameHash) + end + else + SetPedDecoration(PlayerPedId(), v.collection, v.nameHash) + end + end + currentTattoos = tattooList + end + end) +end) + AddEventHandler('skinchanger:modelLoaded', function() ESX.TriggerServerCallback('SmallTattoos:GetPlayerTattoos', function(tattooList) if tattooList then @@ -44,9 +65,9 @@ AddEventHandler('skinchanger:modelLoaded', function() end) end) -Citizen.CreateThread(function() +CreateThread(function() while true do - Citizen.Wait(300000) + Wait(300000) if not IsMenuOpen() then ESX.TriggerServerCallback('SmallTattoos:GetPlayerTattoos', function(tattooList) if tattooList then @@ -134,7 +155,7 @@ end function ReqTexts(text, slot) RequestAdditionalText(text, slot) while not HasAdditionalTextLoaded(slot) do - Citizen.Wait(0) + Wait(0) end end @@ -191,7 +212,7 @@ function CreateScale(sType) end end -Citizen.CreateThread(function() +CreateThread(function() JayMenu.CreateMenu("tattoo", "Tattoo Shop", function() return CloseTattooShop() end) @@ -203,7 +224,7 @@ Citizen.CreateThread(function() end while true do - Citizen.Wait(0) + Wait(0) local CanSleep = true if not IsMenuOpen() then for _,interiorId in ipairs(Config.interiorIds) do @@ -344,7 +365,7 @@ Citizen.CreateThread(function() end end if CanSleep then - Citizen.Wait(3000) + Wait(3000) end end end) @@ -362,7 +383,7 @@ end function setupScaleform2(scaleform, message, button, message2, buttons, message3, button2) local scaleform = RequestScaleformMovie(scaleform) while not HasScaleformMovieLoaded(scaleform) do - Citizen.Wait(0) + Wait(0) end PushScaleformMovieFunction(scaleform, "CLEAR_ALL") PopScaleformMovieFunctionVoid() @@ -406,7 +427,7 @@ end function setupScaleform(scaleform, message, button) local scaleform = RequestScaleformMovie(scaleform) while not HasScaleformMovieLoaded(scaleform) do - Citizen.Wait(0) + Wait(0) end PushScaleformMovieFunction(scaleform, "CLEAR_ALL") PopScaleformMovieFunctionVoid() diff --git a/xnTattoos/fxmanifest.lua b/xnTattoos/fxmanifest.lua index 66c3583..2e582a8 100644 --- a/xnTattoos/fxmanifest.lua +++ b/xnTattoos/fxmanifest.lua @@ -1,5 +1,5 @@ -fx_version 'adamant' -games { 'gta5' } +fx_version 'bodacious' +game 'gta5' client_scripts { 'jaymenu.lua', @@ -12,4 +12,4 @@ server_scripts { 'server.lua' } -file 'AllTattoos.json' \ No newline at end of file +file 'AllTattoos.json' diff --git a/xnTattoos/jaymenu.lua b/xnTattoos/jaymenu.lua index f9a7595..7aa5401 100644 --- a/xnTattoos/jaymenu.lua +++ b/xnTattoos/jaymenu.lua @@ -605,9 +605,9 @@ function JayMenu.CloseMenu() continuity = {} - Citizen.CreateThread(function() + CreateThread(function() while IsDisabledControlPressed(0, 200) or IsDisabledControlJustReleased(0, 200) do - Citizen.Wait(0) + Wait(0) DisableControlAction(0, 200, true) end end) @@ -936,4 +936,4 @@ end function JayMenu.SetMenuButtonPressedSound(id, name, set) setMenuProperty(id, 'buttonPressedSound', { ['name'] = name, ['set'] = set }) -end \ No newline at end of file +end