You would use the following:
local Admin = {"steam:steamhex","steam:hex",} # Make sure you leave a , after
You would use the following:
local Admin = {"steam:steamhex","steam:hex",} # Make sure you leave a , after
I actually have a Problem now.
The script doesen’t work. I’ll send what I have in the file it self.
Screenshot Below
local Owner = {“steam:110000111960464”,“ip:”,}
local Co-Owner = {“steam:76561198318132472”,“ip:”,}
local Head Admin = {“steam:76561198385211297”,“ip:”,}
local Admin = {“steam:76561198090686207”,“ip:”,}
local Highway Patrol = {“steam:76561198212455039”,“ip:”,}
local Fire = {“steam:”,“ip:”,}
local EMT = {“steam:”,“ip:”,}
local Sheriff’s Department = {“steam:”,“ip:”,}
local Moderator = {“steam:”,“ip:”,}
local State Troopers= {“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(Co-Owner, player) then
TriggerClientEvent(‘chatMessage’, -1, "Co-Owner | " … Name, { 255, 0, 0 }, Msg)
elseif has_value(Head Admin, 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(Highway Patrol, 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’s Department, 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(State Troopers, 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
For starters, use the markdown for code (image)
and ensure you using correct usage, please edit to use markdown and then I can help you.
local Owner = {"steam:110000111960464","ip:",}
local Co-Owner = {"steam:76561198318132472","ip:",}
local Head Admin = {"steam:76561198385211297","ip:",}
local Admin = {"steam:76561198090686207","ip:",}
local Highway Patrol = {"steam:76561198212455039","ip:",}
local Fire = {"steam:","ip:",}
local EMT = {"steam:","ip:",}
local Sheriff's Department = {"steam:","ip:",}
local Moderator = {"steam:","ip:",}
local State Troopers= {"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(Co-Owner, player) then
TriggerClientEvent('chatMessage', -1, "Co-Owner | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(Head Admin, 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(Highway Patrol, 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's Department, 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(State Troopers, 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
Try this:
local Owner = {"steam:110000111960464","ip:",}
local Co-Owner = {"steam:76561198318132472","ip:",}
local Head Admin = {"steam:76561198385211297","ip:",}
local Admin = {"steam:76561198090686207","ip:",}
local Highway Patrol = {"steam:76561198212455039","ip:",}
local Fire = {"steam:","ip:",}
local EMT = {"steam:","ip:",}
local Sheriff = {"steam:","ip:",}
local Moderator = {"steam:","ip:",}
local State Troopers= {"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(Co-Owner, player) then
TriggerClientEvent('chatMessage', -1, "Co-Owner | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(Head Admin, 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(Highway Patrol, 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(State Troopers, 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
Try to avoid using 's or spaces.
We have 10 people in game rn. So I’ll restart it later. I’ll let you know if it works!! Thanks a lot!
Trex, your problem is elseif is spaced behind all the others
He also used ’ in the names, which wouldn’t have worked…
This is what the file looks like now.
local Owner = {"steam:110000111960464","ip:",}
local Co-Owner = {"steam:76561198318132472","ip:",}
local Head Admin = {"steam:76561198385211297","ip:",}
local Admin = {"steam:76561198090686207","ip:",}
local Highway Patrol = {"steam:76561198212455039","ip:",}
local Fire = {"steam:","ip:",}
local EMT = {"steam:","ip:",}
local Sheriff = {"steam:","ip:",}
local Moderator = {"steam:","ip:",}
local State Troopers= {"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(Co-Owner, player) then
TriggerClientEvent('chatMessage', -1, "Co-Owner | " .. Name, { 255, 0, 0 }, Msg)
elseif has_value(Head Admin, 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(Highway Patrol, 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(State Troopers, 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
Sadly is still doesn’t work. @JayJayAuto do you know why?
Try removing the - in Co-Owner.
Your not using the Steam:(id here) that you find in console by doing status in rcon. Your using the Steam64 ID which doesnt work. Use those and put those for the ids where the Ids are located. Let me see if i can find any other error. @TrexHB
And instead of restarting to test just edit it and do “stop roles” in rcon then do “start roles” that will restart the script
So should I remove the - in Co-Owner and use the steam ID’s in the RCON.
No need to remove the - as I’m aware. I used to have that in my sevrer when I made the script. But yes you need to use the ID’s in RCON
It also still doesn’t work for me. Do you guys have TeamViewer12 or Discord? Cause if you guys could just do it for me it would be a lot faster!!
Hey,
This should work, alot of your group names had spaces, I’m pretty sure it wouldn’t support that, aside from that I changed all of the names that had spaces, -'s etc…
So heres the finished version, please update me if it works or not.
local Owner = {"steam:110000111960464","ip:",}
local CoOwner = {"steam:76561198318132472","ip:",}
local HeadAdmin = {"steam:76561198385211297","ip:",}
local Admin = {"steam:76561198090686207","ip:",}
local Highway Patrol = {"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(Highway Patrol, 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
Put A Space In Front OF StateTroopers and =