Skip to content

Commit

Permalink
Added Canteen Tool Usage Updated de_lang (#47)
Browse files Browse the repository at this point in the history
* Added canteen Tool Usage

* Update functions.lua

- housekeeping

* Update helpers.lua

- housekeeping

* Update main.lua

- reset default settings

* Update main.lua

- set durability variable to string for display
- small tweak for durability display to match usage and removal of canteen

* Update main.lua

- removed print

* Update fxmanifest.lua

- change fx version to cerulean

* Update main.lua

- add percent sign to durability value display

---------

Co-authored-by: Apollyon <37031311+JusCampin@users.noreply.github.com>
  • Loading branch information
RetryR1v2 and JusCampin authored Sep 7, 2024
1 parent 64ee74a commit c84bf5e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 23 deletions.
10 changes: 5 additions & 5 deletions client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function DrinkCanteen(level)
SetEntityAlpha(Canteen, 255, false)
SetModelAsNoLongerNeeded(modelHash)
TaskPlayAnim(playerPed, dict, anim, 1.0, 1.0, 5000, 31, 0.0, false, false, false)
AttachEntityToEntity(Canteen, playerPed, boneIndex, 0.02, 0.028, 0.001, 15.0, 175.0, 0.0, true, true, false, true, 1, true)
Wait(6000)
AttachEntityToEntity(Canteen, playerPed, boneIndex, 0.02, 0.028, 0.001, 15.0, 175.0, 0.0, true, true, false, true, 1, true, false, false)
Wait(5500)
DeleteObject(Canteen)
ClearPedTasks(playerPed)
PlayerStats(false)
Expand All @@ -29,7 +29,7 @@ function DrinkCanteen(level)
[5] = _U('message_4')
}
if Config.showMessages then
VORPcore.NotifyRightTip(levelMessage[level], 5000)
VORPcore.NotifyRightTip(levelMessage[level], 4000)
end
end

Expand All @@ -53,7 +53,7 @@ function WashPlayer(animType)
ClearPedEnvDirt(playerPed)
ClearPedDamageDecalByZone(playerPed, 10, 'ALL')
ClearPedBloodDamage(playerPed)
SetPedDirtCleaned(playerPed, 0.0, -1, 1, 1)
SetPedDirtCleaned(playerPed, 0.0, -1, true, true)
end

