Heres a tutorial i just made! https://youtu.be/dP9nOlAm8fY If you still wish for me to help I can do a TeamViewer meeting and help you as i just arrived back home!
Thanks! I just got back on my PC I’m going to watch that now!!
local Owner = {"steam:110000111960464","ip:",}
local CoOwner = {"steam:76561198318132472","ip:",}
local HeadAdmin = {"steam:76561198385211297","ip:",}
local Admin = {"steam:76561198090686207","ip:",}
local HighwayPatrol = {"steam:76561198212455039","ip:",}
local Fire = {"steam:","ip:",}
local EMT = {"steam:","ip:",}
local Sheriff = {"steam:","ip:",}
local Moderator = {"steam:","ip:",}
local StateTroopers= {"steam:","ip:",}
AddEventHandler('chatMessage', function(Source, Name, Msg)
args = stringsplit(Msg, " ")
CancelEvent()
if string.find(args[1], "/") then
local cmd = args[1]
table.remove(args, 1)
else
local player = GetPlayerIdentifiers(Source)[1]
if has_value(Owner, player) then
TriggerClientEvent('chatMessage', -1, "Owner | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(CoOwner, player) then
TriggerClientEvent('chatMessage', -1, "Co-Owner | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(HeadAdmin, player) then
TriggerClientEvent('chatMessage', -1, "Head Admin | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(Admin, player) then
TriggerClientEvent('chatMessage', -1, "Admin | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(HighwayPatrol, player) then
TriggerClientEvent('chatMessage', -1, "Highway Patrol | " .. Name, { 0, 0, 255 }, Msg)
elseif has_value(Fire, player) then
TriggerClientEvent('chatMessage', -1, "Fire | " .. Name, { 0, 0, 255 }, Msg)
elseif has_value(EMT, player) then
TriggerClientEvent('chatMessage', -1, "EMT | " .. Name, { 0, 0, 255 }, Msg)
elseif has_value(Sheriff, player) then
TriggerClientEvent('chatMessage', -1, "Sheriff's Department | " .. Name, { 0, 0, 255 }, Msg)
elseif has_value(Moderator, player) then
TriggerClientEvent('chatMessage', -1, "Moderator | " .. Name, { 0, 255, 247 }, Msg)
elseif has_value(StateTroopers, player) then
TriggerClientEvent('chatMessage', -1, "State Troopers | " .. Name, { 222, 0, 255 }, Msg)
else
TriggerClientEvent('chatMessage', -1, "Civilian | " .. Name, { 235, 214, 51 }, Msg)
end
end
end)
function has_value (tab, val)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end
function stringsplit(self, delimiter) -- A function
local a = self:Split(delimiter) -- Splits the string.
local t = {} -- Creates a table
for i = 0, #a - 1 do -- For loop to loop through all the arguments.
table.insert(t, a[i]) -- Inserts the arguments into a table
end
return t -- Returns the table
YOU CANT HAVE SPACES in local HighwayPatrol = {“steam:76561198212455039”,“ip:”,}
I fixed it but you cant have spaces in there. I shouldve noted that
Can you PM Me a link to your Discord?
I just PM’d you on the forums.
so to add people i just put there steam id’s?
so… file link is dead.
The link was fixed and was reuploaded!
For this to work on FXServer you need to change the stringsplit function with
function stringsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
Ok Thank you so much!
Hmm, what do you mean
Maybe your using the citMP version of chat roles and not for FX?
Nope I use the fx version
You should check the following:
Make sure you cancel the chat event
OR most likely
You are using a resource that doubles the chat, (like local chat) I had the problem similar to that before, I’d recommend checking your resources and making sure something isn’t broken that will interfere (such as local chat)
okay sorry one of my develepors fixed it meanwhile i was sleeping but thanks anyways!
@JayJayAuto Whenever I install it correctly it never works in game on my server no matter what I try, and I keep getting this error:
Which one are you using? FX OR nON FX
Wierd… ill look