This repository has been archived on 2025-12-11. You can view files and clone it, but cannot push or open issues or pull requests.

53 lines
1.4 KiB
Lua

---@class Playerstatus
Playerstatus = {
voicemode = 0,
Hunger = 0,
Thirst = 0,
Stress = 100,
}
local GetEntityHealth = GetEntityHealth
local GetPedArmour = GetPedArmour
local IsEntityInWater = IsEntityInWater
local GetPlayerSprintStaminaRemaining = GetPlayerSprintStaminaRemaining
local GetPlayerUnderwaterTimeRemaining = GetPlayerUnderwaterTimeRemaining
CreateThread(function()
while true do
local ped = cache.ped
local playerid = cache.playerId
local health = GetEntityHealth(ped)
local armour = GetPedArmour(ped)
local voice = NetworkIsPlayerTalking(playerid)
local oxygen
if not IsEntityInWater(ped) then
oxygen = 100 - GetPlayerSprintStaminaRemaining(playerid)
end
if IsEntityInWater(ped) then
oxygen = GetPlayerUnderwaterTimeRemaining(playerid) * 10
end
NuiMessage('playerstatus', {
show = GlobalSettings.showplayerstatus,
health = health - 100,
armour = armour,
oxygen = oxygen,
voice = voice,
voicemode = Playerstatus.voicemode,
hunger = Playerstatus.Hunger,
thirst = Playerstatus.Thirst,
})
Wait(1200)
end
end)
---@param mode integer
AddEventHandler('pma-voice:setTalkingMode', function(mode)
Playerstatus.voicemode = mode
end)