Skip to content

Commit

Permalink
Merge pull request #910 from bitpredator/dev
Browse files Browse the repository at this point in the history
refactor:  major rebuild for kc-unicorn
  • Loading branch information
bitpredator authored Dec 3, 2024
2 parents 1f73de0 + 688b1c5 commit 9fa3f5e
Show file tree
Hide file tree
Showing 7 changed files with 891 additions and 1,023 deletions.
118 changes: 54 additions & 64 deletions server-data/resources/[esx_addons]/kc-unicorn/client/loop.lua
Original file line number Diff line number Diff line change
@@ -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)
Citizen.Wait(1000)
end
end)
Loading

0 comments on commit 9fa3f5e

Please sign in to comment.