[Release] Chat Roles [UPDATED 5/30/18] [Tutorial Released]

how i disable this one ?
image

Turn off your normal Chat skript

When i type in the chat its show’s me my two messages image

You probably have a conflicting script

Why is the script enforcing players to use /say in chat? When I remove this script the chat runs fine and people can type normally, but somewhere in the code this script is making players use this command, and I can’t seem to find out how to fix it lol

In case anyone wanted a Discord chat roles script. I made one a long while ago using inspiration from JayJayAuto’s script here. You can find it over at: DiscordChatRoles [Release]

hey jay its redneck15 i cant seem to figure it out but it says that there is something wrong with the lua and im on an fx server and i got everthing set up right

This works automatically when a player has a job or you have to add it with some command or from code?

--- DO NOT REMOVE ME FROM THE CONFIG, ITS THERE TO GIVE ME CREDIT WHEN I JOIN SERVERS.
--- DO NOT REMOVE ME FROM THE CONFIG, ITS THERE TO GIVE ME CREDIT WHEN I JOIN SERVERS.
--- DO NOT REMOVE ME FROM THE CONFIG, ITS THERE TO GIVE ME CREDIT WHEN I JOIN SERVERS.
--- DO NOT REMOVE ME FROM THE CONFIG, ITS THERE TO GIVE ME CREDIT WHEN I JOIN SERVERS.
--- DO NOT REMOVE ME FROM THE CONFIG, ITS THERE TO GIVE ME CREDIT WHEN I JOIN SERVERS.
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE



local Director = {"steam:11000013ec307b9","ip:",}
local Admin = {"steam:","ip:",}
local HighwayPatrol = {"steam:","ip:",}
local Fire = {"steam:","ip:",}
local EMT = {"steam:","ip:",}
local Sheriff = {"steam:","ip:",}
local Moderator = {"steam:","ip:",}
local StateTroopers = {"steam:","ip:",}
local Test = {"steam:","ip:",}
local ScriptCreator = {"steam:110000108ce69e8","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(Director, player) then
            TriggerClientEvent('chatMessage', -1, "Director | " .. 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)
		elseif has_value(Test, player) then
            TriggerClientEvent('chatMessage', -1, "State Troopers | Admin " .. Name, { 222, 0, 255 }, Msg)
		elseif has_value(ScriptCreator, player) then
            TriggerClientEvent('chatMessage', -1, "Chat Roles Creator | " .. Name, { 0, 255, 43 }, Msg)
        else
            TriggerClientEvent('chatMessage', -1, "Civilian | " .. Name, { 159, 121, 160 }, 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(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

---ALLOWS YOU TO CHECK VERSIONS IN GAME

AddEventHandler('chatMessage', function(source, name, msg)
  if msg:sub(1, 1) == "/" then
    sm = stringsplit(msg, " ");
	   if sm[1] == "/fversion" then
		     CancelEvent()
	TriggerClientEvent('chatMessage', source, "^0[^1RolesFX Script Version Check^0]", {30, 144, 255}, " ^2Version 1.1.0 | RolesFX By Jay Gatsby!^0 ) " .. string.sub(msg,11))
     end
  end

end)

---PRINTS THIS CODE BELOW TO THE CONSOLE 

print('Jays Roles FX has loaded in to the server! Type in chat to test it out!')

--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE
--- IP'S ARE BROKEN DO NOT USE

Anyone know of why it is now working?? Civilians pop up but if I add anyone it keeps them as civilain?

Hi could you help me with this please it says failed to load sv_chat

local Owner = {"steam:“76561198320649767”,“ip:”,}
local Dev = {"steam:“76561198802942060”,“ip:”,}
local HeadAdmin = {“steam:76561198385211297”,“ip:”,}
local Admin = {“steam:76561198090686207”,“ip:”,}
local TrialAdmin = {“steam:76561198212455039”,“ip:”,}
local Moderator = {“steam:”,“ip:”,}
local TrialModerator = {“steam:”,“ip:”,}
local SupportTeam = {“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(Dev, player) then
TriggerClientEvent(‘chatMessage’, -1, "Dev | " … 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(TrialAdmin, player) then
TriggerClientEvent(‘chatMessage’, -1, "Trial Admin | " … Name, { 0, 0, 255 }, Msg)
elseif has_value(Moderator, player) then
TriggerClientEvent(‘chatMessage’, -1, "Moderator | " … Name, { 0, 0, 255 }, Msg)
elseif has_value(Trial Moderator, player) then
TriggerClientEvent(‘chatMessage’, -1, "Trial Moderator | " … Name, { 0, 0, 255 }, Msg)
elseif has_value(SupportTeam, player) then
TriggerClientEvent(‘chatMessage’, -1, "Support Team | " … 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

Why when i send a message in chat do i get 2 messages. One with the chat role and one without?

You have a conflicting script, maybe RPChat or something, try disabling any script that has chat commands or edits the chat until you find it.

its esx_rpchat thats causing the conflict

good job :slight_smile:

@JayJayAuto Hey! Would there be any kind of way to make it so when a regular user joins, it picks a random color for them, and for example with the owners and admins, could we make the colors animated so they stand out? Sound notifications would also be cool for people that wanted them. I would like to have them because i tab out often to work on models and textures and such, and i like to greet people manually when they join the server. i assume there should also be some kind of way to whitelist the person who wants notifications via their steam ID. Thanks in advance! Here’s a little code in CSS for a rainbow effect:

.wrapper {
height: 100%;
width: 100%;
left:0;
right: 0;
top: 0;
bottom: 0;
position: absolute;
background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
background-size: 1800% 1800%;

-webkit-animation: rainbow 18s ease infinite;
-z-animation: rainbow 18s ease infinite;
-o-animation: rainbow 18s ease infinite;
animation: rainbow 18s ease infinite;}

@-webkit-keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
@-moz-keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
@-o-keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
@keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}

P.S, I’ve used something similar on my scoreboard. here’s a preview!

same for me, anyone has a fix?!

same!!

Is there any way to sync it with Ace discord perms? So I don’t have to set up every steam id, etc.

i need some help, the scrips seems to not overwrite it and it sends 2 messages, one with the prefix, and one without, how do i fix it?

If you have two Messages, go to your ESX Folder and find esx_rpchat and go to client and on the lua file find chatMessage delete until a end) comes restart esx_rpchat and check if you only get one message

SRY FOR MY BAD ENGLISH.