Added AFK functionality to head tags.

+ Updated Head-Tags.
This commit is contained in:
Jacob
2022-04-23 20:17:24 +01:00
parent 8e00e0890f
commit f4da768bc6
3 changed files with 36 additions and 1 deletions
+21 -1
View File
@@ -4,6 +4,7 @@ local showTags = true
local seeTags = false
local isDriver = false
local staffTable = { 0 }
local afkTable = { 0 }
RegisterNetEvent('staffTag')
AddEventHandler('staffTag', function(playerID)
@@ -21,6 +22,22 @@ AddEventHandler('sendStaff', function(_staffTable)
staffTable = _staffTable
end)
RegisterNetEvent('afkTag')
AddEventHandler('afkTag', function(playerID)
if afkTag then
afkTag = false
TriggerEvent('chat:addMessage', {color = { 255, 0, 0},multiline = false,args = {"[SYSTEM]", "Afk tag ^*^1Disabled^0"}})
else
afkTag = true
TriggerEvent('chat:addMessage', {color = { 255, 0, 0},multiline = false,args = {"[SYSTEM]", "Afk tag ^*^2Enabled^0"}})
end
end)
RegisterNetEvent('sendAfk')
AddEventHandler('sendAfk', function(_afkTable)
afkTable = _afkTable
end)
RegisterNetEvent('showTags')
AddEventHandler('showTags', function()
@@ -63,6 +80,9 @@ function ManageHeadLabels()
if has_value(staffTable,GetPlayerServerId(i)) then
SetMpGamerTagName(headDisplayId,DisplayStaffTag.." "..GetPlayerServerId(i).." | "..GetPlayerName(i))
SetMpGamerTagColour(headDisplayId, 0, 6)
elseif has_value(afkTable,GetPlayerServerId(i)) then
SetMpGamerTagName(headDisplayId,DisplayAfkTag.." "..GetPlayerServerId(i).." | "..GetPlayerName(i))
SetMpGamerTagColour(headDisplayId, 0, 6)
else
SetMpGamerTagColour(headDisplayId, 0, 0)
SetMpGamerTagName(headDisplayId,GetPlayerServerId(i).." | "..GetPlayerName(i))
@@ -103,4 +123,4 @@ Citizen.CreateThread(function()
ManageHeadLabels()
Citizen.Wait(0)
end
end)
end)
+1
View File
@@ -1,4 +1,5 @@
Config = {}
DisplayStaffTag = "Staff |"
DisplayAfkTag = "Afk | "
disPlayerNames = 10
+14
View File
@@ -1,8 +1,22 @@
local staffTag = false
local staffTable = { 0 }
local afkTag = false
local afkTable = { 0 }
--print(table.unpack(staffTable))
RegisterCommand("afktag", function(source, args, rawCommand)
-- Add player to Staff table
TriggerClientEvent("afkTag", source, source)
if has_value(afkTable, source) then
removebyKey(afkTable, source)
else
table.insert(afkTable, source)
end
--print(table.unpack(staffTable))
TriggerClientEvent("sendAfk", -1, afkTable)
end)
RegisterCommand("stafftag", function(source, args, rawCommand)
if IsPlayerAceAllowed(source, "jd.staff") then
-- Add player to Staff table