Skip to content

Commit

Permalink
Merge pull request #246 from singh-manavv/main
Browse files Browse the repository at this point in the history
Updated skillbar export with qb-minigames
  • Loading branch information
GhzGarage authored Feb 16, 2024
2 parents 777f954 + 72502e7 commit 2a2ed24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
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

0 comments on commit 2a2ed24

Please sign in to comment.