RegisterNetEvent('bcc-water:UseCanteen', function()
Expand All @@ -64,7 +64,7 @@ RegisterNetEvent('bcc-water:UseCanteen', function()

DrinkCanteen(canDrink)
UseCanteen = false
Wait(8000)
Wait(6000)
UseCanteen = true
end
end)
Expand Down
4 changes: 2 additions & 2 deletions client/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function CanteenFill(pumpAnim)
ClearPedTasks(playerPed)
Filling = false
if Config.showMessages then
VORPcore.NotifyRightTip(_U('fullCanteen'), 5000)
VORPcore.NotifyRightTip(_U('fullCanteen'), 4000)
end
end

Expand Down Expand Up @@ -101,7 +101,7 @@ function BucketFill(pumpAnim)

Filling = false
if Config.showMessages then
VORPcore.NotifyRightTip(_U('fullBucket'), 5000)
VORPcore.NotifyRightTip(_U('fullBucket'), 4000)
end
end

Expand Down
6 changes: 5 additions & 1 deletion config/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ Config.wildStamina = 10 -- Default: 10 / Value is 0 - 100 / Set to 0 to Disable
Config.wildThirst = 25 -- Default: 25 / Value is 0 - 100
---------------------------------------------------------------

Config.CanteenUsage = 5 -- Default: 5 / Durability used per Drink
---------------------------------------------------------------

-- Translate Canteen Metadata
Config.lang = {
level = 'Level',
empty = 'Empty',
full = 'Full'
full = 'Full',
Durability = 'Durability',
}
---------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fx_version 'adamant'
fx_version 'cerulean'
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'

game 'rdr3'
Expand All @@ -23,4 +23,4 @@ server_scripts {
'server/versioncheck.lua'
}

version '1.2.0'
version '1.2.1'
8 changes: 4 additions & 4 deletions languages/de_lang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
Locales["de_lang"] = {

fillCanteen = "Feldflasche auffüllen",
fillBucket = "Fill Bucket",
fillBucket = "Eimer Füllen",
wash = "Waschen",
drink = "Trinken",
fullCanteen = "Deine Feldflasche ist voll.",
fullBucket = "Your bucket is full.",
fullBucket = "Dein Eimer ist Voll.",
message_4 = "Feldflasche ist zu ~o~75 ~q~Prozent voll.",
message_3 = "Feldflasche ist zu ~o~50 ~q~Prozent voll.",
message_2 = "Feldflasche ist zu ~o~25 ~q~Prozent voll.",
message_1 = "Deine Feldflasche ist leer!",
notEmpty = "Deine Feldflasche ist nicht leer.",
needCanteen = "Du brauchst eine Feldflasche!",
needBucket = "You need an empty bucket!",
waterPump = "Water Pump"
needBucket = "Du brauchst ein Leeren Eimer!",
waterPump = "Wasserpumpe"
}
28 changes: 20 additions & 8 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ VORPcore.Callback.Register('bcc-water:GetCanteenLevel', function(source, cb)
if next(meta) == nil then
exports.vorp_inventory:subItem(src, itemCanteen, 1, {})
exports.vorp_inventory:addItem(src, itemCanteen, 1, {
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. Config.lang.full .. '</span>', level = 5
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. Config.lang.full .. '</span>' .. ' ' .. Config.lang.Durability .. ' : ' .. '<span style=color:yellow;>' .. '100' .. '%' .. '</span>', level = 5, durability = 100
})
else
local level = meta.level
local durability = meta.durability
if level < 5 then
exports.vorp_inventory:subItem(src, itemCanteen, 1, meta)
exports.vorp_inventory:addItem(src, itemCanteen, 1, {
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. Config.lang.full .. '</span>', level = 5
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. Config.lang.full .. '</span>' .. ' ' .. Config.lang.Durability .. ' : ' .. '<span style=color:yellow;>' .. tostring(durability - Config.CanteenUsage) .. '%' .. '</span>', level = 5, durability = durability - Config.CanteenUsage
})
else
VORPcore.NotifyRightTip(src, _U('notEmpty'), 4000)
Expand All @@ -41,7 +42,17 @@ end)
exports.vorp_inventory:registerUsableItem(Config.canteen, function(data)
local src = data.source
exports.vorp_inventory:closeInventory(src)
TriggerClientEvent('bcc-water:UseCanteen', src)
local itemCanteen = Config.canteen
local canteen = exports.vorp_inventory:getItem(src, itemCanteen)
local meta = canteen['metadata']
local durability = meta.durability
local canteenUsage = Config.CanteenUsage
if (durability == nil) or (durability >= canteenUsage) then
TriggerClientEvent('bcc-water:UseCanteen', src)
elseif durability < canteenUsage then
exports.vorp_inventory:subItem(src, itemCanteen, 1, meta)
VORPcore.NotifyRightTip(src, _U('needCanteen'), 4000)
end
end)

VORPcore.Callback.Register('bcc-water:UpdateCanteen', function(source, cb)
Expand All @@ -50,6 +61,7 @@ VORPcore.Callback.Register('bcc-water:UpdateCanteen', function(source, cb)
local canteen = exports.vorp_inventory:getItem(src, itemCanteen)
local meta = canteen['metadata']
local level = meta.level
local durability = meta.durability
local canteenUpdate = {
[1] = function()
VORPcore.NotifyRightTip(src, _U('message_1'), 4000)
Expand All @@ -58,28 +70,28 @@ VORPcore.Callback.Register('bcc-water:UpdateCanteen', function(source, cb)
[2] = function()
exports.vorp_inventory:subItem(src, itemCanteen, 1, meta)
exports.vorp_inventory:addItem(src, itemCanteen, 1, {
description = Config.lang.level .. ' : ' .. '<span style=color:red;>' .. Config.lang.empty .. '</span>', level = 1
description = Config.lang.level .. ' : ' .. '<span style=color:red;>' .. Config.lang.empty .. '</span>' .. ' ' .. Config.lang.Durability .. ' : ' .. '<span style=color:yellow;>' .. tostring(durability - Config.CanteenUsage) .. '%' .. '</span>', level = 1, durability = durability
})
end,

[3] = function()
exports.vorp_inventory:subItem(src, itemCanteen, 1, meta)
exports.vorp_inventory:addItem(src, itemCanteen, 1, {
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. '25%' .. '</span>', level = 2
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. '25%' .. '</span>' .. ' ' .. Config.lang.Durability .. ' : ' .. '<span style=color:yellow;>' .. tostring(durability - Config.CanteenUsage) .. '%' .. '</span>', level = 2, durability = durability - Config.CanteenUsage
})
end,

[4] = function()
exports.vorp_inventory:subItem(src, itemCanteen, 1, meta)
exports.vorp_inventory:addItem(src, itemCanteen, 1, {
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. '50%' .. '</span>', level = 3
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. '50%' .. '</span>' .. ' ' .. Config.lang.Durability .. ' : ' .. '<span style=color:yellow;>' .. tostring(durability - Config.CanteenUsage) .. '%' .. '</span>', level = 3, durability = durability - Config.CanteenUsage
})
end,

[5] = function()
exports.vorp_inventory:subItem(src, itemCanteen, 1, meta)
exports.vorp_inventory:addItem(src, itemCanteen, 1, {
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. '75%' .. '</span>', level = 4
description = Config.lang.level .. ' : ' .. '<span style=color:green;>' .. '75%' .. '</span>' .. ' ' .. Config.lang.Durability .. ' : ' .. '<span style=color:yellow;>' .. tostring(durability - Config.CanteenUsage) .. '%' .. '</span>', level = 4, durability = durability - Config.CanteenUsage
})
end
}
Expand All @@ -101,7 +113,7 @@ VORPcore.Callback.Register('bcc-water:GetBucket', function(source, cb)
local hasItem = exports.vorp_inventory:getItem(src, Config.emptyBucket)

if not hasItem then
VORPcore.NotifyRightTip(src, _U('needBucket'))
VORPcore.NotifyRightTip(src, _U('needBucket'), 4000)
cb(false)
return
end
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<1.2.0>
<1.2.1>
See GitHub for updates!

0 comments on commit c84bf5e

Please sign in to comment.