Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t = {}
- local hidePoliceRadio = {}
- function policeRadio(thePlayer,cmd,...)
- if (not exports.GTIutil:isPlayerInTeam(thePlayer, "Law Enforcement")) then return end
- if (t[thePlayer]) then
- outputChatBox("You need to wait 3 seconds between each message.", thePlayer, 255, 0, 0)
- return
- end
- local playerName = getPlayerName(thePlayer)
- local message = table.concat({...}, " ")
- local team = getTeamFromName("Law Enforcement")
- local r, g, b = getTeamColor(team)
- local listeners = getPlayersInTeam(team)
- for i,player in ipairs(listeners) do
- if (not hidePoliceRadio[thePlayer]) then
- outputChatBox("(RADIO) "..playerName.." : #FFFFFF"..message.."",player,r,g,b,true)
- t[thePlayer] = true
- setTimer(function () t[thePlayer] = nil end, 3000, 1)
- end
- end
- end
- addCommandHandler("r", policeRadio, false, false)
- addCommandHandler("radio", policeRadio, false, false)
- function disablePoliceRadio(player)
- if (hidePoliceRadio[player]) then
- hidePoliceRadio[player] = nil
- outputChatBox("Radio enabled.", player)
- else
- hidePoliceRadio[player] = true
- outputChatBox("Radio disabled.", player)
- end
- end
- addCommandHandler("noradio", disablePoliceRadio)
- addEventHandler("onPlayerQuit", root, function()
- if (hidePoliceRadio[source]) then hidePoliceRadio[source] = nil end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement