Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local messageNames = {
- ["rush"] = true,
- ["fb"] = true,
- ["fm"] = true,
- ["bkup"] = true,
- ["clear"] = true
- }
- local voiceLimit = {}
- function voiceCommands(plrBoss, cmd, msg)
- local access
- if (hasObjectPermissionTo(plrBoss, "command.gochief", false)) then
- access = "pc"
- elseif (hasObjectPermissionTo(plrBoss, "command.gocb", false)) then
- access = "cb"
- end
- if (not access) then
- return false
- end
- if (not msg or not messageNames[string.lower(msg)]) then
- outputChatBox("SYNTAX: /vm fb, fm, clear, bkup", plrBoss, 255, 0, 0)
- return false
- end
- if (not exports.CITcrimEvent:isPlayerInCriminalEvent(plrBoss)) then
- outputChatBox("You can only use this command in Criminal Events!", plrBoss, 255, 0, 0)
- return false
- end
- if (voiceLimit[access] and getTickCount() - voiceLimit[access] < 30000) then
- outputChatBox("This command can be used one time in 30 seconds.", plrBoss, 255, 0, 0)
- return false
- end
- local plrTeam = getPlayerTeam(plrBoss)
- --if ((((access == "pc") and (plrTeam ~= getTeamFromName("Police Service")))) or ((access == "cb") and (plrTeam ~= getTeamFromName("Criminal") and plrTeam ~= getTeamFromName("Gangster")))) then
- if ((((access == "pc") and (plrTeam ~= getTeamFromName("Police Service")))) or ((access == "cb") and (not exports.CITteams:isPlayerInTeams(plrBoss, "Criminals", "Gangsters")))) then
- outputChatBox("For prevent abuse, you aren't allowed to use this command as "..getTeamName(plrTeam)..".", plrBoss, 255, 0, 0)
- return false
- end
- local x, y, z, = getElementPosition(plrBoss)
- local plrDim = getElementDimension(plrBoss)
- local plrInt = getElementInterior(plrBoss)
- local plrTable = {}
- for i, plr in ipairs (getElementsByType("player")) do
- if ((getElementDimension(plr) == plrDim) and (getElementInterior(plr) == plrInt)) then
- if (access == "pc") then
- if (plrTeam == getTeamFromName("Police Service")) then
- plrTable[#plrTable + 1] = plr
- end
- else
- --if (plrTeam == getTeamFromName("Criminals") or plrTeam == getTeamFromName("Gangsters")) then
- if (exports.CITteams:isPlayerInTeams(plr, "Criminals", "Gangsters")) then
- plrTable[#plrTable + 1] = plr
- end
- end
- end
- end
- --outputChatBox(#plrTable.." players", plrBoss, 255, 0, 0) --Test table
- triggerClientEvent(plrTable, "clientSayVoice", resourceRoot, string.lower(msg))
- end
- addCommandHandler("vm", voiceCommands)
Advertisement
Add Comment
Please, Sign In to add comment