Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------------------------
- -- PURPOSE: Voice Command for Criminal Bosses and Police Chiefs
- -- DEVELOPERS: HannS
- ------------------------------------------------------------------------------------
- local lastCheck = {}
- function voiceCommand(plr, cmd, arg)
- if (not hasObjectPermissionTo(plr, "command.gocb", true) and not hasObjectPermissionTo(plr, "command.gochief", true)) then
- return false
- end
- if (not exports.CITcrimEvent:isPlayerInCriminalEvent(plr)) then
- outputChatBox("This command can be only used inside a Criminal Event.", plr, 255, 0, 0)
- return false
- end
- if (not exports.CITteams:isPlayerInTeams(plr, "Criminals", "Gangsters", "Police Service")) then
- outputChatBox("You must be criminal or police.", plr, 255, 0, 0)
- return false
- end
- if (not arg or arg ~= "go" or arg ~= "fb" or arg ~= "hp") then
- outputChatBox("Syntax error: /qv go | /qv fb | /qv hp", plr, 255, 0, 0)
- return false
- end
- local x, y, z = getElementPosition(plr)
- if (hasObjectPermissionTo(plr, "command.gocb", true) and exports.CITteams:isPlayerInTeams(plr, "Criminals", "Gangsters")) then
- if (lastCheck["CB"] and ((getTickCount() - lastCheck["CB"]) < 60000)) then
- outputChatBox("This command can be used one time a minute.", plr, 255, 0, 0)
- return false
- end
- lastCheck["CB"] = getTickCount()
- for ind, crim in ipairs(exports.CITbusiness:getPlayersByJob("Criminal")) do
- if (exports.CITcrimEvent:isPlayerInCriminalEvent(crim)) then
- triggerClientEvent(crim, "CITvoiceChat.playSound", crim, arg, x, y, z)
- end
- end
- return true
- end
- if (lastCheck["PC"] and ((getTickCount() - lastCheck["PC"]) < 60000)) then
- outputChatBox("This command can be used one time a minute.", plr, 255, 0, 0)
- return false
- end
- lastCheck["PC"] = getTickCount()
- for ind, pol in ipairs(exports.CITbusiness:getPlayersByJob("Police Service")) do
- if (exports.CITcrimEvent:isPlayerInCriminalEvent(pol)) then
- triggerClientEvent(pol, "CITvoiceChat.playSound", pol, arg, x, y, z)
- end
- end
- end
- addCommandHandler("qv", voiceCommand)
Add Comment
Please, Sign In to add comment