├── fxmanifest.lua ├── LICENSE ├── config.lua ├── README.md ├── client.lua └── server.lua /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | 4 | author 'JaredScar' 5 | description 'Badger\'s DiscordTagIDs' 6 | 7 | client_scripts { 8 | 'config.lua', 9 | 'client.lua' 10 | } 11 | server_scripts { 12 | "config.lua", 13 | "server.lua" 14 | } 15 | 16 | server_exports { 17 | "HideUserTag", 18 | "ShowUserTag", 19 | "GetActiveUserTag", 20 | "GetUserTags", 21 | "SetUserTag", 22 | } 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jared 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | Config = { 2 | Prefix = '^9[^1Badger-Tags^9] ^3', 3 | TagsForStaffOnly = false, -- "DiscordTagIDs.Use.Tag-Toggle" 4 | ShowOwnTag = true, -- Should the tag also be shown for own user? 5 | UseDiscordName = true, 6 | ShowDiscordDescrim = false, -- Should it show Badger#0002 ? 7 | RequiresLineOfSight = true, -- Requires the player be in their line of sight for tags to be shown 8 | FormatDisplayName = "{PLAYER_NAME} [{SERVER_ID}]", 9 | UseKeyBind = true, -- It will only show on keybind pressed or toggled 10 | UseKeyBindToggle = true, -- It will only show when the keybind is toggled, turning this to false will make the tags only shown when the keybind is held down 11 | KeyBindToggleDefaultShow = true, -- By default, the tags will be shown unless toggled off if this is true 12 | KeyBind = 10, -- Pageup -- USE https://docs.fivem.net/docs/game-references/controls/ for keycodes 13 | roleList = { 14 | {0, "~g~Member ~w~"}, 15 | {597449475547463681, "~b~Developer ~w~"}, 16 | {597450498060058624, "~r~STAFF ~w~"}, 17 | {"Founder", "~RGB~FOUNDER ~w~"}, 18 | }, 19 | HUD = { 20 | Display = true, 21 | Format = '~p~Active Headtag: {HEADTAG}', 22 | x = .75, 23 | y = .50, 24 | Scale = .55 25 | }, 26 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DiscordTagIDs 2 | ## Continued Documentation 3 | https://docs.badger.store/fivem-discord-scripts/discordtagids 4 | 5 | ## Jared's Developer Community [Discord] 6 | [![Developer Discord](https://discordapp.com/api/guilds/597445834153525298/widget.png?style=banner4)](https://discord.com/invite/WjB5VFz) 7 | 8 | ## Discontinued Documentation 9 | ### Version 1.0 10 | 11 | Yes yes I know... I only make discord-based scripts. Well, you're damn welcome! 12 | 13 | This is a script that added prefixes to ID tags above players :) by using fully discord roles thanks to IllusiveTea! 14 | 15 | I also wanna give thanks to MrDaGree for originally creating the script this was adapted onto! You can find that here, https://forum.fivem.net/t/release-changed-player-name-tags-distance-names/19204 16 | 17 | You must have this installed and properly working for this script to work --> https://forum.fivem.net/t/discord-roles-for-permissions-im-creative-i-know/233805 18 | 19 | #### Commands: 20 | /tag-toggle - Turns off the prefix from being shown for the player (if they have a prefix in their tag) 21 | 22 | /tags-toggle - Turns off all tags from being shown above other players for ONLY yourself (good for streamers and/or pictures) 23 | 24 | On /tag-toggle not being active: 25 | ![](https://i.gyazo.com/07766951b02108c7ea49f8cbe2f372cd.png) 26 | 27 | On /tag-toggle being active: 28 | ![](https://i.gyazo.com/b0249df9842dd7011c231d4deaf54fc7.png) 29 | 30 | On /tags-toggle for tags not being active: 31 | ![](https://i.gyazo.com/6ba28b6e653f3c7bf82e90c3690a2dc5.png) 32 | 33 | On /tags-toggle for tags being active: 34 | ![](https://i.gyazo.com/e3e9656dc5cc0faf42fb3c857106ee72.png) 35 | 36 | How does the tags look on players? Let's have a look :) 37 | 38 | ![](https://i.gyazo.com/253bc5c2bb10731cb870f1eb6f8893b4.jpg) 39 | ![](https://cdn.discordapp.com/attachments/577615878607077380/588710494483775508/unknown.png) 40 | 41 | #### Installation 42 | 1. Download DiscordTagIDs 43 | 2. Extract the .zip and place the folder in your /resources/ of your Fivem server 44 | 3. Start the resource in your server.cfg file 45 | 4. Enjoy :) 46 | 47 | #### My other work within Fivem 48 | [DiscordChatRoles](https://forum.fivem.net/t/discordchatroles-release/566338) 49 | 50 | [DiscordAcePerms](https://forum.fivem.net/t/discordaceperms-release/573044) 51 | 52 | [SandyVehiclesRestrict](https://github.com/TheWolfBadger/SandyVehiclesRestrict) 53 | 54 | 55 | #### How to set up it up 56 | The 1s in this part of the server.lua file must be replaced with the IDs of your discord roles that are equal to the prefix you have associated with it: 57 | ```lua 58 | roleList = { 59 | {0, "~w~"}, -- Regular Civilian / Non-Staff 60 | {1, "~r~STAFF ~w~"}, --[[ T-Mod ]]-- 61 | {1, "~r~STAFF ~w~"}, --[[ Moderator ]]-- 62 | {1, "~r~STAFF ~w~"}, --[[ Admin ]]-- 63 | {1, "~p~MANAGEMENT ~w~"}, --[[ Management ]]-- 64 | {1, "~o~OWNER ~w~"}, --[[ Owner ]]-- 65 | } 66 | -------------------------------------------------------------------------------- /client.lua: -------------------------------------------------------------------------------- 1 | local playerDiscordNames = nil; 2 | local formatDisplayedName = "[{SERVER_ID}]"; 3 | local ignorePlayerNameDistance = false 4 | local playerNamesDist = 15 5 | local displayIDHeight = 1.5 --Height of ID above players head(starts at center body mass) 6 | --Set Default Values for Colors 7 | local red = 255 8 | local green = 255 9 | local blue = 255 10 | 11 | function DrawText3D(x,y,z, text) 12 | local onScreen,_x,_y=World3dToScreen2d(x,y,z) 13 | local px,py,pz=table.unpack(GetGameplayCamCoords()) 14 | local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1) 15 | 16 | local scale = (1/dist)*2 17 | local fov = (1/GetGameplayCamFov())*100 18 | local scale = scale*fov 19 | 20 | if onScreen then 21 | SetTextScale(0.0*scale, 0.55*scale) 22 | SetTextFont(0) 23 | SetTextProportional(1) 24 | SetTextColour(red, green, blue, 255) 25 | SetTextDropshadow(0, 0, 0, 0, 255) 26 | SetTextEdge(2, 0, 0, 0, 150) 27 | SetTextDropShadow() 28 | SetTextOutline() 29 | SetTextEntry("STRING") 30 | SetTextCentre(1) 31 | AddTextComponentString(text) 32 | World3dToScreen2d(x,y,z, 0) --Added Here 33 | DrawText(_x,_y) 34 | end 35 | end 36 | 37 | function Draw2DText(x, y, text, scale, center) 38 | -- Draw text on screen 39 | SetTextFont(4) 40 | SetTextProportional(7) 41 | SetTextScale(scale, scale) 42 | SetTextColour(255, 255, 255, 255) 43 | SetTextDropShadow(0, 0, 0, 0,255) 44 | SetTextDropShadow() 45 | SetTextEdge(4, 0, 0, 0, 255) 46 | SetTextOutline() 47 | if center then 48 | SetTextJustification(0) 49 | end 50 | SetTextEntry("STRING") 51 | AddTextComponentString(text) 52 | DrawText(x, y) 53 | end 54 | 55 | prefixes = {} 56 | hidePrefix = {} 57 | hideTags = {} 58 | hideAll = false 59 | if Config.TagsForStaffOnly then 60 | hideAll = true; 61 | end 62 | prefixStr = "" 63 | 64 | RegisterNetEvent("ID:HideTag") 65 | AddEventHandler("ID:HideTag", function(arr, error) 66 | hideTags = arr; 67 | end) 68 | 69 | RegisterNetEvent("ID:Tags-Toggle") 70 | AddEventHandler("ID:Tags-Toggle", function(val, error) 71 | if val then 72 | hideAll = true 73 | else 74 | hideAll = false 75 | end 76 | end) 77 | 78 | RegisterNetEvent("ID:Tag-Toggle") 79 | AddEventHandler("ID:Tag-Toggle", function(arr, error) 80 | hidePrefix = arr 81 | end) 82 | 83 | RegisterNetEvent("DiscordTag:Server:GetDiscordName:Return") 84 | AddEventHandler("DiscordTag:Server:GetDiscordName:Return", function(serverId, discordUsername, format, useDiscordName) 85 | if (useDiscordName) then 86 | if playerDiscordNames == nil then 87 | playerDiscordNames = {}; 88 | end 89 | playerDiscordNames[serverId] = discordUsername; 90 | end 91 | formatDisplayedName = format; 92 | end) 93 | 94 | RegisterNetEvent("GetStaffID:StaffStr:Return") 95 | AddEventHandler("GetStaffID:StaffStr:Return", function(arr, activeTagTrack, error) 96 | prefixes = arr 97 | activeTagTracker = activeTagTrack 98 | end) 99 | activeTagTracker = {} 100 | 101 | local function has_value (tab, val) 102 | for index, value in ipairs(tab) do 103 | if value == val then 104 | return true 105 | end 106 | end 107 | 108 | return false 109 | end 110 | 111 | Citizen.CreateThread(function() 112 | -- The player has spawned, we gotta get their tag 113 | Wait(1000); 114 | TriggerServerEvent('DiscordTag:Server:GetTag'); 115 | TriggerServerEvent('DiscordTag:Server:GetDiscordName'); 116 | end) 117 | 118 | colorIndex = 1; 119 | colors = {"~g~", "~b~", "~y~", "~o~", "~r~", "~p~", "~w~"} 120 | timer = 500; 121 | function triggerTagUpdate() 122 | if not (hideAll) then 123 | for _, id in ipairs(GetActivePlayers()) do 124 | local activeTag = activeTagTracker[GetPlayerServerId(id)] 125 | timer = timer - 10; 126 | if activeTag == nil then 127 | activeTag = '' 128 | end 129 | if ((NetworkIsPlayerActive( id )) and (GetPlayerPed( id ) ~= GetPlayerPed( -1 ) or Config.ShowOwnTag) ) then 130 | ped = GetPlayerPed( id ) 131 | blip = GetBlipFromEntity( ped ) 132 | 133 | x1, y1, z1 = table.unpack( GetEntityCoords( GetPlayerPed( -1 ), true ) ) 134 | x2, y2, z2 = table.unpack( GetEntityCoords( GetPlayerPed( id ), true ) ) 135 | distance = math.floor(GetDistanceBetweenCoords(x1, y1, z1, x2, y2, z2, true)) 136 | local displayName = formatDisplayedName; 137 | local name = nil; 138 | if playerDiscordNames ~= nil then 139 | name = playerDiscordNames[GetPlayerServerId(id)]; 140 | end 141 | if (name == nil) then 142 | displayName = displayName:gsub("{PLAYER_NAME}", GetPlayerName(id)):gsub("{SERVER_ID}", GetPlayerServerId(id)); 143 | else 144 | displayName = displayName:gsub("{PLAYER_NAME}", name):gsub("{SERVER_ID}", GetPlayerServerId(id)); 145 | end 146 | local playName = GetPlayerName(GetPlayerFromServerId(GetPlayerServerId(id))) 147 | if ((distance < playerNamesDist)) then 148 | if not (ignorePlayerNameDistance) then 149 | if (Config.RequiresLineOfSight) then 150 | if (not HasEntityClearLosToEntity(PlayerPedId(), GetPlayerPed(id), 17) and (GetPlayerPed( id ) ~= GetPlayerPed( -1 )) ) then 151 | return; -- They cannot see this play 152 | end 153 | end 154 | if NetworkIsPlayerTalking(id) then 155 | red = 0 156 | green = 0 157 | blue = 255 158 | 159 | if not has_value(hideTags, playName) then 160 | if not (has_value(hidePrefix, playName)) then 161 | -- Show their ID tag with prefix then 162 | if activeTag:find("~RGB~") then 163 | tag = activeTag; 164 | tag = tag:gsub("~RGB~", colors[colorIndex]); 165 | if timer <= 0 then 166 | colorIndex = colorIndex + 1; 167 | --print("Changed color to rainbow color: " .. colors[colorIndex]); 168 | if colorIndex >= #colors then 169 | colorIndex = 1; 170 | end 171 | timer = 3000; 172 | end 173 | DrawText3D(x2, y2, z2 + displayIDHeight, tag .. "~b~" .. displayName) 174 | else 175 | DrawText3D(x2, y2, z2 + displayIDHeight, activeTag .. "~b~" .. displayName) 176 | end 177 | else 178 | -- Don't show their ID tag with prefix then 179 | DrawText3D(x2, y2, z2 + displayIDHeight, "~b~" .. displayName) 180 | end 181 | end 182 | prefixStr = "" 183 | else 184 | red = 255 185 | green = 255 186 | blue = 255 187 | if not has_value(hideTags, playName) then 188 | if not (has_value(hidePrefix, playName)) then 189 | -- Show their ID tag with prefix then 190 | if activeTag:find("~RGB~") then 191 | tag = activeTag; 192 | tag = tag:gsub("~RGB~", colors[colorIndex]); 193 | if timer <= 0 then 194 | colorIndex = colorIndex + 1; 195 | --print("Changed color to rainbow color: " .. colors[colorIndex]); 196 | if colorIndex >= #colors then 197 | colorIndex = 1; 198 | end 199 | timer = 3000; 200 | end 201 | DrawText3D(x2, y2, z2 + displayIDHeight, tag .. "~w~" .. displayName) 202 | else 203 | DrawText3D(x2, y2, z2 + displayIDHeight, activeTag .. "~w~" .. displayName) 204 | end 205 | else 206 | -- Don't show their ID tag with prefix then 207 | DrawText3D(x2, y2, z2 + displayIDHeight, "~w~" .. displayName) 208 | end 209 | end 210 | end 211 | end 212 | end 213 | end 214 | end 215 | end 216 | end 217 | 218 | if (Config.HUD.Display) then 219 | Citizen.CreateThread(function() 220 | while true do 221 | Citizen.Wait(0); 222 | local headtag = activeTagTracker[GetPlayerServerId(PlayerId())]; 223 | if (headtag == nil) then 224 | headtag = Config.roleList[1][2]; 225 | end 226 | if (headtag == nil) then 227 | headtag = 'N/A' 228 | end 229 | Draw2DText(Config.HUD.x, Config.HUD.y, Config.HUD.Format:gsub("{HEADTAG}", headtag), Config.HUD.Scale, true); 230 | end 231 | end) 232 | end 233 | 234 | showTags = Config.KeyBindToggleDefaultShow; 235 | 236 | Citizen.CreateThread(function() 237 | while true do 238 | for i=0,99 do 239 | N_0x31698aa80e0223f8(i) 240 | end 241 | if (Config.UseKeyBind) then 242 | if (not Config.UseKeyBindToggle) then 243 | if (IsControlPressed(0, Config.KeyBind)) then 244 | triggerTagUpdate(); 245 | end 246 | else 247 | if (IsControlJustReleased(0, Config.KeyBind)) then 248 | showTags = not showTags; 249 | end 250 | if (showTags) then 251 | triggerTagUpdate(); 252 | end 253 | end 254 | else 255 | triggerTagUpdate(); 256 | end 257 | Citizen.Wait(0); 258 | end 259 | end) 260 | -------------------------------------------------------------------------------- /server.lua: -------------------------------------------------------------------------------- 1 | roleList = Config.roleList 2 | 3 | prefixes = {} 4 | hasPrefix = {} 5 | 6 | function stringsplit(inputstr, sep) 7 | if sep == nil then 8 | sep = "%s" 9 | end 10 | local t={} ; i=1 11 | for str in string.gmatch(inputstr, "([^"..sep.."]+)") do 12 | t[i] = str 13 | i = i + 1 14 | end 15 | return t 16 | end 17 | hidePrefix = {} 18 | hideAll = {} 19 | 20 | local function get_index (tab, val) 21 | local counter = 1 22 | for index, value in ipairs(tab) do 23 | if value == val then 24 | return counter 25 | end 26 | counter = counter + 1 27 | end 28 | 29 | return nil 30 | end 31 | 32 | local function has_value (tab, val) 33 | for index, value in ipairs(tab) do 34 | if value == val then 35 | return true 36 | end 37 | end 38 | return false 39 | end 40 | hideTags = {} 41 | 42 | function HideUserTag(src) 43 | if get_index(hideTags, GetPlayerName(src)) == nil then 44 | table.insert(hideTags, GetPlayerName(src)) 45 | TriggerClientEvent('ID:HideTag', -1, hideTags, false) 46 | end 47 | end 48 | function ShowUserTag(src) 49 | if get_index(hideTags, GetPlayerName(src)) ~= nil then 50 | table.remove(hideTags, get_index(hideTags, GetPlayerName(src))) 51 | TriggerClientEvent('ID:HideTag', -1, hideTags, false) 52 | end 53 | end 54 | 55 | RegisterCommand("tag-toggle", function(source, args, rawCommand) 56 | local name = GetPlayerName(source) 57 | if (has_value(hidePrefix, name)) then 58 | -- Turn on their tag-prefix and remove them 59 | table.remove(hidePrefix, get_index(hidePrefix, name)) 60 | TriggerClientEvent("ID:Tag-Toggle", -1, hidePrefix, false) 61 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^3Your tag is now ^2active") 62 | else 63 | -- Turn off their tag-prefix and add them 64 | table.insert(hidePrefix, name) 65 | TriggerClientEvent("ID:Tag-Toggle", -1, hidePrefix, false) 66 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^3Your tag is no longer ^1active") 67 | end 68 | end) 69 | RegisterCommand("tags-toggle", function(source, args, rawCommand) 70 | local name = GetPlayerName(source) 71 | if not Config.TagsForStaffOnly then 72 | if (has_value(hideAll, name)) then 73 | -- Have them not hide all tags 74 | table.remove(hideAll, get_index(hideAll, name)) 75 | TriggerClientEvent("ID:Tags-Toggle", source, false, false) 76 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 77 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^3Tags of players are now ^2active") 78 | else 79 | -- Have them hide all tags 80 | table.insert(hideAll, name) 81 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 82 | TriggerClientEvent("ID:Tags-Toggle", source, true, false) 83 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^3Tags of players are no longer ^1active") 84 | end 85 | else 86 | -- Only for staff 87 | if IsPlayerAceAllowed(source, "DiscordTagIDs.Use.Tag-Toggle") then 88 | if not (has_value(hideAll, name)) then 89 | -- Have them not hide all tags 90 | table.insert(hideAll, name) 91 | TriggerClientEvent("ID:Tags-Toggle", source, false, false) 92 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 93 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^3Tags of players are now ^2active") 94 | else 95 | -- Have them hide all tags 96 | table.remove(hideAll, get_index(hideAll, name)) 97 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 98 | TriggerClientEvent("ID:Tags-Toggle", source, true, false) 99 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^3Tags of players are no longer ^1active") 100 | end 101 | else 102 | TriggerClientEvent('chatMessage', source, "^9[^1Badger-Tags^9] ^1ERROR: You do not have access to this...") 103 | end 104 | end 105 | end) 106 | prefix = Config.Prefix; 107 | RegisterCommand("headtag", function(source, args, rawCommand) 108 | -- Change your headtag that is active 109 | if #args == 0 then 110 | -- List out what they have access to: 111 | local tags = prefixes[source] 112 | TriggerClientEvent('chatMessage', source, prefix .. 'You have access to the following Head-Tags:') 113 | if tags ~= nil then 114 | for i = 1, #tags do 115 | -- This is a tag 116 | TriggerClientEvent('chatMessage', source, '^9[^5' .. i .. '^9] ^3' .. tags[i]) 117 | end 118 | TriggerClientEvent('chatMessage', source, prefix .. 'You can change your Head-Tag with /headtag ') 119 | else 120 | TriggerClientEvent('chatMessage', source, '^1NONE'); 121 | end 122 | elseif #args == 1 then 123 | -- They picked one 124 | if tonumber(args[1]) ~= nil then 125 | local index = tonumber(args[1]) 126 | if prefixes[source][index] ~= nil and prefixes[source][index] ~= nil then 127 | -- Change their active tag to this 128 | activeTagTracker[source] = prefixes[source][index] 129 | -- Update clients: 130 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 131 | TriggerClientEvent('chatMessage', source, prefix .. 'Your Head-Tag has been changed to: ^1' .. prefixes[source][index]); 132 | else 133 | -- Not a valid ID 134 | TriggerClientEvent('chatMessage', source, prefix .. '^1ERROR: Not a valid Head-Tag ID'); 135 | end 136 | else 137 | -- Not a valid ID 138 | TriggerClientEvent('chatMessage', source, prefix .. '^1ERROR: Not a valid Head-Tag ID'); 139 | end 140 | else 141 | -- Not correct syntax 142 | TriggerClientEvent('chatMessage', source, prefix .. '^1ERROR: Not proper usage. /headtag '); 143 | end 144 | end) 145 | 146 | function GetActiveUserTag(src) 147 | if activeTagTracker[tonumber(src)] ~= nil then 148 | return activeTagTracker[tonumber(src)] 149 | end 150 | return nil 151 | end 152 | function GetUserTags(src) 153 | if prefixes[tonumber(src)] ~= nil then 154 | return prefixes[tonumber(src)] 155 | end 156 | return nil 157 | end 158 | function SetUserTag(src, ind) 159 | src = tonumber(src) 160 | if prefixes[src] ~= nil and prefixes[src][ind] ~= nil then 161 | activeTagTracker[src] = prefixes[src][ind] 162 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 163 | TriggerClientEvent('chatMessage', src, prefix .. 'Your Head-Tag has been changed to: ^1' .. prefixes[src][ind]); 164 | return true 165 | end 166 | return false 167 | end 168 | 169 | alreadyGotRoles = {} 170 | activeTagTracker = {} 171 | AddEventHandler('playerDropped', function (reason) 172 | activeTagTracker[source] = nil 173 | prefixes[source] = nil 174 | end) 175 | 176 | RegisterNetEvent('DiscordTag:Server:GetDiscordName') 177 | AddEventHandler('DiscordTag:Server:GetDiscordName', function() 178 | local src = source; 179 | local discordName = exports.Badger_Discord_API:GetDiscordName(src); 180 | if (not Config.ShowDiscordDescrim and discordName ~= nil) then 181 | discordName = stringsplit(discordName, "#")[1]; 182 | end 183 | TriggerClientEvent('DiscordTag:Server:GetDiscordName:Return', -1, src, discordName, Config.FormatDisplayName, Config.UseDiscordName); 184 | end) 185 | 186 | RegisterNetEvent('DiscordTag:Server:GetTag') 187 | AddEventHandler('DiscordTag:Server:GetTag', function() 188 | --AddEventHandler('chatMessage', function(source, name, msg) 189 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 190 | if Config.TagsForStaffOnly then 191 | if IsPlayerAceAllowed(source, "DiscordTagIDs.Use.Tag-Toggle") then 192 | TriggerClientEvent("ID:Tags-Toggle", source, false, false) 193 | end 194 | end 195 | local src = source 196 | for k, v in ipairs(GetPlayerIdentifiers(src)) do 197 | if string.sub(v, 1, string.len("discord:")) == "discord:" then 198 | identifierDiscord = v 199 | end 200 | end 201 | local roleAccess = {} 202 | local defaultRole = roleList[1][2] 203 | if identifierDiscord then 204 | local roleIDs = exports.Badger_Discord_API:GetDiscordRoles(src) 205 | if not (roleIDs == false) then 206 | table.insert(roleAccess, defaultRole) 207 | activeTagTracker[src] = roleAccess[1]; 208 | for i = 1, #roleList do 209 | for j = 1, #roleIDs do 210 | if exports.Badger_Discord_API:CheckEqual(roleList[i][1], roleIDs[j]) then 211 | local roleGive = roleList[i][2] 212 | print(GetPlayerName(src) .. " has ID tag for: " .. roleList[i][2]) 213 | table.insert(roleAccess, roleGive) 214 | activeTagTracker[src] = roleGive; 215 | end 216 | end 217 | end 218 | prefixes[src] = roleAccess; 219 | else 220 | table.insert(roleAccess, defaultRole) 221 | prefixes[src] = roleAccess; 222 | activeTagTracker[src] = roleAccess[1]; 223 | print(GetPlayerName(src) .. " has not gotten their permissions cause roleIDs == false") 224 | end 225 | else 226 | table.insert(roleAccess, defaultRole) 227 | prefixes[src] = roleAccess; 228 | activeTagTracker[src] = roleAccess[1]; 229 | end 230 | TriggerClientEvent("GetStaffID:StaffStr:Return", -1, prefixes, activeTagTracker, false) 231 | end) --------------------------------------------------------------------------------