From 688b1c5fc3d4553a3558f8d42a9d82a49c1b9efd Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:34:02 +0100 Subject: [PATCH] refactor: major rebuild for kc-unicorn - Updated the resource export method regarding the ESX Framework - Performed code formatting and cleaning work, removing the version check part - fixed the problem: SCRIPT ERROR: Execution of native 00000000faa3d236 in script host failed: Tried to access invalid entity: 133121 --- .../[esx_addons]/kc-unicorn/client/loop.lua | 118 +- .../[esx_addons]/kc-unicorn/client/main.lua | 1338 ++++++++--------- .../[esx_addons]/kc-unicorn/config.lua | 98 +- .../[esx_addons]/kc-unicorn/fxmanifest.lua | 43 +- .../[esx_addons]/kc-unicorn/locales/en.lua | 26 +- .../[esx_addons]/kc-unicorn/locales/fr.lua | 26 +- .../[esx_addons]/kc-unicorn/server/main.lua | 265 +--- 7 files changed, 891 insertions(+), 1023 deletions(-) diff --git a/server-data/resources/[esx_addons]/kc-unicorn/client/loop.lua b/server-data/resources/[esx_addons]/kc-unicorn/client/loop.lua index e613526b..f4a6c68f 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/client/loop.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/client/loop.lua @@ -1,80 +1,70 @@ -- Check player and his coords Citizen.CreateThread(function() - while true do + while true do + Cache.Player = PlayerPedId() + Cache.PlyCoo = GetEntityCoords(Cache.Player) - Cache.Player = PlayerPedId() - Cache.PlyCoo = GetEntityCoords(Cache.Player) - - - if Cache.inuniPoly then - Citizen.Wait(1) - else - Citizen.Wait(1500) - end - end + if Cache.inuniPoly then + Citizen.Wait(1) + else + Citizen.Wait(1500) + end + end end) -- Get which seats are taken for lapdance Citizen.CreateThread(function() - - while true do - - if Cache.inlapPoly then - Citizen.Wait(300) - TriggerServerEvent('kc-unicorn:GetPlayerSeated') - else - Citizen.Wait(1000) - end - end - + while true do + if Cache.inlapPoly then + Citizen.Wait(300) + TriggerServerEvent("kc-unicorn:GetPlayerSeated") + else + Citizen.Wait(1000) + end + end end) --- +-- Citizen.CreateThread(function() + while true do + while Cache.InLapdance do + DisableControlAction(2, 0, true) + DisableControlAction(2, 24, true) + DisableControlAction(2, 257, true) + DisableControlAction(2, 25, true) + DisableControlAction(2, 263, true) + DisableControlAction(2, 32, true) + DisableControlAction(2, 34, true) + DisableControlAction(2, 8, true) + DisableControlAction(2, 9, true) + Citizen.Wait(0) + end - while true do - - while Cache.InLapdance do - DisableControlAction(2, 0, true) - DisableControlAction(2, 24, true) - DisableControlAction(2, 257, true) - DisableControlAction(2, 25, true) - DisableControlAction(2, 263, true) - DisableControlAction(2, 32, true) - DisableControlAction(2, 34, true) - DisableControlAction(2, 8, true) - DisableControlAction(2, 9, true) - Citizen.Wait(0) - end + while Cache.InLean do + DisableControlAction(2, 0, true) + Citizen.Wait(0) + end - while Cache.InLean do - DisableControlAction(2, 0, true) - Citizen.Wait(0) - end - - Citizen.Wait(1000) - end + Citizen.Wait(1000) + end end) --- Citizen.CreateThread(function() + while true do + while Cache.InLapdance do + Citizen.Wait(400) + if GetEntityHealth(Cache.SpawnPed) <= 0 or IsPedRagdoll(Cache.SpawnPed) or IsPedFleeing(Cache.SpawnPed) then + FreezeEntityPosition(Cache.SpawnPed, false) + DrawText2D(Loc("lapStopped")) + Cache.InLapdance = false + Cache.lapStop = true + Citizen.Wait(1000) + Cache.InCooldown = false + Citizen.Wait(10000) + DeleteEntity(Cache.SpawnPed) + end + end - while true do - - while Cache.InLapdance do - Citizen.Wait(400) - if GetEntityHealth(Cache.SpawnPed) <= 0 or IsPedRagdoll(Cache.SpawnPed) or IsPedFleeing(Cache.SpawnPed) then - FreezeEntityPosition(Cache.SpawnPed, false) - DrawText2D(Loc('lapStopped')) - Cache.InLapdance = false - Cache.lapStop = true - Citizen.Wait(1000) - Cache.InCooldown = false - Citizen.Wait(10000) - DeleteEntity(Cache.SpawnPed) - end - end - - Citizen.Wait(1000) - end -end) \ No newline at end of file + Citizen.Wait(1000) + end +end) diff --git a/server-data/resources/[esx_addons]/kc-unicorn/client/main.lua b/server-data/resources/[esx_addons]/kc-unicorn/client/main.lua index 86f1f294..c621bc0f 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/client/main.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/client/main.lua @@ -1,7 +1,9 @@ +---@diagnostic disable: undefined-global + -- Import QBCore local QBCore if Config.Framework == "QBCore" then - QBCore = exports['qb-core']:GetCoreObject() + QBCore = exports["qb-core"]:GetCoreObject() end Cache = {} @@ -31,626 +33,626 @@ local SpawnObject, PreviousCamViewMode, factor, lines, PlayerMoney -- PolyZones local uniPoly = BoxZone:Create(vector3(115.01, -1293.19, 28.27), 25.1, 32.0, { - name = "uniPoly", - heading = 8, - debugPoly = Config.DebugPolyzones, - minZ = 22.37, - maxZ = 31.17 + name = "uniPoly", + heading = 8, + debugPoly = Config.DebugPolyzones, + minZ = 22.37, + maxZ = 31.17, }) local lapPoly = BoxZone:Create(vector3(117.06, -1294.85, 29.27), 1.24, 1.0, { - name = "lapPoly", - heading = 30, - debugPoly = Config.DebugPolyzones, - minZ = 28.17, - maxZ = 30.57 + name = "lapPoly", + heading = 30, + debugPoly = Config.DebugPolyzones, + minZ = 28.17, + maxZ = 30.57, }) local leanPoly = BoxZone:Create(vector3(113.22, -1286.74, 28.46), 8.4, 6.4, { - name="leanPoly", - heading=30, - debugPoly = Config.DebugPolyzones, - minZ=27.26, - maxZ=28.66 + name = "leanPoly", + heading = 30, + debugPoly = Config.DebugPolyzones, + minZ = 27.26, + maxZ = 28.66, }) local leanPoly1 = BoxZone:Create(vector3(114.31, -1289.97, 28.26), 0.2, 2.5, { - name="leanPoly1", - heading=30, - debugPoly = Config.DebugPolyzones, - minZ=27.26, - maxZ=28.66 + name = "leanPoly1", + heading = 30, + debugPoly = Config.DebugPolyzones, + minZ = 27.26, + maxZ = 28.66, }) local leanPoly2 = BoxZone:Create(vector3(114.75, -1285.88, 28.26), 4.2, 0.2, { - name="leanPoly2", - heading=30, - debugPoly = Config.DebugPolyzones, - minZ=27.26, - maxZ=28.66 + name = "leanPoly2", + heading = 30, + debugPoly = Config.DebugPolyzones, + minZ = 27.26, + maxZ = 28.66, }) local leanPoly3 = BoxZone:Create(vector3(110.98, -1284.24, 28.26), 0.2, 2.5, { - name="leanPoly3", - heading=30, - debugPoly = Config.DebugPolyzones, - minZ=27.26, - maxZ=28.66 + name = "leanPoly3", + heading = 30, + debugPoly = Config.DebugPolyzones, + minZ = 27.26, + maxZ = 28.66, }) -- Create Blips Citizen.CreateThread(function() - LoadDict("mini@strip_club@pole_dance@pole_dance1", false) - LoadDict("mini@strip_club@pole_dance@pole_dance2", false) - - if Config.Blip then + LoadDict("mini@strip_club@pole_dance@pole_dance1", false) + LoadDict("mini@strip_club@pole_dance@pole_dance2", false) - local blip = AddBlipForCoord(Config.BlipCoord.x, Config.BlipCoord.y, Config.BlipCoord.z) + if Config.Blip then + local blip = AddBlipForCoord(Config.BlipCoord.x, Config.BlipCoord.y, Config.BlipCoord.z) - SetBlipSprite (blip, Config.BlipStripclub.Sprite) - SetBlipDisplay(blip, Config.BlipStripclub.Display) - SetBlipScale (blip, Config.BlipStripclub.Scale) - SetBlipColour (blip, Config.BlipStripclub.Colour) - SetBlipAsShortRange(blip, true) + SetBlipSprite(blip, Config.BlipStripclub.Sprite) + SetBlipDisplay(blip, Config.BlipStripclub.Display) + SetBlipScale(blip, Config.BlipStripclub.Scale) + SetBlipColour(blip, Config.BlipStripclub.Colour) + SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(Config.BlipName) - EndTextCommandSetBlipName(blip) - end + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(Config.BlipName) + EndTextCommandSetBlipName(blip) + end end) -RegisterNetEvent('kc-unicorn:showNotify') -AddEventHandler('kc-unicorn:showNotify', function(notify) - ShowAboveRadarMessage(notify) +RegisterNetEvent("kc-unicorn:showNotify") +AddEventHandler("kc-unicorn:showNotify", function(notify) + ShowAboveRadarMessage(notify) end) function ShowAboveRadarMessage(message) - SetNotificationTextEntry("STRING") - AddTextComponentString(message) - DrawNotification(0,1) + SetNotificationTextEntry("STRING") + AddTextComponentString(message) + DrawNotification(false, true) end function DrawText3D(xyz, text) - - if Config.Text == 'Better3D' then + if Config.Text == "Better3D" then AdvancedDrawText3D(xyz, text) return - elseif Config.Text == '2D' then - DrawText2D(text) - return - elseif Config.Text == 'None' then - return - elseif Config.Text ~= '3D' then - DrawText2D('Config.Text is not correctly configured.') - return + elseif Config.Text == "2D" then + DrawText2D(text) + return + elseif Config.Text == "None" then + return + elseif Config.Text ~= "3D" then + DrawText2D("Config.Text is not correctly configured.") + return end - SetTextScale(0.35, 0.35) + SetTextScale(0.35, 0.35) SetTextFont(4) - SetTextProportional(1) + SetTextProportional(true) SetTextColour(255, 255, 255, 215) SetTextEntry("STRING") SetTextCentre(true) AddTextComponentString(text) - SetDrawOrigin(xyz, 0) + SetDrawOrigin(xyz, false) DrawText(0.0, 0.0) - DrawRect(0.0, 0.0115*lines, 0.017+ factor, 0.028*lines, 0, 0, 0, 75) + DrawRect(0.0, 0.0115 * lines, 0.017 + factor, 0.028 * lines, 0, 0, 0, 75) ClearDrawOrigin() - end function AdvancedDrawText3D(xyz, text) - AddTextEntry(GetCurrentResourceName(), text) BeginTextCommandDisplayHelp(GetCurrentResourceName()) EndTextCommandDisplayHelp(2, false, false, -1) - SetFloatingHelpTextWorldPosition(1, xyz) + SetFloatingHelpTextWorldPosition(true, xyz) SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0) - end function DrawText2D(text) - AddTextEntry(GetCurrentResourceName(), text) BeginTextCommandDisplayHelp(GetCurrentResourceName()) - EndTextCommandDisplayHelp(0, 0, true, -1) - + EndTextCommandDisplayHelp(0, false, true, -1) end Citizen.CreateThread(function() - - uniPoly:onPointInOut(PolyZone.getPlayerPosition, function(isPointInside, point) - Cache.inuniPoly = isPointInside - if isPointInside then - lapPoly:onPointInOut(PolyZone.getPlayerPosition, function(isPointInside, point) - Cache.inlapPoly = isPointInside - if isPointInside then - FactorAndLines(Loc('LapText', Config.LapDanceCost)) - end - TriggerServerEvent('kc-unicorn:GetPlayerSeated') - end) - leanPoly:onPointInOut(PolyZone.getPlayerPosition, function(isPointInside, point) - Cache.inleanPoly = isPointInside - if isPointInside then - FactorAndLines(Loc('Lean')) - end - end) - end - end, 2000) - + uniPoly:onPointInOut(PolyZone.getPlayerPosition, function(isPointInside, point) + Cache.inuniPoly = isPointInside + if isPointInside then + lapPoly:onPointInOut(PolyZone.getPlayerPosition, function(isPointInside, point) + Cache.inlapPoly = isPointInside + if isPointInside then + FactorAndLines(Loc("LapText", Config.LapDanceCost)) + end + TriggerServerEvent("kc-unicorn:GetPlayerSeated") + end) + leanPoly:onPointInOut(PolyZone.getPlayerPosition, function(isPointInside, point) + Cache.inleanPoly = isPointInside + if isPointInside then + FactorAndLines(Loc("Lean")) + end + end) + end + end, 2000) end) -- Better to not repeat this in DrawText3D, save a bit of perf ¯\_(ツ)_/¯ function FactorAndLines(text) - - factor = (string.len(text)) / 370 - if Config.SelectStrippers and Cache.inlapPoly then - lines = 2 - else - lines = 1 - end - + factor = (string.len(text)) / 370 + if Config.SelectStrippers and Cache.inlapPoly then + lines = 2 + else + lines = 1 + end end ---- Lapdance Citizen.CreateThread(function() - - local InputLeft, InputRight - - local text = Loc('LapText', Config.LapDanceCost) - local CustomStrippers = 0 - local Stripper = 1 - - for _ in pairs(Config.Strippers) do CustomStrippers = CustomStrippers + 1 end - - if Config.Framework == "Standalone" then - text = Loc('StandaloneLapText') - end - - - if Config.Text == '3D' then - Input = '~r~E~w~ - ' - InputLeft = '\n~b~ {-- ~w~' - InputRight = '~b~ --} ~w~' - else - Input = '~INPUT_CONTEXT~ ' - InputLeft = '\n~INPUT_CELLPHONE_LEFT~ ' - InputRight = ' ~INPUT_CELLPHONE_RIGHT~' - end + local InputLeft, InputRight + + local text = Loc("LapText", Config.LapDanceCost) + local CustomStrippers = 0 + local Stripper = 1 + + for _ in pairs(Config.Strippers) do + CustomStrippers = CustomStrippers + 1 + end + + if Config.Framework == "Standalone" then + text = Loc("StandaloneLapText") + end + + if Config.Text == "3D" then + Input = "~r~E~w~ - " + InputLeft = "\n~b~ {-- ~w~" + InputRight = "~b~ --} ~w~" + else + Input = "~INPUT_CONTEXT~ " + InputLeft = "\n~INPUT_CELLPHONE_LEFT~ " + InputRight = " ~INPUT_CELLPHONE_RIGHT~" + end while true do + if Config.SelectStrippers then + if Stripper > CustomStrippers then + Stripper = 1 + elseif Stripper <= 0 then + Stripper = CustomStrippers + end + DrawnText = Input .. text .. InputLeft .. Config.Strippers[Stripper].Name .. InputRight + else + DrawnText = Input .. text + end - if Config.SelectStrippers then - if Stripper > CustomStrippers then - Stripper = 1 - elseif Stripper <= 0 then - Stripper = CustomStrippers - end - DrawnText = Input .. text .. InputLeft .. Config.Strippers[Stripper].Name .. InputRight - else - DrawnText = Input .. text - end - - if not Cache.inuniPoly then - Citizen.Wait(800) - else - Citizen.Wait(0) - end + if not Cache.inuniPoly then + Citizen.Wait(800) + else + Citizen.Wait(0) + end if Cache.inuniPoly and not Cache.InCooldown and not Cache.InLean then - if Config.LapMarker then - DrawMarker(2, 117.04, -1294.8, 29.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.25, 0.2, 0.1, 255, 255, 255, 100, false, true, 2, false, false, false, false) - end + if Config.LapMarker then + DrawMarker(2, 117.04, -1294.8, 29.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.25, 0.2, 0.1, 255, 255, 255, 100, false, true, 2, false, false, false, false) + end if Cache.inlapPoly then - DrawText3D(vector3(117.04, -1294.8, 29.25), DrawnText) - if IsControlJustPressed(0, 38) then - if PlayerSeated >= 7 then - QBCore.Functions.Notify(Loc('AllPlacesTaken'), "error") - else - TriggerServerEvent('kc-unicorn:buy', Stripper) - Citizen.Wait(500) - end - elseif IsControlJustPressed(0, 174) then - Stripper = Stripper - 1 - elseif IsControlJustPressed(0, 175) then - Stripper = Stripper + 1 - end - end - end + DrawText3D(vector3(117.04, -1294.8, 29.25), DrawnText) + if IsControlJustPressed(0, 38) then + if PlayerSeated >= 7 then + QBCore.Functions.Notify(Loc("AllPlacesTaken"), "error") + else + TriggerServerEvent("kc-unicorn:buy", Stripper) + Citizen.Wait(500) + end + elseif IsControlJustPressed(0, 174) then + Stripper = Stripper - 1 + elseif IsControlJustPressed(0, 175) then + Stripper = Stripper + 1 + end + end + end end end) function PlayerFunc(xyz, heading, camheading, xyz2, wait) - Dict = LoadDict("mini@strip_club@lap_dance_2g@ld_2g_reach", true) - Anim = "ld_2g_sit_idle" - - PlayerSitted = true - - SetFollowPedCamViewMode(4) - - SetEntityCoords(Cache.Player, xyz) - FreezeEntityPosition(Cache.Player, true) - SetEntityHeading(Cache.Player, heading) - TaskPlayAnim(Cache.Player, Dict, Anim, 8.0, -8.0, -1, 0, 0, false, false, false) - SetGameplayCamRelativeHeading(camheading) - - while Cache.InLapdance do - if GetEntityAnimCurrentTime(Cache.Player, Dict, Anim) >= 0.97 and GetEntityAnimCurrentTime(Cache.Player, Dict, Anim) < 1.0 then - TaskPlayAnim(Cache.Player, Dict, Anim, 8.0, -8.0, -1, 0, 0, false, false, false) - end - Citizen.Wait(50) - end - - FreezeEntityPosition(Cache.Player, false) - PlayerSitted = false - - if not Cache.lapStop then - SetEntityCoords(Cache.Player, xyz2) - Citizen.Wait(200) - SetFollowPedCamViewMode(PreviousCamViewMode) - TaskGoToCoordAnyMeans(Cache.Player, 117.48, -1294.82, 28.43, 1.0, 0, 0, 786603, 1.0) - Citizen.Wait(wait) - end + Dict = LoadDict("mini@strip_club@lap_dance_2g@ld_2g_reach", true) + Anim = "ld_2g_sit_idle" + PlayerSitted = true + + SetFollowPedCamViewMode(4) + + SetEntityCoords(Cache.Player, xyz) + FreezeEntityPosition(Cache.Player, true) + SetEntityHeading(Cache.Player, heading) + TaskPlayAnim(Cache.Player, Dict, Anim, 8.0, -8.0, -1, 0, 0, false, false, false) + SetGameplayCamRelativeHeading(camheading) + + while Cache.InLapdance do + if GetEntityAnimCurrentTime(Cache.Player, Dict, Anim) >= 0.97 and GetEntityAnimCurrentTime(Cache.Player, Dict, Anim) < 1.0 then + TaskPlayAnim(Cache.Player, Dict, Anim, 8.0, -8.0, -1, 0, 0, false, false, false) + end + Citizen.Wait(50) + end + + FreezeEntityPosition(Cache.Player, false) + PlayerSitted = false + + if not Cache.lapStop then + SetEntityCoords(Cache.Player, xyz2) + Citizen.Wait(200) + SetFollowPedCamViewMode(PreviousCamViewMode) + TaskGoToCoordAnyMeans(Cache.Player, 117.48, -1294.82, 28.43, 1.0, 0, 0, 786603, 1.0) + Citizen.Wait(wait) + end end function StripperFunc(ped, heading, heading2, heading3, xyz, xyz2, xyz3, xyz4, wait) + SetEntityHeading(ped, heading) + FreezeEntityPosition(ped, true) + TaskGoToCoordAnyMeans(Cache.Player, xyz, 1.0, 0, 0, 786603, 1.0) + Citizen.Wait(wait) + + Repeatcount = -13 + Repeatcount2 = 0 + + repeat + Citizen.Wait(200) + Repeatcount = Repeatcount + 1 + Repeatcount2 = Repeatcount2 + 1 + if Repeatcount == 17 then + TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@idles@stripper", true), "stripper_idle_02", 8.0, -8.0, -1, 0, 0, false, false, false) + Repeatcount = 0 + end + if Repeatcount2 >= 160 then + DeleteEntity(Cache.SpawnPed) + end + until PlayerSitted or Cache.lapStop + + FreezeEntityPosition(ped, false) + TaskGoToCoordAnyMeans(ped, xyz2, 174.93, 0, 0, 0, 0xbf800000) + Citizen.Wait(1000) + + TaskGoToCoordAnyMeans(ped, xyz3, 174.93, 0, 0, 0, 0xbf800000) + Citizen.Wait(2100) + + FreezeEntityPosition(ped, true) + SetEntityHeading(ped, heading2) - SetEntityHeading(ped, heading) - FreezeEntityPosition(ped, true) - TaskGoToCoordAnyMeans(Cache.Player, xyz, 1.0, 0, 0, 786603, 1.0) - Citizen.Wait(wait) - - Repeatcount = -13 - Repeatcount2 = 0 - - repeat - Citizen.Wait(200) - Repeatcount = Repeatcount + 1 - Repeatcount2 = Repeatcount2 + 1 - if Repeatcount == 17 then - TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@idles@stripper", true), "stripper_idle_02", 8.0, -8.0, -1, 0, 0, false, false, false) - Repeatcount = 0 - end - if Repeatcount2 >= 160 then - DeleteEntity(Cache.SpawnPed) - end - until PlayerSitted or Cache.lapStop - - FreezeEntityPosition(ped, false) - TaskGoToCoordAnyMeans(ped, xyz2, 174.93, 0, 0, 0, 0xbf800000) - Citizen.Wait(1000) - - TaskGoToCoordAnyMeans(ped, xyz3, 174.93, 0, 0, 0, 0xbf800000) - Citizen.Wait(2100) - - FreezeEntityPosition(ped, true) - SetEntityHeading(ped, heading2) - - StripperAnim() - - if not lapStop then - TaskGoToCoordAnyMeans(ped, xyz4, 174.93, 0, 0, 0, 0xbf800000) - Wait(2000) - - TaskPlayAnim(ped, LoadDict("mini@strip_club@idles@stripper", true), "stripper_idle_02", 8.0, -8.0, -1, 0, 0, false, false, false) - SetEntityHeading(ped, heading3) - end - - Cache.InLapdance = false - - Citizen.Wait(10000) + StripperAnim() + if not lapStop then + TaskGoToCoordAnyMeans(ped, xyz4, 174.93, 0, 0, 0, 0xbf800000) + Wait(2000) + + TaskPlayAnim(ped, LoadDict("mini@strip_club@idles@stripper", true), "stripper_idle_02", 8.0, -8.0, -1, 0, 0, false, false, false) + SetEntityHeading(ped, heading3) + end + + Cache.InLapdance = false + + Citizen.Wait(10000) end function StripperAnim() + FreezeEntityPosition(Cache.SpawnPed, false) + + if not Cache.lapStop then + TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@private_dance@part1", true), "priv_dance_p1", 8.0, -8.0, -1, 0, 0, false, false, false) + Wait(22300) + end - FreezeEntityPosition(Cache.SpawnPed, false) - - if not Cache.lapStop then - TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@private_dance@part1", true), "priv_dance_p1", 8.0, -8.0, -1, 0, 0, false, false, false) - Wait(22300) - end - - if not Cache.lapStop then - TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@private_dance@part2", true), "priv_dance_p2", 8.0, -8.0, -1, 0, 0, false, false, false) - Wait(31200) - end - - if not Cache.lapStop then - TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@private_dance@exit", true), "priv_dance_exit", 8.0, -8.0, -1, 0, 0, false, false, false) - Wait(8000) - end + if not Cache.lapStop then + TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@private_dance@part2", true), "priv_dance_p2", 8.0, -8.0, -1, 0, 0, false, false, false) + Wait(31200) + end + + if not Cache.lapStop then + TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@private_dance@exit", true), "priv_dance_exit", 8.0, -8.0, -1, 0, 0, false, false, false) + Wait(8000) + end end function LoadDict(Dict, Bool) - RequestAnimDict(Dict) - while not HasAnimDictLoaded(Dict) do + RequestAnimDict(Dict) + while not HasAnimDictLoaded(Dict) do Wait(20) - RequestAnimDict(Dict) + RequestAnimDict(Dict) end - if Bool then - return Dict - end + if Bool then + return Dict + end end -RegisterNetEvent('kc-unicorn:lapdance') -AddEventHandler('kc-unicorn:lapdance', function(PlayerMoney, PlayerBirthdate, TodayDate, Stripper) - Birthdate = {} - Date = {} - Cache.lapStop = false - Cache.InLapdance = true - PreviousCamViewMode = GetFollowPedCamViewMode(Cache.Player) - - if Config.Framework == 'QBCore' then - index = 1 - for value in string.gmatch(PlayerBirthdate, "[^-]+") do - Birthdate[index] = value - index = index + 1 - end - - index = 1 - for value in string.gmatch(TodayDate, "[^-]+") do - Date[index] = value - index = index + 1 - end - - Year = Date[1] - Birthdate[1] - 4 - Month = Date[2] - Birthdate[2] - Day = Date[3] - Birthdate[3] - else - Year = 1000 - Month = 0 - Day = 0 - end - - RequestModel(Config.Strippers[Stripper].Model) - Cache.InCooldown = true - while not HasModelLoaded(1846523796) do - Wait(20) - end - Citizen.Wait(200) - - SetEntityHeading(Cache.Player, 120.18) - - if not Seat1 and not Seat1Taken then - Seat1Taken = true - TriggerServerEvent('kc-unicorn:Seat1') - elseif not Seat2 and not Seat2Taken then - Seat2Taken = true - TriggerServerEvent('kc-unicorn:Seat2') - elseif not Seat3 and not Seat3Taken then - Seat3Taken = true - TriggerServerEvent('kc-unicorn:Seat3') - elseif not Seat4 and not Seat4Taken then - Seat4Taken = true - TriggerServerEvent('kc-unicorn:Seat4') - elseif not Seat5 and not Seat5Taken then - Seat5Taken = true - TriggerServerEvent('kc-unicorn:Seat5') - elseif not Seat6 and not Seat6Taken then - Seat6Taken = true - TriggerServerEvent('kc-unicorn:Seat6') - elseif not Seat7 and not Seat7Taken then - Seat7Taken = true - TriggerServerEvent('kc-unicorn:Seat7') - end - - if Seat1Taken then - SpawnObject = CreatePed(4, 1846523796, 117.1, -1301.25, 28.05, 303.19, true, false) - elseif Seat2Taken then - SpawnObject = CreatePed(4, 1846523796, 114.98, -1302.43, 28.05, 303.19, true, false) - elseif Seat3Taken then - SpawnObject = CreatePed(4, 1846523796, 112.89, -1303.69, 28.05, 303.19, true, false) - elseif Seat4Taken then - SpawnObject = CreatePed(4, 1846523796, 111.32, -1304.58, 28.05, 303.19, true, false) - elseif Seat5Taken then - SpawnObject = CreatePed(4, 1846523796, 110.89, -1303.84, 28.05, 303.19, true, false) - elseif Seat6Taken then - SpawnObject = CreatePed(4, 1846523796, 112.42, -1303.04, 28.05, 303.19, true, false) - elseif Seat7Taken then - SpawnObject = CreatePed(4, 1846523796, 114.29, -1301.91, 28.05, 303.19, true, false) - end - - Citizen.Wait(100) - Cache.SpawnPed = SpawnObject - FreezeEntityPosition(Cache.SpawnPed, true) - - SetPedComponentVariation(Cache.SpawnPed, 1, Config.Strippers[Stripper].Drawables.Head) -- Head - SetPedComponentVariation(Cache.SpawnPed, 2, Config.Strippers[Stripper].Drawables.Hair, Config.Strippers[Stripper].Textures.HairTex) -- Hair - SetPedComponentVariation(Cache.SpawnPed, 3, Config.Strippers[Stripper].Drawables.Torso) -- Torso - SetPedComponentVariation(Cache.SpawnPed, 4, Config.Strippers[Stripper].Drawables.Shoes, Config.Strippers[Stripper].Textures.ShoesTex) -- Shoes - SetPedComponentVariation(Cache.SpawnPed, 6, Config.Strippers[Stripper].Drawables.Underwear, Config.Strippers[Stripper].Textures.UnderwearTex) -- Underwear - SetPedComponentVariation(Cache.SpawnPed, 10, 0) -- Decals ?? - SetPedComponentVariation(Cache.SpawnPed, 11, Config.Strippers[Stripper].Drawables.Torso2) -- Auxiliary parts for torso - - if Year >= Config.NudityAge + 1 then - underage = false - elseif Year == Config.NudityAge then - if Month == 0 and Day <= 0 then - underage = false - else - underage = true - end - else - underage = true - end - - if underage then - SetPedComponentVariation(Cache.SpawnPed, 8, 0, Config.Strippers[Stripper].Textures.BraTex) -- Not Topless - elseif not underage and not Config.Nudity then - SetPedComponentVariation(Cache.SpawnPed, 8, 0, Config.Strippers[Stripper].Textures.BraTex) -- Not Topless - else - SetPedComponentVariation(Cache.SpawnPed, 8, 1) -- Topless - end - print("Shoes | Drawable: " .. GetPedDrawableVariation(Cache.SpawnPed, 4), "Drawables: " .. GetNumberOfPedDrawableVariations(Cache.SpawnPed, 4), "Texture: " .. GetPedTextureVariation(Cache.SpawnPed, 4), "Textures: " .. GetNumberOfPedTextureVariations(Cache.SpawnPed, 4), "Palette: " .. GetPedPaletteVariation(Cache.SpawnPed, 4)) - print("Underwear | Drawable: " .. GetPedDrawableVariation(Cache.SpawnPed, 6), "Drawables: " .. GetNumberOfPedDrawableVariations(Cache.SpawnPed, 6), "Texture: " .. GetPedTextureVariation(Cache.SpawnPed, 6), "Textures: " .. GetNumberOfPedTextureVariations(Cache.SpawnPed, 6), "Palette: " .. GetPedPaletteVariation(Cache.SpawnPed, 6)) - print("Underwear?? | Drawable: " .. GetPedDrawableVariation(Cache.SpawnPed, 10), "Drawables: " .. GetNumberOfPedDrawableVariations(Cache.SpawnPed, 10), "Texture: " .. GetPedTextureVariation(Cache.SpawnPed, 10), "Textures: " .. GetNumberOfPedTextureVariations(Cache.SpawnPed, 10), "Palette: " .. GetPedPaletteVariation(Cache.SpawnPed, 10)) - - if Config.Framework ~= 'Standalone' then - if PlayerMoney >= Config.LegMoney then - SetPedComponentVariation(Cache.SpawnPed, 9, 1) - else - SetPedComponentVariation(Cache.SpawnPed, 9, 0) - end - end - - if Config.Debug then - print("------ kc-unicorn : Debug print start ------") - print("Player cash: ", PlayerMoney, "Player birthdate: ", PlayerBirthdate, "Today date: ", TodayDate) - print('Config.Language is set to: ' .. Config.Language) - print('Framework used: ' .. Config.Framework) - print(Config.Language .. "", lg) - --[[ print("Birthdate split: ", Birthdate[1], Birthdate[2], Birthdate[3]) +RegisterNetEvent("kc-unicorn:lapdance") +AddEventHandler("kc-unicorn:lapdance", function(PlayerMoney, PlayerBirthdate, TodayDate, Stripper) + Birthdate = {} + Date = {} + Cache.lapStop = false + Cache.InLapdance = true + PreviousCamViewMode = GetFollowPedCamViewMode(Cache.Player) + + if Config.Framework == "QBCore" then + index = 1 + for value in string.gmatch(PlayerBirthdate, "[^-]+") do + Birthdate[index] = value + index = index + 1 + end + + index = 1 + for value in string.gmatch(TodayDate, "[^-]+") do + Date[index] = value + index = index + 1 + end + + Year = Date[1] - Birthdate[1] - 4 + Month = Date[2] - Birthdate[2] + Day = Date[3] - Birthdate[3] + else + Year = 1000 + Month = 0 + Day = 0 + end + + RequestModel(Config.Strippers[Stripper].Model) + Cache.InCooldown = true + while not HasModelLoaded(1846523796) do + Wait(20) + end + Citizen.Wait(200) + + SetEntityHeading(Cache.Player, 120.18) + + if not Seat1 and not Seat1Taken then + Seat1Taken = true + TriggerServerEvent("kc-unicorn:Seat1") + elseif not Seat2 and not Seat2Taken then + Seat2Taken = true + TriggerServerEvent("kc-unicorn:Seat2") + elseif not Seat3 and not Seat3Taken then + Seat3Taken = true + TriggerServerEvent("kc-unicorn:Seat3") + elseif not Seat4 and not Seat4Taken then + Seat4Taken = true + TriggerServerEvent("kc-unicorn:Seat4") + elseif not Seat5 and not Seat5Taken then + Seat5Taken = true + TriggerServerEvent("kc-unicorn:Seat5") + elseif not Seat6 and not Seat6Taken then + Seat6Taken = true + TriggerServerEvent("kc-unicorn:Seat6") + elseif not Seat7 and not Seat7Taken then + Seat7Taken = true + TriggerServerEvent("kc-unicorn:Seat7") + end + + if Seat1Taken then + SpawnObject = CreatePed(4, 1846523796, 117.1, -1301.25, 28.05, 303.19, true, false) + elseif Seat2Taken then + SpawnObject = CreatePed(4, 1846523796, 114.98, -1302.43, 28.05, 303.19, true, false) + elseif Seat3Taken then + SpawnObject = CreatePed(4, 1846523796, 112.89, -1303.69, 28.05, 303.19, true, false) + elseif Seat4Taken then + SpawnObject = CreatePed(4, 1846523796, 111.32, -1304.58, 28.05, 303.19, true, false) + elseif Seat5Taken then + SpawnObject = CreatePed(4, 1846523796, 110.89, -1303.84, 28.05, 303.19, true, false) + elseif Seat6Taken then + SpawnObject = CreatePed(4, 1846523796, 112.42, -1303.04, 28.05, 303.19, true, false) + elseif Seat7Taken then + SpawnObject = CreatePed(4, 1846523796, 114.29, -1301.91, 28.05, 303.19, true, false) + end + + Citizen.Wait(100) + Cache.SpawnPed = SpawnObject + FreezeEntityPosition(Cache.SpawnPed, true) + + SetPedComponentVariation(Cache.SpawnPed, 1, Config.Strippers[Stripper].Drawables.Head) -- Head + SetPedComponentVariation(Cache.SpawnPed, 2, Config.Strippers[Stripper].Drawables.Hair, Config.Strippers[Stripper].Textures.HairTex) -- Hair + SetPedComponentVariation(Cache.SpawnPed, 3, Config.Strippers[Stripper].Drawables.Torso) -- Torso + SetPedComponentVariation(Cache.SpawnPed, 4, Config.Strippers[Stripper].Drawables.Shoes, Config.Strippers[Stripper].Textures.ShoesTex) -- Shoes + SetPedComponentVariation(Cache.SpawnPed, 6, Config.Strippers[Stripper].Drawables.Underwear, Config.Strippers[Stripper].Textures.UnderwearTex) -- Underwear + SetPedComponentVariation(Cache.SpawnPed, 10, 0) -- Decals ?? + SetPedComponentVariation(Cache.SpawnPed, 11, Config.Strippers[Stripper].Drawables.Torso2) -- Auxiliary parts for torso + + if Year >= Config.NudityAge + 1 then + Underage = false + elseif Year == Config.NudityAge then + if Month == 0 and Day <= 0 then + Underage = false + else + Underage = true + end + else + Underage = true + end + + if Underage then + SetPedComponentVariation(Cache.SpawnPed, 8, 0, Config.Strippers[Stripper].Textures.BraTex) -- Not Topless + elseif not Underage and not Config.Nudity then + SetPedComponentVariation(Cache.SpawnPed, 8, 0, Config.Strippers[Stripper].Textures.BraTex) -- Not Topless + else + SetPedComponentVariation(Cache.SpawnPed, 8, 1) -- Topless + end + print( + "Shoes | Drawable: " .. GetPedDrawableVariation(Cache.SpawnPed, 4), + "Drawables: " .. GetNumberOfPedDrawableVariations(Cache.SpawnPed, 4), + "Texture: " .. GetPedTextureVariation(Cache.SpawnPed, 4), + "Textures: " .. GetNumberOfPedTextureVariations(Cache.SpawnPed, 4), + "Palette: " .. GetPedPaletteVariation(Cache.SpawnPed, 4) + ) + print( + "Underwear | Drawable: " .. GetPedDrawableVariation(Cache.SpawnPed, 6), + "Drawables: " .. GetNumberOfPedDrawableVariations(Cache.SpawnPed, 6), + "Texture: " .. GetPedTextureVariation(Cache.SpawnPed, 6), + "Textures: " .. GetNumberOfPedTextureVariations(Cache.SpawnPed, 6), + "Palette: " .. GetPedPaletteVariation(Cache.SpawnPed, 6) + ) + print( + "Underwear?? | Drawable: " .. GetPedDrawableVariation(Cache.SpawnPed, 10), + "Drawables: " .. GetNumberOfPedDrawableVariations(Cache.SpawnPed, 10), + "Texture: " .. GetPedTextureVariation(Cache.SpawnPed, 10), + "Textures: " .. GetNumberOfPedTextureVariations(Cache.SpawnPed, 10), + "Palette: " .. GetPedPaletteVariation(Cache.SpawnPed, 10) + ) + + if Config.Framework ~= "Standalone" then + if PlayerMoney >= Config.LegMoney then + SetPedComponentVariation(Cache.SpawnPed, 9, 1) + else + SetPedComponentVariation(Cache.SpawnPed, 9, 0) + end + end + + if Config.Debug then + print("------ kc-unicorn : Debug print start ------") + print("Player cash: ", PlayerMoney, "Player birthdate: ", PlayerBirthdate, "Today date: ", TodayDate) + print("Config.Language is set to: " .. Config.Language) + print("Framework used: " .. Config.Framework) + print(Config.Language .. "", lg) + --[[ print("Birthdate split: ", Birthdate[1], Birthdate[2], Birthdate[3]) print("Date split: ", Date[1], Date[2], Date[3]) ]] - print("Year: ", Year, "Month: ", Month, "Day: ", Day) - print(GetPedDrawableVariation(Cache.SpawnPed, 1), "Head") - print(GetPedDrawableVariation(Cache.SpawnPed, 2), "Beard") - print(GetPedDrawableVariation(Cache.SpawnPed, 3), "Torso") - print(GetPedDrawableVariation(Cache.SpawnPed, 4), "Legs") - print(GetPedDrawableVariation(Cache.SpawnPed, 5), "Hands") - print(GetPedDrawableVariation(Cache.SpawnPed, 6), "Foot") - print(GetPedDrawableVariation(Cache.SpawnPed, 7), "???") - print(GetPedDrawableVariation(Cache.SpawnPed, 8), "Accessories 1") - print(GetPedDrawableVariation(Cache.SpawnPed, 9), "Accessories 2") - print(GetPedDrawableVariation(Cache.SpawnPed, 10), "Decals") - print(GetPedDrawableVariation(Cache.SpawnPed, 11), "Auxiliary parts for torso") - print('') - if Config.NudityAge ~= 0 then - if underage then - print("Player is underage") - else - print("Player isn't underage") - end - end - if not Config.Nudity and underage then - print("Stripper isn't topless") - elseif not Config.Nudity and not underage then - print("Stripper isn't topless") - else - print("Stripper is topless") - end - print("Player in lap dance: " .. PlayerSeated) - print("------ kc-unicorn : Debug print end ------") - end - - TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@idles@stripper", true), "stripper_idle_02", 8.0, -8.0, -1, 0, 0, false, false, false) - - SetEntityCoords(Cache.Player, 116.88, -1295.04, 28.42) - - ------------------- First seat ---------------------- - if Seat1Taken then - StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(118.71, -1301.93, 28.42), vector3(118.0, -1300.3, 28.17), vector3(118.74, -1301.91, 29.27), vector3(117.1, -1301.25, 28.05), 4900) - - Seat1Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat1') - - ------------------- Second seat ---------------------- - elseif Seat2Taken then - StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(116.67, -1303.35, 29.27), vector3(115.85, -1302.02, 29.02), vector3(116.25, -1302.85, 29.27), vector3(114.98, -1302.43, 28.05), 6000) - - Seat2Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat2') - - ------------------- Third seat ---------------------- - elseif Seat3Taken then - StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(114.64, -1304.54, 29.27), vector3(113.56, -1302.94, 29.02), vector3(114.33, -1304.23, 29.27), vector3(112.89, -1303.69, 28.05), 7000) - Seat3Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat3') - - ------------------- Fourth seat ---------------------- - elseif Seat4Taken then - StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(112.66, -1305.52, 29.27), vector3(111.82, -1304.17, 29.02), vector3(112.42, -1305.11, 29.27), vector3(111.32, -1304.58, 28.05), 8000) - Seat4Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat4') - - ------------------- Fifth seat ---------------------- - elseif Seat5Taken then - StripperFunc(Cache.SpawnPed, 303.19, 29.5, 308.6, vector3(111.18, -1302.62, 29.27), vector3(111.46, -1303.61, 29.02), vector3(111.17, -1302.81, 29.27), vector3(110.89, -1303.84, 28.05), 8000) - Seat5Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat5') - - ------------------- Sixth seat ---------------------- - elseif Seat6Taken then - StripperFunc(Cache.SpawnPed, 303.19, 29.5, 308.6, vector3(112.64, -1301.27, 29.27), vector3(113.35, -1302.36, 29.02), vector3(112.91, -1301.62, 29.27), vector3(112.42, -1303.04, 28.05), 7000) - Seat6Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat6') - - ------------------- Seventh seat ---------------------- - elseif Seat7Taken then - StripperFunc(Cache.SpawnPed, 303.19, 29.5, 308.6, vector3(114.73, -1300.41, 29.27), vector3(115.08, -1301.39, 29.02), vector3(114.88, -1300.64, 29.27), vector3(114.29, -1301.91, 28.05), 7000) - Seat7Taken = false - TriggerServerEvent('kc-unicorn:RemoveSeat7') - end - - TriggerServerEvent('kc-unicorn:idle') - Citizen.Wait(1000) - Cache.InCooldown = false - - if not Cache.lapStop then - DeleteEntity(Cache.SpawnPed) - end + print("Year: ", Year, "Month: ", Month, "Day: ", Day) + print(GetPedDrawableVariation(Cache.SpawnPed, 1), "Head") + print(GetPedDrawableVariation(Cache.SpawnPed, 2), "Beard") + print(GetPedDrawableVariation(Cache.SpawnPed, 3), "Torso") + print(GetPedDrawableVariation(Cache.SpawnPed, 4), "Legs") + print(GetPedDrawableVariation(Cache.SpawnPed, 5), "Hands") + print(GetPedDrawableVariation(Cache.SpawnPed, 6), "Foot") + print(GetPedDrawableVariation(Cache.SpawnPed, 7), "???") + print(GetPedDrawableVariation(Cache.SpawnPed, 8), "Accessories 1") + print(GetPedDrawableVariation(Cache.SpawnPed, 9), "Accessories 2") + print(GetPedDrawableVariation(Cache.SpawnPed, 10), "Decals") + print(GetPedDrawableVariation(Cache.SpawnPed, 11), "Auxiliary parts for torso") + print("") + if Config.NudityAge ~= 0 then + if Underage then + print("Player is underage") + else + print("Player isn't underage") + end + end + if not Config.Nudity and Underage then + print("Stripper isn't topless") + elseif not Config.Nudity and not Underage then + print("Stripper isn't topless") + else + print("Stripper is topless") + end + print("Player in lap dance: " .. PlayerSeated) + print("------ kc-unicorn : Debug print end ------") + end + + TaskPlayAnim(Cache.SpawnPed, LoadDict("mini@strip_club@idles@stripper", true), "stripper_idle_02", 8.0, -8.0, -1, 0, 0, false, false, false) + + SetEntityCoords(Cache.Player, 116.88, -1295.04, 28.42) + + ------------------- First seat ---------------------- + if Seat1Taken then + StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(118.71, -1301.93, 28.42), vector3(118.0, -1300.3, 28.17), vector3(118.74, -1301.91, 29.27), vector3(117.1, -1301.25, 28.05), 4900) + + Seat1Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat1") + + ------------------- Second seat ---------------------- + elseif Seat2Taken then + StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(116.67, -1303.35, 29.27), vector3(115.85, -1302.02, 29.02), vector3(116.25, -1302.85, 29.27), vector3(114.98, -1302.43, 28.05), 6000) + + Seat2Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat2") + + ------------------- Third seat ---------------------- + elseif Seat3Taken then + StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(114.64, -1304.54, 29.27), vector3(113.56, -1302.94, 29.02), vector3(114.33, -1304.23, 29.27), vector3(112.89, -1303.69, 28.05), 7000) + Seat3Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat3") + + ------------------- Fourth seat ---------------------- + elseif Seat4Taken then + StripperFunc(Cache.SpawnPed, 303.19, 216.6, 308.6, vector3(112.66, -1305.52, 29.27), vector3(111.82, -1304.17, 29.02), vector3(112.42, -1305.11, 29.27), vector3(111.32, -1304.58, 28.05), 8000) + Seat4Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat4") + + ------------------- Fifth seat ---------------------- + elseif Seat5Taken then + StripperFunc(Cache.SpawnPed, 303.19, 29.5, 308.6, vector3(111.18, -1302.62, 29.27), vector3(111.46, -1303.61, 29.02), vector3(111.17, -1302.81, 29.27), vector3(110.89, -1303.84, 28.05), 8000) + Seat5Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat5") + + ------------------- Sixth seat ---------------------- + elseif Seat6Taken then + StripperFunc(Cache.SpawnPed, 303.19, 29.5, 308.6, vector3(112.64, -1301.27, 29.27), vector3(113.35, -1302.36, 29.02), vector3(112.91, -1301.62, 29.27), vector3(112.42, -1303.04, 28.05), 7000) + Seat6Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat6") + + ------------------- Seventh seat ---------------------- + elseif Seat7Taken then + StripperFunc(Cache.SpawnPed, 303.19, 29.5, 308.6, vector3(114.73, -1300.41, 29.27), vector3(115.08, -1301.39, 29.02), vector3(114.88, -1300.64, 29.27), vector3(114.29, -1301.91, 28.05), 7000) + Seat7Taken = false + TriggerServerEvent("kc-unicorn:RemoveSeat7") + end + + TriggerServerEvent("kc-unicorn:idle") + Citizen.Wait(1000) + Cache.InCooldown = false + + if not Cache.lapStop then + DeleteEntity(Cache.SpawnPed) + end end) Citizen.CreateThread(function() + while true do + if not Cache.InLapdance then + Citizen.Wait(1000) + else + Citizen.Wait(0) + end + + if Seat1Taken then + local sitdist = #(Cache.PlyCoo - vector3(118.75, -1301.97, 28.42)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(119.06, -1302.66, 27.78), 40.0, -10.0, vector3(118.75, -1301.99, 28.42), 5000) + end + elseif Seat2Taken then + local sitdist = #(Cache.PlyCoo - vector3(116.59, -1303.01, 28.42)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(116.9, -1303.75, 27.78), 40.0, -10.0, vector3(116.59, -1303.01, 28.42), 6200) + end + elseif Seat3Taken then + local sitdist = #(Cache.PlyCoo - vector3(114.64, -1304.54, 29.27)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(114.86, -1305.0, 27.78), 40.0, -10.0, vector3(114.64, -1304.54, 29.27), 6800) + end + elseif Seat4Taken then + local sitdist = #(Cache.PlyCoo - vector3(112.66, -1305.52, 29.27)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(113.08, -1306.17, 27.78), 40.0, -10.0, vector3(112.66, -1305.52, 29.27), 7500) + end + elseif Seat5Taken then + local sitdist = #(Cache.PlyCoo - vector3(111.18, -1302.62, 29.27)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(110.57, -1301.82, 27.78), 216.6, -10.0, vector3(111.18, -1302.62, 29.27), 7500) + end + elseif Seat6Taken then + local sitdist = #(Cache.PlyCoo - vector3(112.64, -1301.27, 29.27)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(112.34, -1300.76, 27.78), 216.6, -10.0, vector3(112.64, -1301.27, 29.27), 6800) + end + elseif Seat7Taken then + local sitdist = #(Cache.PlyCoo - vector3(114.73, -1300.41, 29.27)) + if sitdist < 1 and Cache.InLapdance then + PlayerFunc(vector3(114.27, -1299.66, 27.78), 216.6, -10.0, vector3(114.73, -1300.41, 29.27), 6000) + end + end - while true do - - if not Cache.InLapdance then - Citizen.Wait(1000) - else - Citizen.Wait(0) - end - - if Seat1Taken then - local sitdist = #(Cache.PlyCoo - vector3(118.75, -1301.97, 28.42)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(119.06, -1302.66, 27.78), 40.0, -10.0, vector3(118.75, -1301.99, 28.42), 5000) - end - elseif Seat2Taken then - local sitdist = #(Cache.PlyCoo - vector3(116.59, -1303.01, 28.42)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(116.9, -1303.75, 27.78), 40.0, -10.0, vector3(116.59, -1303.01, 28.42), 6200) - end - elseif Seat3Taken then - local sitdist = #(Cache.PlyCoo - vector3(114.64, -1304.54, 29.27)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(114.86, -1305.0, 27.78), 40.0, -10.0, vector3(114.64, -1304.54, 29.27), 6800) - end - elseif Seat4Taken then - local sitdist = #(Cache.PlyCoo - vector3(112.66, -1305.52, 29.27)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(113.08, -1306.17, 27.78), 40.0, -10.0, vector3(112.66, -1305.52, 29.27), 7500) - end - elseif Seat5Taken then - local sitdist = #(Cache.PlyCoo - vector3(111.18, -1302.62, 29.27)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(110.57, -1301.82, 27.78), 216.6, -10.0, vector3(111.18, -1302.62, 29.27), 7500) - end - elseif Seat6Taken then - local sitdist = #(Cache.PlyCoo - vector3(112.64, -1301.27, 29.27)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(112.34, -1300.76, 27.78), 216.6, -10.0, vector3(112.64, -1301.27, 29.27), 6800) - end - elseif Seat7Taken then - local sitdist = #(Cache.PlyCoo - vector3(114.73, -1300.41, 29.27)) - if sitdist < 1 and Cache.InLapdance then - PlayerFunc(vector3(114.27, -1299.66, 27.78), 216.6, -10.0, vector3(114.73, -1300.41, 29.27), 6000) - end - end - - DisableControlAction(2, 0, false) - end + DisableControlAction(2, 0, false) + end end) RegisterNetEvent("kc-unicorn:SetPlayerSeated") -AddEventHandler("kc-unicorn:SetPlayerSeated", function(GetPlayerSeated, Seat1Busy, Seat2Busy, Seat3Busy, Seat4Busy, Seat5Busy, Seat6Busy, Seat7Busy) - Seat1 = Seat1Busy - Seat2 = Seat2Busy - Seat3 = Seat3Busy - Seat4 = Seat4Busy - Seat5 = Seat5Busy - Seat6 = Seat6Busy - Seat7 = Seat7Busy - PlayerSeated = GetPlayerSeated +AddEventHandler("kc-unicorn:SetPlayerSeated", function(GetPlayerSeated, Seat1Busy, Seat2Busy, Seat3Busy, Seat4Busy, Seat5Busy, Seat6Busy, Seat7Busy) + Seat1 = Seat1Busy + Seat2 = Seat2Busy + Seat3 = Seat3Busy + Seat4 = Seat4Busy + Seat5 = Seat5Busy + Seat6 = Seat6Busy + Seat7 = Seat7Busy + PlayerSeated = GetPlayerSeated end) -------- @@ -658,44 +660,43 @@ end) ---- Lean Citizen.CreateThread(function() + if Config.Text == "3D" then + Input = "~r~E~w~ - " + else + Input = "~INPUT_CONTEXT~ " + end - if Config.Text == '3D' then - Input = '~r~E~w~ - ' - else - Input = '~INPUT_CONTEXT~ ' - end - - while true do - if Cache.inleanPoly then - if leanPoly1:isPointInside(Cache.PlyCoo) then - Citizen.Wait(1) - DrawText3D(Cache.PlyCoo, Input .. Loc('Lean')) - if IsControlJustReleased(0, 51) then - LeanStart(29.0) - end - elseif leanPoly2:isPointInside(Cache.PlyCoo) then - Citizen.Wait(1) - DrawText3D(Cache.PlyCoo, Input .. Loc('Lean')) - if IsControlJustReleased(0, 51) then - LeanStart(116.2) - end - elseif leanPoly3:isPointInside(Cache.PlyCoo) then - Citizen.Wait(1) - DrawText3D(Cache.PlyCoo, Input .. Loc('Lean')) - if IsControlJustReleased(0, 51) then - LeanStart(210.0) - end - else - Citizen.Wait(200) - end - else - Citizen.Wait(200) - end - end + while true do + if Cache.inleanPoly then + if leanPoly1:isPointInside(Cache.PlyCoo) then + Citizen.Wait(1) + DrawText3D(Cache.PlyCoo, Input .. Loc("Lean")) + if IsControlJustReleased(0, 51) then + LeanStart(29.0) + end + elseif leanPoly2:isPointInside(Cache.PlyCoo) then + Citizen.Wait(1) + DrawText3D(Cache.PlyCoo, Input .. Loc("Lean")) + if IsControlJustReleased(0, 51) then + LeanStart(116.2) + end + elseif leanPoly3:isPointInside(Cache.PlyCoo) then + Citizen.Wait(1) + DrawText3D(Cache.PlyCoo, Input .. Loc("Lean")) + if IsControlJustReleased(0, 51) then + LeanStart(210.0) + end + else + Citizen.Wait(200) + end + else + Citizen.Wait(200) + end + end end) function LoadModel(model) - model = GetHashKey(model) + model = GetHashKey(model) if not HasModelLoaded(model) and IsModelInCdimage(model) then RequestModel(model) @@ -706,135 +707,128 @@ function LoadModel(model) end function LeanStart(PlyHeading) - - local text = Loc('LeanNotice', Config.ThrowCost) - LoadModel("prop_anim_cash_note_b") - local is_female = function() - return(GetEntityModel(Cache.Player) == "mp_f_freemode_01" and "_female" or "") - end - - if Config.Framework == "Standalone" then - text = Loc('StandaloneLeanNotice') - end - - SetEntityCoordsNoOffset(Cache.Player, Cache.PlyCoo) - FreezeEntityPosition(Cache.Player, true) - SetEntityHeading(Cache.Player, PlyHeading) - Cache.InLean = true - Wait(50) - - TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@enter", true), "enter" .. is_female(), 8.0, -8.0, -1, 0, 0, false, false, false) - Wait(2750) - PreviousCamViewMode = GetFollowPedCamViewMode(Cache.Player) - SetFollowPedCamViewMode(4) - SetGameplayCamRelativeHeading(0.0) - TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@base", true), "base" .. is_female(), 8.0, -8.0, -1, 1, 0, false, false, false) - - while true do - Wait(0) - - DrawText2D(text) - if IsControlJustReleased(0, 22) then - if Config.Framework == "QBCore" then - PlayerData = QBCore.Functions.GetPlayerData() - PlayerMoney = PlayerData.money["cash"] - elseif Config.Framework == "ESX" then - TriggerServerEvent('kc-unicorn:esxmoney') - elseif Config.Framework == "Standalone" then - PlayerMoney = Config.ThrowCost + 1 - end - repeat - Citizen.Wait(100) - until PlayerMoney ~= nil - if Config.Debug then - print("Player money: " .. PlayerMoney, "Throw cost: " .. Config.ThrowCost) - end - if PlayerMoney >= Config.ThrowCost then - - TriggerServerEvent('kc-unicorn:leanthrow') - local pos = GetPedBoneCoords(Cache.Player, 28422, 0.0, 0.0, 0.0) - local cash = CreateObject("prop_anim_cash_note_b", pos, true, false, false) - SetEntityAlpha(cash, 0, false) - AttachEntityToEntity(cash, Cache.Player, GetPedBoneIndex(Cache.Player, 28422), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true) - TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@toss", true), "toss" .. is_female(), 8.0, -8.0, -1, 2, 0, false, false, false) - Citizen.Wait(150) - SetEntityAlpha(cash, 255, false) - while true do - if GetEntityAnimCurrentTime(Cache.Player, "mini@strip_club@leaning@toss", "toss" .. is_female()) >= 0.74 then - local alphaLevel = 255 - repeat - SetEntityAlpha(cash, alphaLevel, false) - alphaLevel = alphaLevel - 51 - Citizen.Wait(40) - until(alphaLevel == 0) - DeleteEntity(cash) - break - end - Citizen.Wait(50) - end - TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@base", true), "base" .. is_female(), 8.0, -8.0, -1, 1, 0, false, false, false) - - else - if Config.Framework == 'QBCore' then - QBCore.Functions.Notify(Loc('NotEnoughCashLean'), "error") - else - TriggerEvent('kc-unicorn:showNotify', Loc('NotEnoughCashLean')) - end - end - elseif IsControlJustReleased(0, 51) then - break - end - end - - Cache.InLean = false - SetFollowPedCamViewMode(PreviousCamViewMode) - Wait(100) - TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@exit", true), "exit" .. is_female(), 8.0, -8.0, -1, 0, 0, false, false, false) - FreezeEntityPosition(Cache.Player, false) + local text = Loc("LeanNotice", Config.ThrowCost) + LoadModel("prop_anim_cash_note_b") + local is_female = function() + return (GetEntityModel(Cache.Player) == "mp_f_freemode_01" and "_female" or "") + end + + if Config.Framework == "Standalone" then + text = Loc("StandaloneLeanNotice") + end + + SetEntityCoordsNoOffset(Cache.Player, Cache.PlyCoo) + FreezeEntityPosition(Cache.Player, true) + SetEntityHeading(Cache.Player, PlyHeading) + Cache.InLean = true + Wait(50) + + TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@enter", true), "enter" .. is_female(), 8.0, -8.0, -1, 0, 0, false, false, false) + Wait(2750) + PreviousCamViewMode = GetFollowPedCamViewMode(Cache.Player) + SetFollowPedCamViewMode(4) + SetGameplayCamRelativeHeading(0.0) + TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@base", true), "base" .. is_female(), 8.0, -8.0, -1, 1, 0, false, false, false) + + while true do + Wait(0) + + DrawText2D(text) + if IsControlJustReleased(0, 22) then + if Config.Framework == "QBCore" then + PlayerData = QBCore.Functions.GetPlayerData() + PlayerMoney = PlayerData.money["cash"] + elseif Config.Framework == "ESX" then + TriggerServerEvent("kc-unicorn:esxmoney") + elseif Config.Framework == "Standalone" then + PlayerMoney = Config.ThrowCost + 1 + end + repeat + Citizen.Wait(100) + until PlayerMoney ~= nil + if Config.Debug then + print("Player money: " .. PlayerMoney, "Throw cost: " .. Config.ThrowCost) + end + if PlayerMoney >= Config.ThrowCost then + TriggerServerEvent("kc-unicorn:leanthrow") + local pos = GetPedBoneCoords(Cache.Player, 28422, 0.0, 0.0, 0.0) + local cash = CreateObject("prop_anim_cash_note_b", pos, true, false, false) + SetEntityAlpha(cash, 0, false) + AttachEntityToEntity(cash, Cache.Player, GetPedBoneIndex(Cache.Player, 28422), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true) + TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@toss", true), "toss" .. is_female(), 8.0, -8.0, -1, 2, 0, false, false, false) + Citizen.Wait(150) + SetEntityAlpha(cash, 255, false) + while true do + if GetEntityAnimCurrentTime(Cache.Player, "mini@strip_club@leaning@toss", "toss" .. is_female()) >= 0.74 then + local alphaLevel = 255 + repeat + SetEntityAlpha(cash, alphaLevel, false) + alphaLevel = alphaLevel - 51 + Citizen.Wait(40) + until alphaLevel == 0 + DeleteEntity(cash) + break + end + Citizen.Wait(50) + end + TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@base", true), "base" .. is_female(), 8.0, -8.0, -1, 1, 0, false, false, false) + else + if Config.Framework == "QBCore" then + QBCore.Functions.Notify(Loc("NotEnoughCashLean"), "error") + else + TriggerEvent("kc-unicorn:showNotify", Loc("NotEnoughCashLean")) + end + end + elseif IsControlJustReleased(0, 51) then + break + end + end + + Cache.InLean = false + SetFollowPedCamViewMode(PreviousCamViewMode) + Wait(100) + TaskPlayAnim(Cache.Player, LoadDict("mini@strip_club@leaning@exit", true), "exit" .. is_female(), 8.0, -8.0, -1, 0, 0, false, false, false) + FreezeEntityPosition(Cache.Player, false) end -------- ---- ???? - -RegisterNetEvent('kc-unicorn:poledancescene') -AddEventHandler('kc-unicorn:poledancescene', function(ped, number) - PedPole = NetworkGetEntityFromNetworkId(ped) - local scene = NetworkCreateSynchronisedScene(vector3(112.65, -1286.74, 28.5), vector3(0.0, 0.0, 0.0), 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(PedPole, scene, 'mini@strip_club@pole_dance@pole_dance'..number, 'pd_dance_0'..number, 1.5, -4.0, 1, 1, 1148846080, 0) - NetworkStartSynchronisedScene(scene) - Citizen.Wait(30000) - TriggerServerEvent('kc-unicorn:poledancestop') +RegisterNetEvent("kc-unicorn:poledancescene") +AddEventHandler("kc-unicorn:poledancescene", function(ped, number) + PedPole = NetworkGetEntityFromNetworkId(ped) + local scene = NetworkCreateSynchronisedScene(vector3(112.65, -1286.74, 28.5), vector3(0.0, 0.0, 0.0), 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(PedPole, scene, "mini@strip_club@pole_dance@pole_dance" .. number, "pd_dance_0" .. number, 1.5, -4.0, 1, 1, 1148846080, 0) + NetworkStartSynchronisedScene(scene) + Citizen.Wait(30000) + TriggerServerEvent("kc-unicorn:poledancestop") end) - -------- ---- Debug Citizen.CreateThread(function() - local Count = 0 - while true do - - Citizen.Wait(Config.MoreDebugRefreshTime*1000) - if Cache.inuniPoly and Config.MoreDebug then - print("In Unicorn PolyZone: " .. tostring(Cache.inuniPoly), "In Lapdance PolyZone: " .. tostring(Cache.inlapPoly), "In Lean PolyZone: " .. tostring(Cache.inleanPoly) .. "\n") - print("Server: ", "Seat1: " .. tostring(Seat1), "Seat2: " .. tostring(Seat2), "Seat3: " .. tostring(Seat3), "Seat4: " .. tostring(Seat4), "Seat5: " .. tostring(Seat5), "Seat6: " .. tostring(Seat6), "Seat7: " .. tostring(Seat7), PlayerSeated) - print("Client: ", "Seat1: " .. tostring(Seat1Taken), "Seat2: " .. tostring(Seat2Taken), "Seat3: " .. tostring(Seat3Taken), "Seat4: " .. tostring(Seat4Taken), "Seat5: " .. tostring(Seat5Taken), "Seat6: " .. tostring(Seat6Taken), "Seat7: " .. tostring(Seat7Taken), PlayerSeated) - elseif Config.MoreDebug then - if Count == 0 then - print("In Unicorn PolyZone: " .. tostring(Cache.inuniPoly)) - Count = Count + 1 - end - end - end - + local Count = 0 + while true do + Citizen.Wait(Config.MoreDebugRefreshTime * 1000) + if Cache.inuniPoly and Config.MoreDebug then + print("In Unicorn PolyZone: " .. tostring(Cache.inuniPoly), "In Lapdance PolyZone: " .. tostring(Cache.inlapPoly), "In Lean PolyZone: " .. tostring(Cache.inleanPoly) .. "\n") + print("Server: ", "Seat1: " .. tostring(Seat1), "Seat2: " .. tostring(Seat2), "Seat3: " .. tostring(Seat3), "Seat4: " .. tostring(Seat4), "Seat5: " .. tostring(Seat5), "Seat6: " .. tostring(Seat6), "Seat7: " .. tostring(Seat7), PlayerSeated) + print("Client: ", "Seat1: " .. tostring(Seat1Taken), "Seat2: " .. tostring(Seat2Taken), "Seat3: " .. tostring(Seat3Taken), "Seat4: " .. tostring(Seat4Taken), "Seat5: " .. tostring(Seat5Taken), "Seat6: " .. tostring(Seat6Taken), "Seat7: " .. tostring(Seat7Taken), PlayerSeated) + elseif Config.MoreDebug then + if Count == 0 then + print("In Unicorn PolyZone: " .. tostring(Cache.inuniPoly)) + Count = Count + 1 + end + end + end end) -------- -RegisterNetEvent('kc-unicorn:esxplayermoney') -AddEventHandler('kc-unicorn:esxplayermoney', function(money) - PlayerMoney = money +RegisterNetEvent("kc-unicorn:esxplayermoney") +AddEventHandler("kc-unicorn:esxplayermoney", function(money) + PlayerMoney = money end) diff --git a/server-data/resources/[esx_addons]/kc-unicorn/config.lua b/server-data/resources/[esx_addons]/kc-unicorn/config.lua index b629c751..ce837632 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/config.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/config.lua @@ -1,78 +1,76 @@ -Config = Config or {} +Config = Config or {} -- Framework -Config.Framework = 'Standalone' -- Choose which framework your server is using so kc-unicorn can work with it [ESX, QBCore, Standalone] +Config.Framework = "ESX" -- Choose which framework your server is using so kc-unicorn can work with it [ESX, QBCore, Standalone] -- Since there is too many esx version, only this one is supported (https://github.com/esx-framework/es_extended/tree/v1-final). Maybe I will test other version, but not a priority --- Lap dance -Config.LapDanceCost = 120 -- Cost of the lap dance -Config.ThrowCost = 40 -- Cost of the lap dance -Config.LegMoney = 10000 -- Little easter egg for your player, will add an accessory "Leg money" to the stripper if the player has more than 'Config.LegMoney' in cash. Set to a huge value if you don't want this -Config.Nudity = false -- Set to true if you want the stripper to be topless (Only for player above 'Config.NudityAge') -Config.NudityAge = 21 -- (QBCore only!!) Player age restriction. If underage and 'Config.Nudity' is set to true, the stripper won't be topless. Set to 0 if you don't want age restriction +-- Lap dance +Config.LapDanceCost = 120 -- Cost of the lap dance +Config.ThrowCost = 40 -- Cost of the lap dance +Config.LegMoney = 10000 -- Little easter egg for your player, will add an accessory "Leg money" to the stripper if the player has more than 'Config.LegMoney' in cash. Set to a huge value if you don't want this +Config.Nudity = true -- Set to true if you want the stripper to be topless (Only for player above 'Config.NudityAge') +Config.NudityAge = 21 -- (QBCore only!!) Player age restriction. If underage and 'Config.Nudity' is set to true, the stripper won't be topless. Set to 0 if you don't want age restriction -- Text/Blip/Marker -Config.Text = 'Better3D' -- 2D, 3D, Better3D, None (Set the one you like to suit your server, the performance difference is mostly non-existant) -Config.Blip = true -- Set to false if you don't want the blip on the map -Config.BlipName = "Strip-Club" -- Blip name +Config.Text = "Better3D" -- 2D, 3D, Better3D, None (Set the one you like to suit your server, the performance difference is mostly non-existant) +Config.Blip = true -- Set to false if you don't want the blip on the map +Config.BlipName = "Strip-Club" -- Blip name Config.BlipStripclub = { - Sprite = 121, -- Sprite list can be found here: https://docs.fivem.net/docs/game-references/blips/ - Colour = 50, -- Color list in the same URL as above - Display = 27, -- Explanation here: https://docs.fivem.net/natives/?_0x9029B2F3DA924928 - Scale = 0.7 -- Self explanatory, let you set the scale of the blip + Sprite = 121, -- Sprite list can be found here: https://docs.fivem.net/docs/game-references/blips/ + Colour = 50, -- Color list in the same URL as above + Display = 27, -- Explanation here: https://docs.fivem.net/natives/?_0x9029B2F3DA924928 + Scale = 0.7, -- Self explanatory, let you set the scale of the blip } -Config.BlipCoord = { x=128.87, y=-1298.93, z=4.0 } -- If you want to move the blip on the map, change this. -Config.LapMarker = true -- Set to true if you want the marker for the lapdance to be "drawn" +Config.BlipCoord = { x = 128.87, y = -1298.93, z = 4.0 } -- If you want to move the blip on the map, change this. +Config.LapMarker = true -- Set to true if you want the marker for the lapdance to be "drawn" -- Strippers -Config.SelectStrippers = true -- Set to true if you want to let your player choose which stripper they want for their lapdance +Config.SelectStrippers = true -- Set to true if you want to let your player choose which stripper they want for their lapdance Config.Strippers = { - [1] = { - Name = "Eisha", - Model = 1846523796, - Drawables = { Head = 0, Hair = 0, Torso = 0, Torso2 = 0, Shoes = 1, Underwear = 0 }, - Textures = { HairTex = 0, BraTex = 2, ShoesTex = 2, UnderwearTex = 0 } - }, - [2] = { - Name = "Jade", - Model = 1846523796, - Drawables = { Head = 0, Hair = 2, Torso = 0, Torso2 = 1, Shoes = 1, Underwear = 0 }, - Textures = { HairTex = 0, BraTex = 5, ShoesTex = 1, UnderwearTex = 0 } - } + [1] = { + Name = "Eisha", + Model = 1846523796, + Drawables = { Head = 0, Hair = 0, Torso = 0, Torso2 = 0, Shoes = 1, Underwear = 0 }, + Textures = { HairTex = 0, BraTex = 2, ShoesTex = 2, UnderwearTex = 0 }, + }, + [2] = { + Name = "Jade", + Model = 1846523796, + Drawables = { Head = 0, Hair = 2, Torso = 0, Torso2 = 1, Shoes = 1, Underwear = 0 }, + Textures = { HairTex = 0, BraTex = 5, ShoesTex = 1, UnderwearTex = 0 }, + }, } -- Locale -Config.Language = 'en' -- Currently Available: fr, en +Config.Language = "en" -- Currently Available: fr, en -- Locales can be easily created or modified in `kc-unicorn/locales` -- Misc -Config.Debug = false -- If you think something is not working, you can set 'Config.Debug' to true. It will then print a lot of debug information in your console -Config.DebugPolyzones = false -- Set to true if you want to display the Polyzones -Config.MoreDebug = false -- If set to true, this will print more debug about server and client lapdance seat status -Config.MoreDebugRefreshTime = 5 -- Refresh time of "Config.MoreDebug" in seconds -Config.UpdateChecker = true -- Set to false if you don't want to check for resource update on start -Config.ChangeLog = true -- Set to false if you don't want to display the changelog if new version is find - - +Config.Debug = false -- If you think something is not working, you can set 'Config.Debug' to true. It will then print a lot of debug information in your console +Config.DebugPolyzones = false -- Set to true if you want to display the Polyzones +Config.MoreDebug = false -- If set to true, this will print more debug about server and client lapdance seat status +Config.MoreDebugRefreshTime = 5 -- Refresh time of "Config.MoreDebug" in seconds +Config.UpdateChecker = false -- Set to false if you don't want to check for resource update on start +Config.ChangeLog = false -- Set to false if you don't want to display the changelog if new version is find ----- DO NOT TOUCH! /!\ LOCALE SYSTEM /!\ Language = {} -function Loc(text,replacement) +function Loc(text, replacement) Language = (load)("return Locale." .. Config.Language)() if (load)("return Locale." .. Config.Language)() == nil then - return 'Locale [' .. Config.Language .. '] (Does not exist/Is mispelled)' + return "Locale [" .. Config.Language .. "] (Does not exist/Is mispelled)" end - if (load)("return ".."Language."..text)() == nil then - return 'Error with [' .. Config.Language .. '.' .. text .. '] translation (Does not exist/Is mispelled)' + if (load)("return " .. "Language." .. text)() == nil then + return "Error with [" .. Config.Language .. "." .. text .. "] translation (Does not exist/Is mispelled)" end - if replacement then - text = (string.gsub((load)("return ".."Language."..text)(), "%%", replacement)) - else - text = (load)("return ".."Language."..text)() - end - return text + if replacement then + text = (string.gsub((load)("return " .. "Language." .. text)(), "%%", replacement)) + else + text = (load)("return " .. "Language." .. text)() + end + return text end ------------------------------------------ \ No newline at end of file +----------------------------------------- diff --git a/server-data/resources/[esx_addons]/kc-unicorn/fxmanifest.lua b/server-data/resources/[esx_addons]/kc-unicorn/fxmanifest.lua index 8bce901e..0a45977c 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/fxmanifest.lua @@ -1,26 +1,27 @@ -fx_version 'cerulean' -game 'gta5' +fx_version("cerulean") +game("gta5") -author 'Clementinise' -name '^6KC Unicorn Script' -description 'Bring life & interactions to the Unicorn Club' -github 'https://github.com/clementinise/kc-unicorn' -version '1.1' +author("Clementinise") +name("^6KC Unicorn Script") +description("Bring life & interactions to the Unicorn Club") +github("https://github.com/clementinise/kc-unicorn") +version("1.0.2") -shared_scripts { - 'locales/*.lua', - 'config.lua', -} +shared_scripts({ + "@es_extended/imports.lua", + "locales/*.lua", + "config.lua", +}) -client_scripts { - '@PolyZone/client.lua', - '@PolyZone/BoxZone.lua', - '@PolyZone/EntityZone.lua', - '@PolyZone/CircleZone.lua', - '@PolyZone/ComboZone.lua', - 'client/*.lua' -} +client_scripts({ + "@PolyZone/client.lua", + "@PolyZone/BoxZone.lua", + "@PolyZone/EntityZone.lua", + "@PolyZone/CircleZone.lua", + "@PolyZone/ComboZone.lua", + "client/*.lua", +}) -server_script 'server/*.lua' +server_script("server/*.lua") -fivem_checker 'yes' \ No newline at end of file +fivem_checker("yes") diff --git a/server-data/resources/[esx_addons]/kc-unicorn/locales/en.lua b/server-data/resources/[esx_addons]/kc-unicorn/locales/en.lua index 6683b167..6fcc4dcb 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/locales/en.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/locales/en.lua @@ -1,15 +1,15 @@ -Locale = Locale or {} +Locale = Locale or {} Locale.en = { -- 'fr' is the reference that will be used for 'Config.Language' - StandaloneLapText = "Ask for a lap dance", -- Set the text that will be displayed above marker if 'Config.Framework' is set to 'standalone' - LapText = "Buy a lap dance (~g~%$~w~)", -- Set the text that will be displayed above marker - BoughtLapdance = "You just bought a lap dance for %$", -- Notification text when a lap dance is bought - StripperActive = "The stripper is already busy!", -- Notification text if a stripper is already active when you try to buy a lap dance - NotEnoughMoney = "You do not have enough money. A lap dance costs %$", -- Notification text if player don't have enough cash - AllPlacesTaken = "All places are already taken", -- Notification text if all places are already taken - lapStopped = "Your lap dance has been interrupted", -- Notification text if lapdance is interrupted - Lean = "Lean", -- Text displayed when near poledance - StandaloneLeanNotice = "Press ~INPUT_CONTEXT~ to stop leaning\nPress ~INPUT_JUMP~ to throw money", -- Set the text that will be displayed once lean if 'Config.Framework' is set to 'standalone' - LeanNotice = "Press ~INPUT_CONTEXT~ to stop leaning\nPress ~INPUT_JUMP~ to throw money (~g~%$~w~)", -- Set the text that will be displayed once lean - NotEnoughCashLean = "Not enough cash to throw" -- Text if player doesn't have enough money to throw once lean -} \ No newline at end of file + StandaloneLapText = "Ask for a lap dance", -- Set the text that will be displayed above marker if 'Config.Framework' is set to 'standalone' + LapText = "Buy a lap dance (~g~%$~w~)", -- Set the text that will be displayed above marker + BoughtLapdance = "You just bought a lap dance for %$", -- Notification text when a lap dance is bought + StripperActive = "The stripper is already busy!", -- Notification text if a stripper is already active when you try to buy a lap dance + NotEnoughMoney = "You do not have enough money. A lap dance costs %$", -- Notification text if player don't have enough cash + AllPlacesTaken = "All places are already taken", -- Notification text if all places are already taken + lapStopped = "Your lap dance has been interrupted", -- Notification text if lapdance is interrupted + Lean = "Lean", -- Text displayed when near poledance + StandaloneLeanNotice = "Press ~INPUT_CONTEXT~ to stop leaning\nPress ~INPUT_JUMP~ to throw money", -- Set the text that will be displayed once lean if 'Config.Framework' is set to 'standalone' + LeanNotice = "Press ~INPUT_CONTEXT~ to stop leaning\nPress ~INPUT_JUMP~ to throw money (~g~%$~w~)", -- Set the text that will be displayed once lean + NotEnoughCashLean = "Not enough cash to throw", -- Text if player doesn't have enough money to throw once lean +} diff --git a/server-data/resources/[esx_addons]/kc-unicorn/locales/fr.lua b/server-data/resources/[esx_addons]/kc-unicorn/locales/fr.lua index b7c372bd..701e445d 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/locales/fr.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/locales/fr.lua @@ -1,15 +1,15 @@ -Locale = Locale or {} +Locale = Locale or {} Locale.fr = { -- 'fr' est la référence qui sera utilisé par 'Config.Language' - StandaloneLapText = "Demander un lap dance", -- Définit le texte qui sera affiché au-dessus du marqueur si 'Config.Framework' est mis sur 'standalone' - LapText = "Acheter un lap dance (~g~%$~w~)", -- Définit le texte qui sera affiché au-dessus du marqueur - BoughtLapdance = "Vous avez acheté un lap dance pour %$", -- Texte de la notification lorsqu'un lap dance est acheté - StripperActive = "La strip-teaseuse est déjà occupé !", -- Texte de la notification si une strip-teaseuse est déjà occupé lorsque vous essayez d'acheter un lap dance - NotEnoughMoney = "Vous n'avez pas assez d'argent. Un lap dance coûte %$", -- Texte de la notification si le joueur n'a pas assez d'argent - AllPlacesTaken = "Toutes les places sont déjà prises", -- Texte de la notification si toutes les places sont déjà prises - lapStopped = "Ta lap dance a été interrompu !", -- Texte si la lap dance est interrompu - Lean = "Se pencher", -- Texte pour se pencher au niveau de la bar de poledance - StandaloneLeanNotice = "Appuyez sur ~INPUT_CONTEXT~ pour arrêter de vous pencher\nAppuyez sur ~INPUT_JUMP~ pour jeter de l'argent", -- Définit le texte qui sera affiché une fois penché si 'Config.Framework' est mis sur 'standalone' - LeanNotice = "Appuyez sur ~INPUT_CONTEXT~ pour arrêter de vous pencher\nAppuyez sur ~INPUT_JUMP~ pour jeter de l'argent (~g~%$~w~)", -- Définit le texte qui sera affiché une fois penché - NotEnoughCashLean = "Vous n'avez pas assez d'argent" -- Texte si le joueur n'a pas assez d'argent pour jeter un billet une fois penché -} \ No newline at end of file + StandaloneLapText = "Demander un lap dance", -- Définit le texte qui sera affiché au-dessus du marqueur si 'Config.Framework' est mis sur 'standalone' + LapText = "Acheter un lap dance (~g~%$~w~)", -- Définit le texte qui sera affiché au-dessus du marqueur + BoughtLapdance = "Vous avez acheté un lap dance pour %$", -- Texte de la notification lorsqu'un lap dance est acheté + StripperActive = "La strip-teaseuse est déjà occupé !", -- Texte de la notification si une strip-teaseuse est déjà occupé lorsque vous essayez d'acheter un lap dance + NotEnoughMoney = "Vous n'avez pas assez d'argent. Un lap dance coûte %$", -- Texte de la notification si le joueur n'a pas assez d'argent + AllPlacesTaken = "Toutes les places sont déjà prises", -- Texte de la notification si toutes les places sont déjà prises + lapStopped = "Ta lap dance a été interrompu !", -- Texte si la lap dance est interrompu + Lean = "Se pencher", -- Texte pour se pencher au niveau de la bar de poledance + StandaloneLeanNotice = "Appuyez sur ~INPUT_CONTEXT~ pour arrêter de vous pencher\nAppuyez sur ~INPUT_JUMP~ pour jeter de l'argent", -- Définit le texte qui sera affiché une fois penché si 'Config.Framework' est mis sur 'standalone' + LeanNotice = "Appuyez sur ~INPUT_CONTEXT~ pour arrêter de vous pencher\nAppuyez sur ~INPUT_JUMP~ pour jeter de l'argent (~g~%$~w~)", -- Définit le texte qui sera affiché une fois penché + NotEnoughCashLean = "Vous n'avez pas assez d'argent", -- Texte si le joueur n'a pas assez d'argent pour jeter un billet une fois penché +} diff --git a/server-data/resources/[esx_addons]/kc-unicorn/server/main.lua b/server-data/resources/[esx_addons]/kc-unicorn/server/main.lua index a759633e..47886464 100644 --- a/server-data/resources/[esx_addons]/kc-unicorn/server/main.lua +++ b/server-data/resources/[esx_addons]/kc-unicorn/server/main.lua @@ -1,11 +1,7 @@ -local GithubL, Changelog, ESX, QBCore, inPoleDance - -local Version = GetResourceMetadata(GetCurrentResourceName(), 'version', 0) -- Do Not Change This Value -local Github = GetResourceMetadata(GetCurrentResourceName(), 'github', 0) -local Updater = false +local ESX, QBCore, inPoleDance local INPOLEDANCE = false local PedNumber = 2 -local PoledancePed1, PoledancePed2 +local PoledancePed1, PoledancePed2, LapDanceActive, Poledance -- Server Seat Locales local GetPlayerSeated = 0 @@ -19,102 +15,13 @@ local Seat7Taken = false -- Import if Config.Framework == "ESX" then - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + ESX = exports["es_extended"]:getSharedObject() elseif Config.Framework == "QBCore" then - QBCore = exports['qb-core']:GetCoreObject() -end - --------- Check if new update available -Citizen.CreateThread(function() - - local Resources = GetNumResources() - - for i = 0, Resources, 1 do - local resource = GetResourceByFindIndex(i) - UpdateResource(resource) - end - - Citizen.Wait(4000) - - if Updater == false then - if Config.UpdateChecker then - Updater = not Updater - UpdateChecker() - end - end - -end) - -function UpdateResource(resource) - if resource == 'fivem-checker' then - if GetResourceState(resource) == 'started' or GetResourceState(resource) == 'starting' then - if Config.UpdateChecker then - Updater = true - end - end - end -end - ----------------- - -function UpdateChecker() - - if string.find(Github, "github") then - if string.find(Github, "github.com") then - GithubL = Github - Github = string.gsub(Github, "github", "raw.githubusercontent")..'/master/version' - else - GithubL = string.gsub(Github, "raw.githubusercontent", "github"):gsub("/master", "") - Github = Github..'/version' - end - else - end - PerformHttpRequest(Github, function(Error, V, Header) - NewestVersion = V - end) - repeat - Citizen.Wait(10) - until NewestVersion ~= nil - local _, strings = string.gsub(NewestVersion, "\n", "\n") - Version1 = NewestVersion:match("[^\n]*"):gsub("[<>]", "") - if string.find(Version1, Version) then - else - if strings > 0 then - Changelog = NewestVersion:gsub(Version1,""):match("(.*" .. Version .. ")"):gsub(Version,"") - Changelog = string.gsub(Changelog, "\n", "") - Changelog = string.gsub(Changelog, "-", " \n-"):gsub("%b<>", ""):sub(1, -2) - NewestVersion = Version1 - end - end - - Citizen.Wait(500) - - print('') - if Config.Framework == 'QBCore' then - print('^8QBCore ^6KC Unicorn Script ('..GetCurrentResourceName()..')') - elseif Config.Framework == 'Standalone' then - print('^9Standalone ^6KC Unicorn Script ('..GetCurrentResourceName()..')') - elseif Config.Framework == 'ESX' then - print('^3ESX ^6KC Unicorn Script ('..GetCurrentResourceName()..')') - end - if Version == Version1 then - print('^2Version ' .. Version .. ' - Up to date!') - else - print('^1Version ' .. Version .. ' - Outdated!') - print('^1New version: v' .. Version1) - if Config.ChangeLog then - print('\n^3Changelog:') - print('^4'..Changelog..'\n') - end - print('^1Please check the GitHub and download the last update') - print('^2'..GithubL..'/releases/latest') - end - print('') + QBCore = exports["qb-core"]:GetCoreObject() end -- Poledance Girls (WIP) Citizen.CreateThread(function() - PoledancePed1 = CreatePed(4, 1381498905, 112.27, -1287.22, 28.46, 303.19, true, false) PoledancePed2 = CreatePed(4, 1846523796, 102.13, -1296.19, 28.77, 303.19, true, false) SharedPed1 = NetworkGetNetworkIdFromEntity(PoledancePed1) @@ -122,10 +29,9 @@ Citizen.CreateThread(function() inPoleDance = true - SetPedComponentVariation(PoledancePed2, 8, 0) - SetPedComponentVariation(PoledancePed1, 8, 0) + SetPedComponentVariation(PoledancePed2, 8, 0) + SetPedComponentVariation(PoledancePed1, 8, 0) - repeat inPoleDance = true @@ -134,34 +40,34 @@ Citizen.CreateThread(function() PoleDance(PoledancePed2) inPoleDance = true - + if PedNumber == 2 then PedNumber = 1 else PedNumber = 2 end - TaskGoToCoordAnyMeans(PoledancePed2, 102.13, -1296.19, 28.77, 1.0, 0, 0, 0, 0xbf800000) - TaskGoToCoordAnyMeans(PoledancePed1, 112.27, -1287.22, 28.46, 1.0, 0, 0, 0, 0xbf800000) + TaskGoToCoordAnyMeans(PoledancePed2, 102.13, -1296.19, 28.77, 1.0, 0, false, 0, 0xbf800000) + TaskGoToCoordAnyMeans(PoledancePed1, 112.27, -1287.22, 28.46, 1.0, 0, false, 0, 0xbf800000) PoleDance(PoledancePed1) - + if PedNumber == 2 then PedNumber = 1 else PedNumber = 2 end - - until (Poledance == false) + + until Poledance == false end) function PoleDance(Ped) while inPoleDance do PedCoo = GetEntityCoords(Ped) local poledist = #(PedCoo - vector3(112.27, -1287.22, 28.46)) - local dict = "mini@strip_club@pole_dance@pole_dance"..PedNumber + local dict = "mini@strip_club@pole_dance@pole_dance" .. PedNumber if poledist < 0.4 then INPOLEDANCE = true - TriggerClientEvent('kc-unicorn:poledancescene', -1, NetworkGetNetworkIdFromEntity(Ped), PedNumber) + TriggerClientEvent("kc-unicorn:poledancescene", -1, NetworkGetNetworkIdFromEntity(Ped), PedNumber) repeat Citizen.Wait(200) until INPOLEDANCE == false @@ -172,11 +78,9 @@ function PoleDance(Ped) end -- Buy function -RegisterServerEvent('kc-unicorn:buy') -AddEventHandler('kc-unicorn:buy', function(Stripper) - +RegisterServerEvent("kc-unicorn:buy") +AddEventHandler("kc-unicorn:buy", function(Stripper) if Config.Framework == "QBCore" then - local src = source local Player = QBCore.Functions.GetPlayer(src) Cost = Config.LapDanceCost @@ -185,103 +89,90 @@ AddEventHandler('kc-unicorn:buy', function(Stripper) TodayDate = os.date("%Y-%m-%d") if GetPlayerSeated >= 7 then - TriggerClientEvent('QBCore:Notify', src, Loc('AllPlacesTaken'), "error", 1700) + TriggerClientEvent("QBCore:Notify", src, Loc("AllPlacesTaken"), "error", 1700) else if PlayerMoney >= Cost then if not LapDanceActive then Player.Functions.RemoveMoney("cash", Cost) - TriggerClientEvent('QBCore:Notify', src, Loc('BoughtLapdance', Config.LapDanceCost), "success", 1700) - TriggerClientEvent('kc-unicorn:lapdance', src, PlayerMoney, PlayerBirthdate, TodayDate, Stripper) + TriggerClientEvent("QBCore:Notify", src, Loc("BoughtLapdance", Config.LapDanceCost), "success", 1700) + TriggerClientEvent("kc-unicorn:lapdance", src, PlayerMoney, PlayerBirthdate, TodayDate, Stripper) else - TriggerClientEvent('QBCore:Notify', src, Loc('StripperActive'), "error", 1700) + TriggerClientEvent("QBCore:Notify", src, Loc("StripperActive"), "error", 1700) end else - TriggerClientEvent('QBCore:Notify', src, Loc('NotEnoughMoney', Config.LapDanceCost), "error", 1700) + TriggerClientEvent("QBCore:Notify", src, Loc("NotEnoughMoney", Config.LapDanceCost), "error", 1700) end end - elseif Config.Framework == "ESX" then - local src = source local Player = ESX.GetPlayerFromId(src) Cost = Config.LapDanceCost PlayerMoney = Player.getMoney() if GetPlayerSeated >= 7 then - TriggerClientEvent('esx:showNotification', src, Loc('AllPlacesTaken')) + TriggerClientEvent("esx:showNotification", src, Loc("AllPlacesTaken")) else if PlayerMoney >= Cost then if not LapDanceActive then Player.removeMoney(Cost) - TriggerClientEvent('esx:showNotification', src, Loc('BoughtLapdance', Config.LapDanceCost)) - TriggerClientEvent('kc-unicorn:lapdance', src, PlayerMoney, PlayerBirthdate, TodayDate, Stripper) + TriggerClientEvent("esx:showNotification", src, Loc("BoughtLapdance", Config.LapDanceCost)) + TriggerClientEvent("kc-unicorn:lapdance", src, PlayerMoney, PlayerBirthdate, TodayDate, Stripper) else - TriggerClientEvent('esx:showNotification', src, Loc('StripperActive')) + TriggerClientEvent("esx:showNotification", src, Loc("StripperActive")) end else - TriggerClientEvent('esx:showNotification', src, Loc('NotEnoughMoney', Config.LapDanceCost)) + TriggerClientEvent("esx:showNotification", src, Loc("NotEnoughMoney", Config.LapDanceCost)) end end - - elseif Config.Framework == 'Standalone' then - + elseif Config.Framework == "Standalone" then local src = source - + if GetPlayerSeated >= 7 then - TriggerClientEvent('kc-unicorn:showNotify', src, Loc('AllPlacesTaken')) + TriggerClientEvent("kc-unicorn:showNotify", src, Loc("AllPlacesTaken")) else - TriggerClientEvent('kc-unicorn:lapdance', src, PlayerMoney, PlayerBirthdate, TodayDate, Stripper) + TriggerClientEvent("kc-unicorn:lapdance", src, PlayerMoney, PlayerBirthdate, TodayDate, Stripper) end end end) -- Lean Throw function -RegisterServerEvent('kc-unicorn:leanthrow') -AddEventHandler('kc-unicorn:leanthrow', function() - +RegisterServerEvent("kc-unicorn:leanthrow") +AddEventHandler("kc-unicorn:leanthrow", function() if Config.Framework == "QBCore" then - local src = source local Player = QBCore.Functions.GetPlayer(src) Cost = Config.ThrowCost PlayerMoney = Player.PlayerData.money["cash"] Player.Functions.RemoveMoney("cash", Cost) - elseif Config.Framework == "ESX" then - local src = source local Player = ESX.GetPlayerFromId(src) Cost = Config.ThrowCost PlayerMoney = Player.getMoney() Player.removeMoney(Cost) - end end) -- Lean ESX Get Money -RegisterServerEvent('kc-unicorn:esxmoney') -AddEventHandler('kc-unicorn:esxmoney', function() - +RegisterServerEvent("kc-unicorn:esxmoney") +AddEventHandler("kc-unicorn:esxmoney", function() local src = source local Player = ESX.GetPlayerFromId(src) Cost = Config.LapDanceCost PlayerMoney = Player.getMoney() - - TriggerClientEvent("kc-unicorn:esxplayermoney", src, PlayerMoney) + TriggerClientEvent("kc-unicorn:esxplayermoney", src, PlayerMoney) end) -RegisterServerEvent('kc-unicorn:SyncLapDanceSpawn') -AddEventHandler('kc-unicorn:SyncLapDanceSpawn', function() - +RegisterServerEvent("kc-unicorn:SyncLapDanceSpawn") +AddEventHandler("kc-unicorn:SyncLapDanceSpawn", function() TriggerClientEvent("kc-unicorn:LapDanceSpawn", 0) - end) -RegisterServerEvent('kc-unicorn:GetPlayerSeated') -AddEventHandler('kc-unicorn:GetPlayerSeated', function() +RegisterServerEvent("kc-unicorn:GetPlayerSeated") +AddEventHandler("kc-unicorn:GetPlayerSeated", function() local src = source if Seat1Taken then @@ -312,103 +203,97 @@ AddEventHandler('kc-unicorn:GetPlayerSeated', function() if Config.Debug then print("Server: ", "Seat1: ", Seat1Taken, "Seat2: ", Seat2Taken, "Seat3: ", Seat3Taken, "Seat4: ", Seat4Taken, "Seat5: ", Seat5Taken, "Seat6: ", Seat6Taken, "Seat7: ", Seat7Taken, " ", GetPlayerSeated) end - TriggerClientEvent("kc-unicorn:SetPlayerSeated", src, GetPlayerSeated, Seat1Taken, Seat2Taken, Seat3Taken, Seat4Taken, Seat5Taken, Seat6Taken, Seat7Taken) + TriggerClientEvent("kc-unicorn:SetPlayerSeated", src, GetPlayerSeated, Seat1Taken, Seat2Taken, Seat3Taken, Seat4Taken, Seat5Taken, Seat6Taken, Seat7Taken) GetPlayerSeated = 0 - end) -RegisterServerEvent('kc-unicorn:Seat1') -AddEventHandler('kc-unicorn:Seat1', function(seat) +RegisterServerEvent("kc-unicorn:Seat1") +AddEventHandler("kc-unicorn:Seat1", function(seat) Seat1Taken = true end) -RegisterServerEvent('kc-unicorn:Seat2') -AddEventHandler('kc-unicorn:Seat2', function(seat) +RegisterServerEvent("kc-unicorn:Seat2") +AddEventHandler("kc-unicorn:Seat2", function(seat) Seat2Taken = true end) -RegisterServerEvent('kc-unicorn:Seat3') -AddEventHandler('kc-unicorn:Seat3', function(seat) +RegisterServerEvent("kc-unicorn:Seat3") +AddEventHandler("kc-unicorn:Seat3", function(seat) Seat3Taken = true end) -RegisterServerEvent('kc-unicorn:Seat4') -AddEventHandler('kc-unicorn:Seat4', function(seat) +RegisterServerEvent("kc-unicorn:Seat4") +AddEventHandler("kc-unicorn:Seat4", function(seat) Seat4Taken = true end) -RegisterServerEvent('kc-unicorn:Seat5') -AddEventHandler('kc-unicorn:Seat5', function(seat) +RegisterServerEvent("kc-unicorn:Seat5") +AddEventHandler("kc-unicorn:Seat5", function(seat) Seat5Taken = true end) -RegisterServerEvent('kc-unicorn:Seat6') -AddEventHandler('kc-unicorn:Seat6', function(seat) +RegisterServerEvent("kc-unicorn:Seat6") +AddEventHandler("kc-unicorn:Seat6", function(seat) Seat6Taken = true end) -RegisterServerEvent('kc-unicorn:Seat7') -AddEventHandler('kc-unicorn:Seat7', function(seat) +RegisterServerEvent("kc-unicorn:Seat7") +AddEventHandler("kc-unicorn:Seat7", function(seat) Seat7Taken = true end) -RegisterServerEvent('kc-unicorn:RemoveSeat1') -AddEventHandler('kc-unicorn:RemoveSeat1', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat1") +AddEventHandler("kc-unicorn:RemoveSeat1", function(seat) Seat1Taken = false end) -RegisterServerEvent('kc-unicorn:RemoveSeat2') -AddEventHandler('kc-unicorn:RemoveSeat2', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat2") +AddEventHandler("kc-unicorn:RemoveSeat2", function(seat) Seat2Taken = false end) -RegisterServerEvent('kc-unicorn:RemoveSeat3') -AddEventHandler('kc-unicorn:RemoveSeat3', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat3") +AddEventHandler("kc-unicorn:RemoveSeat3", function(seat) Seat3Taken = false end) -RegisterServerEvent('kc-unicorn:RemoveSeat4') -AddEventHandler('kc-unicorn:RemoveSeat4', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat4") +AddEventHandler("kc-unicorn:RemoveSeat4", function(seat) Seat4Taken = false end) -RegisterServerEvent('kc-unicorn:RemoveSeat5') -AddEventHandler('kc-unicorn:RemoveSeat5', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat5") +AddEventHandler("kc-unicorn:RemoveSeat5", function(seat) Seat5Taken = false end) -RegisterServerEvent('kc-unicorn:RemoveSeat6') -AddEventHandler('kc-unicorn:RemoveSeat6', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat6") +AddEventHandler("kc-unicorn:RemoveSeat6", function(seat) Seat6Taken = false end) -RegisterServerEvent('kc-unicorn:RemoveSeat7') -AddEventHandler('kc-unicorn:RemoveSeat7', function(seat) +RegisterServerEvent("kc-unicorn:RemoveSeat7") +AddEventHandler("kc-unicorn:RemoveSeat7", function(seat) Seat7Taken = false end) -RegisterServerEvent('kc-unicorn:NoPlaceAvailable') -AddEventHandler('kc-unicorn:NoPlaceAvailable', function() - +RegisterServerEvent("kc-unicorn:NoPlaceAvailable") +AddEventHandler("kc-unicorn:NoPlaceAvailable", function() local src = source local Player = QBCore.Functions.GetPlayer(src) Cost = Config.LapDanceCost Player.Functions.AddMoney("cash", Cost) - TriggerClientEvent('QBCore:Notify', src, Loc('AllPlacesTaken'), "error", 1700) - - + TriggerClientEvent("QBCore:Notify", src, Loc("AllPlacesTaken"), "error", 1700) end) -AddEventHandler('onResourceStop', function() +AddEventHandler("onResourceStop", function() DeleteEntity(PoledancePed1) DeleteEntity(PoledancePed2) print("Ped succesfully deleted") - end) +end) -RegisterServerEvent('kc-unicorn:poledancestop') -AddEventHandler('kc-unicorn:poledancestop', function() - +RegisterServerEvent("kc-unicorn:poledancestop") +AddEventHandler("kc-unicorn:poledancestop", function() INPOLEDANCE = false - end)