Skip to content

Commit

Permalink
Washing Stone Fix
Browse files Browse the repository at this point in the history
# 1.0.1 Update

*Forgot to readd the item check for washing the stones before I published it that's my fault*

Updated the readme for CD_Drawtext users
  • Loading branch information
trclassic92 committed Apr 7, 2022
1 parent 37a9474 commit 901fbc2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 23 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,32 @@ If you use another Drawtext like cd_drawtextui for example change the following

**Before** DRAWTEXT
```
exports['qb-core']:DrawText(Config.Text['MiningAlert'], 'left')
exports['qb-core']:DrawText(Config.Text['MiningAlert'], 'left')
exports['qb-core']:DrawText(Config.Text['StartMining'],'left')
exports['qb-core']:DrawText(Config.Text['StartMining'],'left')
```

**After**
```
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['MiningAlert'])
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['MiningAlert'])
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['StartMining'])
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['StartMining'])
```

**Before** HIDETEXT
```
exports['qb-core']:HideText()
exports['qb-core']:HideText()
```

**After**
```
TriggerEvent('cd_drawtextui:HideUI')
TriggerEvent('cd_drawtextui:HideUI')
```

**You will also need to remove this line if you are using CD_Drawtextui**
**Line 160**
```
exports['qb-core']:KeyPressed()
```

## **Drawtext Ui Files will be provided if you don't have it installed in your core**
Expand Down
38 changes: 22 additions & 16 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,28 @@ end
RegisterNetEvent('tr-mining:washingrocks', function()
QBCore.Functions.TriggerCallback('tr-mining:washpan', function(washingpancheck)
if washingpancheck then
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local rockwash = MiningJob.WashingTimer
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_BUM_WASH', 0, false)
QBCore.Functions.Progressbar('Washing Stones', Config.Text['Washing_Rocks'], rockwash, false, true, { -- Name | Label | Time | useWhileDead | canCancel
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
}, {}, {}, function()
ClearPedTasks(PlayerPedId())
TriggerServerEvent("tr-mining:receivedReward")
end, function()
QBCore.Functions.Notify(Config.Text['cancel'], "error")
end)
QBCore.Functions.TriggerCallback('tr-mining:stonesbruf', function(stonesbruf)
if stonesbruf then
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local rockwash = MiningJob.WashingTimer
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_BUM_WASH', 0, false)
QBCore.Functions.Progressbar('Washing Stones', Config.Text['Washing_Rocks'], rockwash, false, true, { -- Name | Label | Time | useWhileDead | canCancel
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
}, {}, {}, function()
ClearPedTasks(PlayerPedId())
TriggerServerEvent("tr-mining:receivedReward")
end, function()
QBCore.Functions.Notify(Config.Text['cancel'], "error")
end)
elseif not stonesbruf then
QBCore.Functions.Notify(Config.Text['error_minerstone'], "error")
end
end)
elseif not washingpancheck then
Wait(500)
QBCore.Functions.Notify(Config.Text['error_washpan'], "error", 3000)
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ game 'gta5'

author 'TRClassic#0001'
description 'Mining script for QBCore'
version '1.0.0'
version '1.0.1'

client_script {
'@PolyZone/client.lua',
Expand Down
11 changes: 11 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ RegisterNetEvent('tr-mining:setMiningStage', function(stage, state, k)
TriggerClientEvent('tr-mining:getMiningstage', -1, stage, state, k)
end)

QBCore.Functions.CreateCallback('tr-mining:stonesbruf', function(source, cb)
local Player = QBCore.Functions.GetPlayer(source)
if Player ~= nil then
if Player.Functions.GetItemByName("mining_stone") ~= nil then
cb(true)
else
cb(false)
end
end
end)


RegisterNetEvent('tr-mining:setMiningTimer', function()
if not mining then
Expand Down

0 comments on commit 901fbc2

Please sign in to comment.