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

If you really want, I can take a look at your server log when the issues happens. Just recreate the issue with the script on and send me the log after it happens!

aye JGatsby whatsup my man its exo

Join my discord bruh

the Roles arnt working im running a FX server and i put my steam id in it and it doesnt change the role in game
i even tried to make an owner one and it still didnt change the role in gameā€¦

It fixed by it self. I donā€™t understand how is that possible, I hope will stay fixed. Everything is working.

could you dm me a link to it?

Removed you from creator role because you did not create the scriptā€¦

Actually just remembered I am using the version from the original creator not you.

Love ya! Mr Scott!!!

its working but wont show me as owner just civ in chat like its not regestering my ip nor my steam id weird?

IPā€™s donā€™t work anymoreā€¦ also USE THE TUTORIAL I PROVIDED

You would be better asking in the other post about chat roles where the guy actually knows what heā€™s doing.

I know what Iā€™m doing but okā€¦ I have tutorials but please take your self somewhere else

Please privately dm me your RolesFX config and Iā€™ll take a look at them and see if something is wrong!

How can I make it so normal civilians donā€™t have ā€œcivilianā€ before there name so I just have it for police department, admins, moderators etc?

I will send you the config hat doesnā€™t have that!

Here is the updated script without the automatic civ but still whitelistable rolesFXnociv.rar (1.0 KB)

Iā€™ll try it now, cheers.

@jdc4992 's code:

local Admin = {"steam:[YOUR-ID-HERE]","ip:[YOUR-IP-HERE]",}
local Police = {}
local Fire = {}
local EMS = {}
local Sheriff = {}

AddEventHandler('chatMessage', function(Source, Name, Msg)
    args = stringsplit(Msg, " ")
    CancelEvent()
    if string.find(args[1], "/") then
        local cmd = args[1]
        table.remove(args, 1)
        TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Command: ".. cmd .. " | Additional: " .. table.concat(args, " "))
    else     
        local player = GetPlayerIdentifiers(Source)[1]
        if has_value(Admin, player) then
            TriggerClientEvent('chatMessage', -1, "Admin | " .. Name, { 255, 0, 0 }, Msg)
        elseif has_value(Police, player) then
            TriggerClientEvent('chatMessage', -1, "Police | " .. Name, { 0, 0, 255 }, Msg)
        elseif has_value(Fire) then
            TriggerClientEvent('chatMessage', -1, "Fire | " .. Name, { 0, 0, 255 }, Msg)
        elseif has_value(EMS, player) then
            TriggerClientEvent('chatMessage', -1, "EMS | " .. Name, { 0, 0, 255 }, Msg)
        elseif has_value(Sheriff, player) then
            TriggerClientEvent('chatMessage', -1, "Sheriff | " .. Name, { 0, 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
end

ā€œYourā€ 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.



local Director = {"steam:","ip:127.0.0.1",}
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, { 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(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

Seems the exact same but with different roles to meā€¦ The only difference other than that is you have removed his comments and added your own which claim you own this script.

2 Likes

oh shut it Scotty my boy theres nothing we can do unless the orignal creator decides to fight for the script

Anyway to make this proxy and to use character names instead of steam names?