Skip to content

Commit 901fbc2

Browse files
committed
Washing Stone Fix
# 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
1 parent 37a9474 commit 901fbc2

4 files changed

Lines changed: 46 additions & 23 deletions

File tree

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,32 @@ If you use another Drawtext like cd_drawtextui for example change the following
4848

4949
**Before** DRAWTEXT
5050
```
51-
exports['qb-core']:DrawText(Config.Text['MiningAlert'], 'left')
51+
exports['qb-core']:DrawText(Config.Text['MiningAlert'], 'left')
5252
53-
exports['qb-core']:DrawText(Config.Text['StartMining'],'left')
53+
exports['qb-core']:DrawText(Config.Text['StartMining'],'left')
5454
```
5555

5656
**After**
5757
```
58-
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['MiningAlert'])
58+
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['MiningAlert'])
5959
60-
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['StartMining'])
60+
TriggerEvent('cd_drawtextui:ShowUI', 'show', Config.Text['StartMining'])
6161
```
6262

6363
**Before** HIDETEXT
6464
```
65-
exports['qb-core']:HideText()
65+
exports['qb-core']:HideText()
6666
```
6767

6868
**After**
6969
```
70-
TriggerEvent('cd_drawtextui:HideUI')
70+
TriggerEvent('cd_drawtextui:HideUI')
71+
```
72+
73+
**You will also need to remove this line if you are using CD_Drawtextui**
74+
**Line 160**
75+
```
76+
exports['qb-core']:KeyPressed()
7177
```
7278

7379
## **Drawtext Ui Files will be provided if you don't have it installed in your core**

client/main.lua

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,22 +177,28 @@ end
177177
RegisterNetEvent('tr-mining:washingrocks', function()
178178
QBCore.Functions.TriggerCallback('tr-mining:washpan', function(washingpancheck)
179179
if washingpancheck then
180-
local playerPed = PlayerPedId()
181-
local coords = GetEntityCoords(playerPed)
182-
local rockwash = MiningJob.WashingTimer
183-
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_BUM_WASH', 0, false)
184-
QBCore.Functions.Progressbar('Washing Stones', Config.Text['Washing_Rocks'], rockwash, false, true, { -- Name | Label | Time | useWhileDead | canCancel
185-
disableMovement = true,
186-
disableCarMovement = true,
187-
disableMouse = false,
188-
disableCombat = true,
189-
}, {
190-
}, {}, {}, function()
191-
ClearPedTasks(PlayerPedId())
192-
TriggerServerEvent("tr-mining:receivedReward")
193-
end, function()
194-
QBCore.Functions.Notify(Config.Text['cancel'], "error")
195-
end)
180+
QBCore.Functions.TriggerCallback('tr-mining:stonesbruf', function(stonesbruf)
181+
if stonesbruf then
182+
local playerPed = PlayerPedId()
183+
local coords = GetEntityCoords(playerPed)
184+
local rockwash = MiningJob.WashingTimer
185+
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_BUM_WASH', 0, false)
186+
QBCore.Functions.Progressbar('Washing Stones', Config.Text['Washing_Rocks'], rockwash, false, true, { -- Name | Label | Time | useWhileDead | canCancel
187+
disableMovement = true,
188+
disableCarMovement = true,
189+
disableMouse = false,
190+
disableCombat = true,
191+
}, {
192+
}, {}, {}, function()
193+
ClearPedTasks(PlayerPedId())
194+
TriggerServerEvent("tr-mining:receivedReward")
195+
end, function()
196+
QBCore.Functions.Notify(Config.Text['cancel'], "error")
197+
end)
198+
elseif not stonesbruf then
199+
QBCore.Functions.Notify(Config.Text['error_minerstone'], "error")
200+
end
201+
end)
196202
elseif not washingpancheck then
197203
Wait(500)
198204
QBCore.Functions.Notify(Config.Text['error_washpan'], "error", 3000)

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ game 'gta5'
33

44
author 'TRClassic#0001'
55
description 'Mining script for QBCore'
6-
version '1.0.0'
6+
version '1.0.1'
77

88
client_script {
99
'@PolyZone/client.lua',

server/main.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ RegisterNetEvent('tr-mining:setMiningStage', function(stage, state, k)
116116
TriggerClientEvent('tr-mining:getMiningstage', -1, stage, state, k)
117117
end)
118118

119+
QBCore.Functions.CreateCallback('tr-mining:stonesbruf', function(source, cb)
120+
local Player = QBCore.Functions.GetPlayer(source)
121+
if Player ~= nil then
122+
if Player.Functions.GetItemByName("mining_stone") ~= nil then
123+
cb(true)
124+
else
125+
cb(false)
126+
end
127+
end
128+
end)
129+
119130

120131
RegisterNetEvent('tr-mining:setMiningTimer', function()
121132
if not mining then

0 commit comments

Comments
 (0)