This is the gun carrying system. I want it to work on my police scripit
function Loadind_Porte ( conta )
if not isGuestAccount ( conta ) then
if conta then
local source = getAccountPlayer ( conta )
local Emprego = getAccountData ( conta, "TS:PorteDeArmas" ) or "Não"
setElementData ( source, "TS:PorteDeArmas", Emprego )
end
end
end
function Save_Porte ( conta )
if conta then
local source = getAccountPlayer ( conta )
local Porte = getElementData ( source, "TS:PorteDeArmas" ) or "Não"
setAccountData ( conta, "TS:PorteDeArmas", Porte )
end
end
addEventHandler ( "onPlayerLogin", root,
function ( _, acc )
setTimer ( Loadind_Porte, 60, 1, acc )
end
)
function Start_Porte ( res )
if res == getThisResource ( ) then
for i, player in ipairs(getElementsByType("player")) do
local acc = getPlayerAccount ( player )
if not isGuestAccount ( acc ) then
Loadind_Porte ( acc )
end
end
end
end
addEventHandler ( "onResourceStart", getRootElement ( ), Start_Porte )
function Stop_Porte ( res )
if res == getThisResource ( ) then
for i, player in ipairs(getElementsByType("player")) do
local acc = getPlayerAccount ( player )
if not isGuestAccount ( acc ) then
Save_Porte ( acc )
end
end
end
end
addEventHandler ( "onResourceStop", getRootElement(), Stop_Porte )
function Quit_Server ( quitType )
local acc = getPlayerAccount(source)
if not isGuestAccount ( acc ) then
if acc then
Save_Porte ( acc )
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), Quit_Server )
Grupo = "ComandosPolicia" -- Grupo do Painel P , que terá acesso ao Dx !
function ClickJogdor ( Player )
local acc = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ("user."..acc, aclGetGroup ( Grupo ) ) then
local account = getPlayerAccount (Player)
if isGuestAccount (account) then msgFeniX(source, "Esse Jogador está deslogado !", "error") return end
local cx, cy, cz = getElementPosition ( Player )
local px, py, pz = getElementPosition ( source )
local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
if ( distance <= 1.7 ) then
if Player == source then return end
triggerClientEvent (source , "FeniX_AbrirDX" , source)
setElementData(source, "FeniXMTA_Suspeito" , Player)
end
end
end
addEvent ( "FeniX_ClickJogdor", true )
addEventHandler ( "FeniX_ClickJogdor", root, ClickJogdor)
--[[
################################################
# Bindkey #
################################################
--]]
function onPlayerCommand(command)
if getElementData(source,"FeniX_Preso") then
cancelEvent()
end
end
addEventHandler("onPlayerCommand",getRootElement(),onPlayerCommand)
--[[
################################################
# Parte Multa #
################################################
--]]
function setarMulta( Valor_Multa , Motivo_Multa )
local Abordado = getElementData( source,"FeniXMTA_Suspeito")
local cx, cy, cz = getElementPosition ( Abordado )
local px, py, pz = getElementPosition ( source )
local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
if ( distance >= 1.8 ) then
msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
elseif ( distance <= 1.7) then
takePlayerMoney(Abordado, tonumber(Valor_Multa))
givePlayerMoney(source, tonumber(Valor_Multa))
outputChatBox ( "#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffVocê foi Multado pelo PM: "..getPlayerName(source).." #ffffff, Motivo: #FF0000"..Motivo_Multa.." #ffffff, Valor: #FF0000"..Valor_Multa.." #ffffff!" , Abordado , 255,255,255, true)
end
end
addEvent("FeniX_SetarMulta", true)
addEventHandler("FeniX_SetarMulta", root, setarMulta)
addEvent("FeniX_Aviso_2",true)
addEventHandler("FeniX_Aviso_2",root,
function ()
msgFeniX(source, "Informe o Valor da Multa !", "error")
end
)
addEvent("FeniX_Aviso_1",true)
addEventHandler("FeniX_Aviso_1",root,
function ()
msgFeniX(source, "Informe o Motivo da Multa !", "error")
end
)
--[[
################################################
# Função CNH #
################################################
--]]
function cnHPlayer ()
local Abordado = getElementData( source,"FeniXMTA_Suspeito")
local cx, cy, cz = getElementPosition ( Abordado )
local px, py, pz = getElementPosition ( source )
local distance = getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
if ( distance >= 1.8 ) then
msgFeniX(source, "Chegue Mais Perto Do Jogador vai efetuar esta função !", "error")
elseif ( distance <= 1.7) then
if getElementData(Abordado, "DNL:Categoria(A)") == true then
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = A ( #00FF00✔ #ffffff)", source , 255, 255, 255, true)
else
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = A ( #FF0000x #ffffff)", source , 255, 255, 255, true)
end
if getElementData(Abordado, "DNL:Categoria(B)") == true then
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = B ( #00FF00✔ #ffffff)", source , 255, 255, 255, true)
else
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = B ( #FF0000x #ffffff)", source , 255, 255, 255, true)
end
if getElementData(Abordado, "DNL:Categoria(C)") == true then
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = C ( #00FF00✔ #ffffff)", source , 255, 255, 255, true)
else
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = C ( #FF0000x #ffffff)", source , 255, 255, 255, true)
end
if getElementData(Abordado, "DNL:Categoria(D)") == true then
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = D ( #00FF00✔ #ffffff)", source , 255, 255, 255, true)
else
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = D ( #FF0000x #ffffff)", source , 255, 255, 255, true)
end
if getElementData(Abordado, "DNL:Categoria(E)") == true then
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = E ( #00FF00✔ #ffffff)", source , 255, 255, 255, true)
else
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffffCategoria = E ( #FF0000x #ffffff)", source , 255, 255, 255, true)
end
end
end
addEvent ( "FeniX_CNH", true )
addEventHandler ( "FeniX_CNH", root, cnHPlayer)
--[[
################################################
# Identidade #
################################################
--]]
cmd0 = "verificar"
cmd2 = "recusar"
cmd3 = "mostrar"
function BuscarIDVTR (source, cmd, pname)
local acc = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ("user."..acc, aclGetGroup ( Grupo ) ) then
local vehicle = getPedOccupiedVehicle (source)
local cliente = getPlayerFromPartialName(pname)
if isElement(cliente) then
if cliente == source then msgFeniX(source, "Você não Pode Verificar sua Propria Ficha!", "error") return end
if getElementData ( cliente, "AirNew_BuscaID_Perm" ) == "Sim" then
if isElement(vehicle) then
if (getElementType(vehicle) == "vehicle" ) then
if (getVehicleType(vehicle) == "Automobile") or (getVehicleType(vehicle) == "Bike") then
local id = getElementModel ( vehicle )
if id == 433 or id == 579 or id == 427 or id == 490 or id == 528 or id == 523 or id == 470 or id == 596 or id == 598 or id == 599 or id == 597 or id == 432 or id == 601 then
local RG = getElementData ( cliente, "AirNew_RG" ) or "N/C"
setElementData ( source, "PM_AirNew_RG", RG )
local Data = getElementData ( cliente, "AirNew_DataExpedicao" ) or "N/C"
setElementData ( source, "PM_AirNew_DataExpedicao", Data )
local Nome = getElementData ( cliente, "AirNew_RG_NomeCompleto" ) or "N/C"
setElementData ( source, "PM_AirNew_RG_NomeCompleto", Nome )
local DataNas = getElementData ( cliente, "AirNew_RG_DataDeNascimento" ) or "N/C"
setElementData ( source, "PM_AirNew_RG_DataDeNascimento", DataNas )
local LocalNas = getElementData ( cliente, "AirNew_RG_LocalDeNascimento" ) or "N/C"
setElementData ( source, "PM_AirNew_RG_LocalDeNascimento", LocalNas )
local ProcuradoNivel = getPlayerWantedLevel ( cliente )
setElementData ( source, "PM_AirNew_RG_Procurado", ProcuradoNivel )
local Drogas = getElementData ( cliente, "drogas" ) or "N/C"
setElementData ( source, "PM_AirNew_Drogas", Drogas )
local Dinheiro_AirNewSCR = getElementData ( cliente, "Dinheiro_AirNewSCR" ) or "N/C"
setElementData ( source, "Dinheiro_AirNewSCR_Abordado", Dinheiro_AirNewSCR )
local AirNewSCR_Porte_de_Armas = getElementData ( cliente, "AirNewSCR_Porte_de_Armas" ) or "N/C"
setElementData ( source, "PM_AirNewSCR_Porte_de_Armas", AirNewSCR_Porte_de_Armas )
setElementData ( source, "AirNew_SolicitarAbrirFicha", "Sim" ) -- Abrir Ficha
end
end
end
else
msgFeniX(source, "Entre Dentro da Viatura para Poder Utilizar esse Comando!", "error")
end
else
msgFeniX(source, "Você não pode puxar uma Ficha sem a Identidade do Jogador!", "error")
end
end
end
end
addCommandHandler ( cmd0, BuscarIDVTR )
canceltimer={}
function fix()
local Abordado = getElementData( source,"FeniXMTA_Suspeito")
local acc = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ("user."..acc, aclGetGroup ( Grupo ) ) then
local policial = getElementData(Abordado,"cliente:policial")
if isElement(policial) then
msgFeniX(source, "O Jogador "..getPlayerName(Abordado).." #ffffffJa Esta Sendo Atendido Por um Policial!", "error")
else
setElementData(Abordado,"cliente:policial",source)
msgFeniX(source, "Você Solicitou a Identidade do Jogador "..getPlayerName(Abordado), "warning")
msgFeniX(Abordado, "O Policial "..getPlayerName(source).." #ffffffPediu sua Identidade, Digite /Mostrar ou /Recusar.", "warning")
canceltimer[Abordado] = setTimer(cancelfix,15000,1,Abordado)
end
end
end
addEvent ( "FeniX_Identidade", true )
addEventHandler ( "FeniX_Identidade", root, fix)
function recusar(source)
local policial = getElementData(source,"cliente:policial")
if isElement(policial) then
msgFeniX(policial, "O Jogador "..getPlayerName(source).." #ffffffSe Recusou a Mostrar a Identidade, +1 Nivel de Procurado!", "error") -- Policial
msgFeniX(source, "Você se Recusou a Entregar a Identidade, e Agora esta Procurado!", "warning")
Procurado = getPlayerWantedLevel ( source )
setPlayerWantedLevel ( source, Procurado+1 )
end
setElementData(source,"cliente:policial",nil)
if isTimer(canceltimer[source]) then
killTimer(canceltimer[source])
end
end
addCommandHandler(cmd2,recusar)
function aceitar(source)
local policial = getElementData(source,"cliente:policial")
if isElement(policial) then
msgFeniX(policial, "O Jogador "..getPlayerName(source).." #ffffffLhe mostrou a Identidade, Verifique Dentro da Viatura /Verificar Nick. (Você tem 60 Segundos)", "success")
msgFeniX(source, "Você mostrou sua identidade ao Policial "..getPlayerName(policial).." #ffffff( ele tem tem 60 Segundos pra verificar na viatura!)", "success")
local cx,cy,cz = getElementPosition(policial)
local x,y,z = getElementPosition(source)
local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
if dist <= 7 then
--setElementData ( policial, "AirNew_BuscaID", ""..getPlayerName(source).."" )
setElementData ( source, "AirNew_BuscaID_Perm", "Sim" )
setTimer ( function() setElementData ( source, "AirNew_BuscaID_Perm", "Não" ) end, 60000, 1 )
else
msgFeniX(source, "O Policial Esta Muito Longe!", "error")
msgFeniX(policial, "Você Esta Muito Longe do Jogador Abordado!", "error")
end
end
setElementData(source,"cliente:policial",nil)
if isTimer(canceltimer[source]) then
killTimer(canceltimer[source])
end
end
addCommandHandler(cmd3,aceitar)
function cancelfix(source)
local policial = getElementData(source,"cliente:policial")
if isElement(policial) then
msgFeniX(policial, "O Jogador "..getPlayerName(source).." #ffffffDemorou Para Mostrar ou Recusar a Identidade, +1 Nivel de Procurado!", "error")
end
msgFeniX(source, "Você Demorou Demais Para Mostrar ou Recusar o Reparo e Agora esta Procurado!", "error")
setElementData(source,"cliente:policial",nil)
Procurado = getPlayerWantedLevel ( source )
if Procurado < 6 then
setPlayerWantedLevel ( source, Procurado+1 )
end
end
function getPlayerFromPartialName(name)
local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
if name then
for _, player in ipairs(getElementsByType("player")) do
local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
if name_:find(name, 1, true) then
return player
end
end
end
end