[HELP] Announcement script for police only

Hi, i would like to create an announcement for jobs only in this case for police only.
I have this already but it doesnt working, I’m new in scripts so I hope u can help me out.

I have a server.lua looks like this:

RegisterCommand(“gov”, function(source, args)

local announceMessage = table.concat(args, " ", 1)



if ESX.GetPlayerData.Job.name = 'police' then

    print("[^4LSPD^7]" .. announceMessage )

    TriggerClientEvent("chatMessage", -1, "^4[^4^1LSPD^5^7]" .. announceMessage)

else

    TriggerClientEvent("chatMessage", source, "[Error]", {255,0,0}, "You can't use this.")

end

end)

and a client.lua

RegisterCommand(“gov”, function(source, args)

TriggerServerEvent("gov", table.concat(args, " "))

end)

RegisterNetEvent(“no-perms”)

AddEventHandler(“no-perms”, function()

TriggerEvent("chatMessage", "[Error]", {255,0,0}, "You can't use this")

end)

There is no error messages when starting the resource, and I can see /gov when I type it in, but no printed message.

1 Like