Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated skillbar export with qb-minigames #246

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Real Estate for QB-Core Framework :house_with_garden:
- [qb-clothing](https://github.com/qbcore-framework/qb-clothing) - Outfits
- [qb-weathersync](https://github.com/qbcore-framework/qb-weathersync) - Desync weather inside house
- [qb-weed](https://github.com/qbcore-framework/qb-weed) - Weed plant
- [qb-skillbar](https://github.com/qbcore-framework/qb-skillbar) - Skills
- [qb-minigames](https://github.com/qbcore-framework/qb-minigames) - Skills

## Screenshots
![Buy House](https://imgur.com/4eQnRqA.png)
Expand Down
38 changes: 11 additions & 27 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ local POIOffsets = nil
local entering = false
local data = nil
local CurrentHouse = nil
local RamsDone = 0
local keyholderMenu = {}
local keyholderOptions = {}
local fetchingHouseKeys = false
Expand Down Expand Up @@ -1377,7 +1376,6 @@ end)
RegisterNetEvent('qb-houses:client:HomeInvasion', function()
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
local Skillbar = exports['qb-skillbar']:GetSkillbarObject()
if ClosestHouse ~= nil then
QBCore.Functions.TriggerCallback('police:server:IsPoliceForcePresent', function(IsPresent)
if IsPresent then
Expand All @@ -1388,33 +1386,19 @@ RegisterNetEvent('qb-houses:client:HomeInvasion', function()
if dist < 1 then
if Config.Houses[ClosestHouse].locked then
if not Config.Houses[ClosestHouse].IsRaming then
DoRamAnimation(true)
Skillbar.Start({
duration = math.random(5000, 10000),
pos = math.random(10, 30),
width = math.random(10, 20),
}, function()
if RamsDone + 1 >= Config.RamsNeeded then
TriggerServerEvent('qb-houses:server:lockHouse', false, ClosestHouse)
QBCore.Functions.Notify(Lang:t('success.home_invasion'), 'success')
TriggerServerEvent('qb-houses:server:SetHouseRammed', true, ClosestHouse)
TriggerServerEvent('qb-houses:server:SetRamState', false, ClosestHouse)
DoRamAnimation(false)
else
DoRamAnimation(true)
Skillbar.Repeat({
duration = math.random(500, 1000),
pos = math.random(10, 30),
width = math.random(5, 12),
})
RamsDone = RamsDone + 1
end
end, function()
RamsDone = 0

local success = exports['qb-minigames']:Skillbar('medium') -- calling like this will just change difficulty and still use 1234
if success then
DoRamAnimation(true)
TriggerServerEvent('qb-houses:server:lockHouse', false, ClosestHouse)
QBCore.Functions.Notify(Lang:t('success.home_invasion'), 'success')
TriggerServerEvent('qb-houses:server:SetHouseRammed', true, ClosestHouse)
TriggerServerEvent('qb-houses:server:SetRamState', false, ClosestHouse)
else
TriggerServerEvent('qb-houses:server:SetRamState', false, ClosestHouse)
QBCore.Functions.Notify(Lang:t('error.failed_invasion'), 'error')
DoRamAnimation(false)
end)
end
DoRamAnimation(false)
TriggerServerEvent('qb-houses:server:SetRamState', true, ClosestHouse)
else
QBCore.Functions.Notify(Lang:t('error.inprogress_invasion'), 'error')
Expand Down
Loading