ImSoCrzy Posted August 7, 2021 Share Posted August 7, 2021 Olá pessoal, estou com um problema aqui com esse código, basicamente é um Painel da Policia, só que só funciona se o policia clicar com o rato no jogador, porem assim não funciona bem eu queria adicionar um comando por id, por exemplo: /policial (id) e abrir o painel desse jeito Alguém pode me ajudar to quebrando a cabeça com isso... Lembrando esse painel peguei na net não é meu! addEvent("N3xT.onClickPolicial", true) addEvent("N3xT.onAlgemar", true) addEvent("N3xT.onViatura", true) addEvent("N3xT.onAgarrar", true) addEvent("N3xT.onMultar", true) addEvent("N3xT.ItensPM", true) addEvent("N3xT.takeWeaponPM", true) addEventHandler("N3xT.onClickPolicial", root, function(click) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Policial")) then triggerClientEvent(source, "N3xT.onPainelPolicial", resourceRoot, click) end end ) addEventHandler("N3xT.onAlgemar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not getElementData(receiver, "Algemado") then setElementData(receiver, "Algemado", true) message(source, "O jogador foi algemado.", "success") message(receiver, "Você foi algemado!", "info") else setElementData(receiver, "Algemado", nil) setPedAnimation(receiver, false) message(source, "O jogador foi desalgemado.", "success") message(receiver, "Você foi desalgemado.", "info") end end end ) local carros = {} function salvacarro(vei, assento, vitima) carros[source] = vei end addEventHandler("onPlayerVehicleEnter", root, salvacarro) addEventHandler("N3xT.onViatura", root, function() local receiver = getElementData(source, "ReceiverPM") local vtr = carros[source] if (receiver) and (vtr) then local vrx, vry, vrz = getElementRotation(vtr) local px, py, pz = getElementPosition(vtr) if not getElementData(receiver, "NaViatura") then if not isPedInVehicle(receiver) then setElementData(receiver, "NaViatura", true) message(source, "O jogador foi colocado na viatura.", "success") message(receiver, "Você foi colocado na viatura!", "info") attachElements(receiver, vtr, 0.2, -1.5, 0, 0,0,90) setPedAnimation(receiver, 'ped','CAR_dead_LHS') setElementRotation(receiver, vrx, vry, vrz + 83) end else setElementData(receiver, "NaViatura", nil) message(source, "O jogador foi retirado da viatura.", "success") message(receiver, "Você foi retirado da viatura!", "info") detachElements(receiver, getElementAttachedTo(receiver)) setElementPosition(receiver, px + 2, py + 2, pz) setPedAnimation(receiver) end end end ) addEventHandler("N3xT.onAgarrar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not (getElementData(receiver, "Agarrado") == true) then setElementData(receiver, "Agarrado", true) message(source, "O jogador foi agarrado.", "success") message(receiver, "Você foi agarrado!", "info") attachElements(receiver, source, 0, 1, 0) else setElementData(receiver, "Agarrado", nil) message(source, "O jogador foi desagarrado.", "success") message(receiver, "Você foi desagarrado!", "info") detachElements(receiver, source) end end end ) addEventHandler("N3xT.onMultar", root, function(motivo, valor) local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then local money = getPlayerMoney(receiver) if (money >= tonumber(valor)) then message(source, "A multa foi aplicada com sucesso.", "success") message(receiver, "Você foi multado no valor de #00ff7fR$"..valor.." #ffffffpelo motivo: #a9a9a9"..motivo.."#ffffff.", "info") takePlayerMoney(receiver, tonumber(valor)) else message(source, "O jogador não possuí o valor da multa!", "error") end end end ) addEventHandler("N3xT.ItensPM", root, function(value, item, quantia) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local next = exports.n3xt_inventario if (value == 1) then local itemTable = next:getAllItens(receiver) triggerClientEvent(source, "N3xT.refreshGridItemPM", resourceRoot, itemTable) elseif (value == 2) then next:takeItemS(source, receiver, item, tonumber(quantia)) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) end end end ) addEventHandler("N3xT.takeWeaponPM", root, function(arma) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local id = getWeaponIDFromName(arma) takeWeapon(receiver, id) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) message(source, "A arma foi retirada com sucesso.", "success") message(receiver, "Foi retirado de você a arma #00ff7f"..arma.."#ffffff.", "info") end end ) function message(player, message, type) triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type) end Link to comment
Blaack Posted August 8, 2021 Share Posted August 8, 2021 On 07/08/2021 at 13:49, Im_PlayerGTA said: Olá pessoal, estou com um problema aqui com esse código, basicamente é um Painel da Policia, só que só funciona se o policia clicar com o rato no jogador, porem assim não funciona bem eu queria adicionar um comando por id, por exemplo: /policial (id) e abrir o painel desse jeito Alguém pode me ajudar to quebrando a cabeça com isso... Lembrando esse painel peguei na net não é meu! addEvent("N3xT.onClickPolicial", true) addEvent("N3xT.onAlgemar", true) addEvent("N3xT.onViatura", true) addEvent("N3xT.onAgarrar", true) addEvent("N3xT.onMultar", true) addEvent("N3xT.ItensPM", true) addEvent("N3xT.takeWeaponPM", true) addEventHandler("N3xT.onClickPolicial", root, function(click) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Policial")) then triggerClientEvent(source, "N3xT.onPainelPolicial", resourceRoot, click) end end ) addEventHandler("N3xT.onAlgemar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not getElementData(receiver, "Algemado") then setElementData(receiver, "Algemado", true) message(source, "O jogador foi algemado.", "success") message(receiver, "Você foi algemado!", "info") else setElementData(receiver, "Algemado", nil) setPedAnimation(receiver, false) message(source, "O jogador foi desalgemado.", "success") message(receiver, "Você foi desalgemado.", "info") end end end ) local carros = {} function salvacarro(vei, assento, vitima) carros[source] = vei end addEventHandler("onPlayerVehicleEnter", root, salvacarro) addEventHandler("N3xT.onViatura", root, function() local receiver = getElementData(source, "ReceiverPM") local vtr = carros[source] if (receiver) and (vtr) then local vrx, vry, vrz = getElementRotation(vtr) local px, py, pz = getElementPosition(vtr) if not getElementData(receiver, "NaViatura") then if not isPedInVehicle(receiver) then setElementData(receiver, "NaViatura", true) message(source, "O jogador foi colocado na viatura.", "success") message(receiver, "Você foi colocado na viatura!", "info") attachElements(receiver, vtr, 0.2, -1.5, 0, 0,0,90) setPedAnimation(receiver, 'ped','CAR_dead_LHS') setElementRotation(receiver, vrx, vry, vrz + 83) end else setElementData(receiver, "NaViatura", nil) message(source, "O jogador foi retirado da viatura.", "success") message(receiver, "Você foi retirado da viatura!", "info") detachElements(receiver, getElementAttachedTo(receiver)) setElementPosition(receiver, px + 2, py + 2, pz) setPedAnimation(receiver) end end end ) addEventHandler("N3xT.onAgarrar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not (getElementData(receiver, "Agarrado") == true) then setElementData(receiver, "Agarrado", true) message(source, "O jogador foi agarrado.", "success") message(receiver, "Você foi agarrado!", "info") attachElements(receiver, source, 0, 1, 0) else setElementData(receiver, "Agarrado", nil) message(source, "O jogador foi desagarrado.", "success") message(receiver, "Você foi desagarrado!", "info") detachElements(receiver, source) end end end ) addEventHandler("N3xT.onMultar", root, function(motivo, valor) local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then local money = getPlayerMoney(receiver) if (money >= tonumber(valor)) then message(source, "A multa foi aplicada com sucesso.", "success") message(receiver, "Você foi multado no valor de #00ff7fR$"..valor.." #ffffffpelo motivo: #a9a9a9"..motivo.."#ffffff.", "info") takePlayerMoney(receiver, tonumber(valor)) else message(source, "O jogador não possuí o valor da multa!", "error") end end end ) addEventHandler("N3xT.ItensPM", root, function(value, item, quantia) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local next = exports.n3xt_inventario if (value == 1) then local itemTable = next:getAllItens(receiver) triggerClientEvent(source, "N3xT.refreshGridItemPM", resourceRoot, itemTable) elseif (value == 2) then next:takeItemS(source, receiver, item, tonumber(quantia)) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) end end end ) addEventHandler("N3xT.takeWeaponPM", root, function(arma) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local id = getWeaponIDFromName(arma) takeWeapon(receiver, id) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) message(source, "A arma foi retirada com sucesso.", "success") message(receiver, "Foi retirado de você a arma #00ff7f"..arma.."#ffffff.", "info") end end ) function message(player, message, type) triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type) end Olá! Qual o lado client do seu mod? por aqui ja consigo fazer, mas ai retornaria erro do click... me manda o lado client que faço Link to comment
ImSoCrzy Posted August 8, 2021 Author Share Posted August 8, 2021 2 hours ago, Blaack said: Olá! Qual o lado client do seu mod? por aqui ja consigo fazer, mas ai retornaria erro do click... me manda o lado client que faço Olá penso que seja isso daqui Na pasta apenas tem MainS.lua (primeiro que mandei) e MainC.lua (esse que tou mandando agora) Muito obrigado pela ajuda! addEvent("N3xT.onPainelPolicial", true) addEvent("N3xT.refreshGridItemPM", true) addEvent("N3xT.setWindowPM", true) local screen = {guiGetScreenSize()} local x, y = (screen[1]/1366), (screen[2]/768) local tecla = "Tab" -- Tecla para fechar o painel. local edit = { guiCreateEdit(x*516, y*309, x*314, y*29, "Motivo", false), guiCreateEdit(x*516, y*381, x*314, y*29, "Valor", false), guiCreateGridList(x*548, y*229, x*253, y*214, false), guiCreateGridList(x*672, y*335, x*130, y*120, false), } guiGridListAddColumn(edit[3], "Item", 0.5) guiGridListAddColumn(edit[3], "Quantidade", 0.4) guiGridListAddColumn(edit[4], "Armas na Mão", 0.8) for i = 1, #edit do guiSetVisible(edit, false) end local visible local pm = function() dxDrawRectangle(x*502, y*161, x*343, y*370, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*502, y*161, x*5, y*370, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*840, y*161, x*5, y*370, tocolor(255, 140, 0, 255), false) dxDrawImage(x*650, y*167, x*57, y*52, "policial.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Pressione "..tecla.." para fechar", x*600, y*538, x*696, y*502, tocolor(255, 255, 255, 150), x*1.2, "arial", "left", "top", false, false, false, false, false) if (window == 1) then dxDrawRectangle(x*517, y*224, x*308, y*41, (isMouseInPosition(x*517, y*224, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*275, x*308, y*41, (isMouseInPosition(x*517, y*275, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*326, x*308, y*41, (isMouseInPosition(x*517, y*326, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*377, x*308, y*41, (isMouseInPosition(x*517, y*377, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*428, x*308, y*41, (isMouseInPosition(x*517, y*428, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*479, x*308, y*41, (isMouseInPosition(x*517, y*479, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*479, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*428, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*377, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*326, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*275, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*224, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*224, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*275, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*326, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*377, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*428, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*479, x*5, y*41, tocolor(255, 140, 0, 255), false) local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then dxDrawText("Revistar", x*653, y*234, x*687, y*245, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) if getElementData(receiver, "Agarrado") then dxDrawText("Desagarrar", x*653, y*284, x*687, y*295, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) else dxDrawText("Agarrar", x*653, y*284, x*687, y*295, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end if getElementData(receiver, "Algemado") then dxDrawText("Desalgemar", x*649, y*335, x*687, y*347, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) else dxDrawText("Algemar", x*649, y*335, x*687, y*347, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end dxDrawText("Remover/Ver Itens", x*615, y*386, x*668, y*398, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) if getElementData(receiver, "NaViatura") then dxDrawText("Retirar da Viatura", x*618, y*437, x*659, y*449, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) else dxDrawText("Colocar na Viatura", x*618, y*437, x*659, y*449, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end dxDrawText("Multar", x*658, y*488, x*696, y*502, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end elseif (window == 2) then local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then local nome = getPlayerName(receiver) local id = getElementData(receiver, "ID") or "N/A" local idade = getElementData(receiver, "AirNew_RG_DataDeNascimento") or "N/A" local rg = getElementData(receiver, "AirNew_PossuiRG") or "Nao" local cnh_a = getElementData(receiver, "PravaA") local cnh_b = getElementData(receiver, "PravaB") local cnh_c = getElementData(receiver, "PravaC") local cnh_d = getElementData(receiver, "PravaD") if (cnh_a) and (cnh_a == true) then cnh_a = "#00ff00Sim" else cnh_a = "#ff0000Não" end if (cnh_b) and (cnh_b == true) then cnh_b = "#00ff00Sim" else cnh_b = "#ff0000Não" end if (cnh_c) and (cnh_c == true) then cnh_c = "#00ff00Sim" else cnh_c = "#ff0000Não" end if (cnh_d) and (cnh_d == true) then cnh_d = "#00ff00Sim" else cnh_d = "#ff0000Não" end dxDrawText(" Dados Pessoais\n\nID: #00ff7f"..id.."#ffffff\n\nNome: "..nome.." #ffffff\n\nIdade: #00ff7f"..idade.."#ffffff\n\nRG: #00ff7f"..rg.."#ffffff\n\nMoto(A): "..cnh_a.."#ffffff\nCarro (B): "..cnh_b.."#ffffff\nCamião (C): "..cnh_c.."#ffffff\nBus (D): "..cnh_d, x*530, y*230, x*729, y*258, tocolor(255, 255, 255, 200), x*1.2, "default", "left", "top", false, false, false, true, false) dxDrawRectangle(x*694, y*466, x*86, y*29, (isMouseInPosition(x*694, y*466, x*86, y*29) and tocolor(125, 38, 205, 200) or tocolor(0, 0, 0, 150)), false) dxDrawText("Retirar", x*716, y*469, x*751, y*480, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) end elseif (window == 3) then local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then dxDrawRectangle(x*636, y*472, x*89, y*29, (isMouseInPosition(x*636, y*472, x*89, y*29) and tocolor(125, 38, 205, 200) or tocolor(0, 0, 0, 150)), false) dxDrawText("Pegar", x*662, y*475, x*697, y*487, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) end elseif (window == 4) then local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then dxDrawText("Preencha o motivo da Multa.", x*579, y*283, x*639, y*299, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) dxDrawText("Preencha o valor da Multa.", x*590, y*358, x*650, y*374, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) dxDrawRectangle(x*620, y*460, x*116, y*34, (isMouseInPosition(x*620, y*460, x*116, y*34) and tocolor(125, 38, 205, 200) or tocolor(0, 0, 0, 150)), false) dxDrawText("Multar", x*658, y*466, x*718, y*482, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) end end end addEventHandler("onClientClick", root, function(button, state, _, _, _, _, _, click) if (button == "left") and (state == "down") then if isElement(click) and (getElementType(click) == "player") then if not isPedInVehicle(localPlayer) then local x, y, z = getElementPosition(localPlayer) local px, py, pz = getElementPosition(click) if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) <= 3) then if not isPedInVehicle(click) and (click ~= localPlayer) then triggerServerEvent("N3xT.onClickPolicial", localPlayer, click) end end end end end end ) addEventHandler("N3xT.onPainelPolicial", root, function(click) if (visible ~= true) then addEventHandler("onClientRender", root, pm) showCursor(true) playSoundFrontEnd(20) setElementData(localPlayer, "ReceiverPM", click) visible = true window = 1 end end ) bindKey(tecla, "down", function() if (visible == true) then removeEventHandler("onClientRender", root, pm) showCursor(false) setElementData(localPlayer, "ReceiverPM", nil) playSoundFrontEnd(8) visible = false for i = 1, #edit do guiSetVisible(edit, false) end end end ) addEventHandler("onClientClick", root, function(button, state) if (button == "left") and (state == "down") then if (visible == true) then if (window == 1) then if isMouseInPosition(x*517, y*326, x*308, y*41) then -- Algemar. setTimer(function() triggerServerEvent("N3xT.onAlgemar", localPlayer) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*428, x*308, y*41) then -- Colocar na viatura. setTimer(function() triggerServerEvent("N3xT.onViatura", localPlayer) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*275, x*308, y*41) then -- Agarrar. setTimer(function() triggerServerEvent("N3xT.onAgarrar", localPlayer) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*224, x*308, y*41) then -- Revistar. setTimer(function() window = 2 updateArmas() guiSetVisible(edit[4], true) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*377, x*308, y*41) then -- Remover itens. setTimer(function() window = 3 triggerServerEvent("N3xT.ItensPM", localPlayer, 1) guiSetVisible(edit[3], true) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*479, x*308, y*41) then -- Multar. setTimer(function() window = 4 guiSetVisible(edit[1], true) guiSetVisible(edit[2], true) playSoundFrontEnd(1) end, 10, 1) end end end end end ) function updateArmas() local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then guiGridListClear(edit[4]) for _, v in ipairs(getPedWeapons(receiver)) do guiGridListAddRow(edit[4], getWeaponNameFromID(v)) end end end addEventHandler("onClientClick", root, function(button, state) if (button == "left") and (state == "down") then if (visible == true) then if (window == 2) then if isMouseInPosition(x*694, y*466, x*86, y*29) then if (guiGridListGetSelectedItem(edit[4]) ~= -1) then local arma = guiGridListGetItemText(edit[4], guiGridListGetSelectedItem(edit[4]), 1) triggerServerEvent("N3xT.takeWeaponPM", localPlayer, arma) else triggerEvent("N3xT.dxNotification", root, "Selecione uma arma!", "error") end end elseif (window == 3) then if isMouseInPosition(x*636, y*472, x*89, y*29) then if (guiGridListGetSelectedItem(edit[3]) ~= -1) then local item = guiGridListGetItemText(edit[3], guiGridListGetSelectedItem(edit[3]), 1) local quantia = guiGridListGetItemText(edit[3], guiGridListGetSelectedItem(edit[3]), 2) triggerServerEvent("N3xT.ItensPM", localPlayer, 2, item, quantia) else triggerEvent("N3xT.dxNotification", root, "Selecione um item!", "error") end end elseif (window == 4) then if isMouseInPosition(x*620, y*460, x*116, y*34) then local motivo = guiGetText(edit[1]) local valor = guiGetText(edit[2]) if (motivo ~= "Motivo") and (motivo ~= "") then if tonumber(valor) and (tonumber(valor) >= 1) then triggerServerEvent("N3xT.onMultar", localPlayer, motivo, valor) else triggerEvent("N3xT.dxNotification", root, "Coloque um valor válido!", "error") end else triggerEvent("N3xT.dxNotification", root, "Coloque um motivo válido!", "error") end end end end end end ) addEventHandler("N3xT.refreshGridItemPM", root, function(itable) if (type(itable) == "table") then guiGridListClear(edit[3]) for _, v in ipairs(itable) do guiGridListAddRow(edit[3], v[1], v[2]) end end end ) addEventHandler("N3xT.setWindowPM", root, function(value) window = value for i = 1, #edit do guiSetVisible(edit, false) end end ) addEventHandler("onClientRender", root, function() local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then if (visible == true) then local x, y, z = getElementPosition(localPlayer) local px, py, pz = getElementPosition(receiver) if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) > 3) then removeEventHandler("onClientRender", root, pm) showCursor(false) setElementData(localPlayer, "ReceiverPM", nil) playSoundFrontEnd(8) visible = false for i = 1, #edit do guiSetVisible(edit, false) end end end end end ) addEventHandler("onClientRender", root, function() for k, v in ipairs(getElementsByType("player")) do if getElementData(v, "Algemado") then local k, anim = getPedAnimation(v) if (anim ~= "gift_give") then setPedAnimation(v, "kissing", "gift_give", 500, true, false, false, true) end setPedAnimationProgress(v, 'gift_give', 0.10) end end end ) addEventHandler("onClientKey", root, function(button) if (button) then if (getElementData(localPlayer, "Algemado") == true) or (getElementData(localPlayer, "NaViatura") == true) then cancelEvent() end end end ) function getPedWeapons(ped) local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons,wep) end end else return false end return playerWeapons end function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end Link to comment
Blaack Posted August 9, 2021 Share Posted August 9, 2021 Bom dia, teste: server-side addEvent("N3xT.onAlgemar", true) addEvent("N3xT.onViatura", true) addEvent("N3xT.onAgarrar", true) addEvent("N3xT.onMultar", true) addEvent("N3xT.ItensPM", true) addEvent("N3xT.takeWeaponPM", true) local comando = "policial" addCommandHandler(comando, function (thePlayer, _, id) local id = tonumber(id) if id then local player = getPlayerByID(id) if player and isElement(player) then local conta = getPlayerAccount(thePlayer) if conta and not isGuestAccount(conta) then local acc = getAccountName(conta) if isObjectInACLGroup("user."..conta, aclGetGroup("Policial")) then triggerClientEvent(thePlayer, "N3xT.onPainelPolicial", resourceRoot, player) end end end end end getPlayerByID = function (id) local pReturn = false for i, v in ipairs(getElementsByType("player")) do local idp = getElementData(v, "ID") or false if idp then if idp == tonumber(id) then pReturn = v end end end return pReturn end addEventHandler("N3xT.onAlgemar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not getElementData(receiver, "Algemado") then setElementData(receiver, "Algemado", true) message(source, "O jogador foi algemado.", "success") message(receiver, "Você foi algemado!", "info") else setElementData(receiver, "Algemado", nil) setPedAnimation(receiver, false) message(source, "O jogador foi desalgemado.", "success") message(receiver, "Você foi desalgemado.", "info") end end end ) local carros = {} function salvacarro(vei, assento, vitima) carros[source] = vei end addEventHandler("onPlayerVehicleEnter", root, salvacarro) addEventHandler("N3xT.onViatura", root, function() local receiver = getElementData(source, "ReceiverPM") local vtr = carros[source] if (receiver) and (vtr) then local vrx, vry, vrz = getElementRotation(vtr) local px, py, pz = getElementPosition(vtr) if not getElementData(receiver, "NaViatura") then if not isPedInVehicle(receiver) then setElementData(receiver, "NaViatura", true) message(source, "O jogador foi colocado na viatura.", "success") message(receiver, "Você foi colocado na viatura!", "info") attachElements(receiver, vtr, 0.2, -1.5, 0, 0,0,90) setPedAnimation(receiver, 'ped','CAR_dead_LHS') setElementRotation(receiver, vrx, vry, vrz + 83) end else setElementData(receiver, "NaViatura", nil) message(source, "O jogador foi retirado da viatura.", "success") message(receiver, "Você foi retirado da viatura!", "info") detachElements(receiver, getElementAttachedTo(receiver)) setElementPosition(receiver, px + 2, py + 2, pz) setPedAnimation(receiver) end end end ) addEventHandler("N3xT.onAgarrar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not (getElementData(receiver, "Agarrado") == true) then setElementData(receiver, "Agarrado", true) message(source, "O jogador foi agarrado.", "success") message(receiver, "Você foi agarrado!", "info") attachElements(receiver, source, 0, 1, 0) else setElementData(receiver, "Agarrado", nil) message(source, "O jogador foi desagarrado.", "success") message(receiver, "Você foi desagarrado!", "info") detachElements(receiver, source) end end end ) addEventHandler("N3xT.onMultar", root, function(motivo, valor) local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then local money = getPlayerMoney(receiver) if (money >= tonumber(valor)) then message(source, "A multa foi aplicada com sucesso.", "success") message(receiver, "Você foi multado no valor de #00ff7fR$"..valor.." #ffffffpelo motivo: #a9a9a9"..motivo.."#ffffff.", "info") takePlayerMoney(receiver, tonumber(valor)) else message(source, "O jogador não possuí o valor da multa!", "error") end end end ) addEventHandler("N3xT.ItensPM", root, function(value, item, quantia) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local next = exports.n3xt_inventario if (value == 1) then local itemTable = next:getAllItens(receiver) triggerClientEvent(source, "N3xT.refreshGridItemPM", resourceRoot, itemTable) elseif (value == 2) then next:takeItemS(source, receiver, item, tonumber(quantia)) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) end end end ) addEventHandler("N3xT.takeWeaponPM", root, function(arma) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local id = getWeaponIDFromName(arma) takeWeapon(receiver, id) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) message(source, "A arma foi retirada com sucesso.", "success") message(receiver, "Foi retirado de você a arma #00ff7f"..arma.."#ffffff.", "info") end end ) function message(player, message, type) triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type) end client-side addEvent("N3xT.onPainelPolicial", true) addEvent("N3xT.refreshGridItemPM", true) addEvent("N3xT.setWindowPM", true) local screen = {guiGetScreenSize()} local x, y = (screen[1]/1366), (screen[2]/768) local tecla = "Tab" -- Tecla para fechar o painel. local edit = { guiCreateEdit(x*516, y*309, x*314, y*29, "Motivo", false), guiCreateEdit(x*516, y*381, x*314, y*29, "Valor", false), guiCreateGridList(x*548, y*229, x*253, y*214, false), guiCreateGridList(x*672, y*335, x*130, y*120, false), } guiGridListAddColumn(edit[3], "Item", 0.5) guiGridListAddColumn(edit[3], "Quantidade", 0.4) guiGridListAddColumn(edit[4], "Armas na Mão", 0.8) for i = 1, #edit do guiSetVisible(edit, false) end local visible local pm = function() dxDrawRectangle(x*502, y*161, x*343, y*370, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*502, y*161, x*5, y*370, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*840, y*161, x*5, y*370, tocolor(255, 140, 0, 255), false) dxDrawImage(x*650, y*167, x*57, y*52, "policial.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Pressione "..tecla.." para fechar", x*600, y*538, x*696, y*502, tocolor(255, 255, 255, 150), x*1.2, "arial", "left", "top", false, false, false, false, false) if (window == 1) then dxDrawRectangle(x*517, y*224, x*308, y*41, (isMouseInPosition(x*517, y*224, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*275, x*308, y*41, (isMouseInPosition(x*517, y*275, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*326, x*308, y*41, (isMouseInPosition(x*517, y*326, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*377, x*308, y*41, (isMouseInPosition(x*517, y*377, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*428, x*308, y*41, (isMouseInPosition(x*517, y*428, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*479, x*308, y*41, (isMouseInPosition(x*517, y*479, x*308, y*41) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 50)), false) dxDrawRectangle(x*517, y*479, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*428, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*377, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*326, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*275, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*517, y*224, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*224, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*275, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*326, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*377, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*428, x*5, y*41, tocolor(255, 140, 0, 255), false) dxDrawRectangle(x*820, y*479, x*5, y*41, tocolor(255, 140, 0, 255), false) local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then dxDrawText("Revistar", x*653, y*234, x*687, y*245, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) if getElementData(receiver, "Agarrado") then dxDrawText("Desagarrar", x*653, y*284, x*687, y*295, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) else dxDrawText("Agarrar", x*653, y*284, x*687, y*295, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end if getElementData(receiver, "Algemado") then dxDrawText("Desalgemar", x*649, y*335, x*687, y*347, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) else dxDrawText("Algemar", x*649, y*335, x*687, y*347, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end dxDrawText("Remover/Ver Itens", x*615, y*386, x*668, y*398, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) if getElementData(receiver, "NaViatura") then dxDrawText("Retirar da Viatura", x*618, y*437, x*659, y*449, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) else dxDrawText("Colocar na Viatura", x*618, y*437, x*659, y*449, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end dxDrawText("Multar", x*658, y*488, x*696, y*502, tocolor(255, 255, 255, 200), x*1.20, "default", "left", "top", false, false, false, false, false) end elseif (window == 2) then local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then local nome = getPlayerName(receiver) local id = getElementData(receiver, "ID") or "N/A" local idade = getElementData(receiver, "AirNew_RG_DataDeNascimento") or "N/A" local rg = getElementData(receiver, "AirNew_PossuiRG") or "Nao" local cnh_a = getElementData(receiver, "PravaA") local cnh_b = getElementData(receiver, "PravaB") local cnh_c = getElementData(receiver, "PravaC") local cnh_d = getElementData(receiver, "PravaD") if (cnh_a) and (cnh_a == true) then cnh_a = "#00ff00Sim" else cnh_a = "#ff0000Não" end if (cnh_b) and (cnh_b == true) then cnh_b = "#00ff00Sim" else cnh_b = "#ff0000Não" end if (cnh_c) and (cnh_c == true) then cnh_c = "#00ff00Sim" else cnh_c = "#ff0000Não" end if (cnh_d) and (cnh_d == true) then cnh_d = "#00ff00Sim" else cnh_d = "#ff0000Não" end dxDrawText(" Dados Pessoais\n\nID: #00ff7f"..id.."#ffffff\n\nNome: "..nome.." #ffffff\n\nIdade: #00ff7f"..idade.."#ffffff\n\nRG: #00ff7f"..rg.."#ffffff\n\nMoto(A): "..cnh_a.."#ffffff\nCarro (B): "..cnh_b.."#ffffff\nCamião (C): "..cnh_c.."#ffffff\nBus (D): "..cnh_d, x*530, y*230, x*729, y*258, tocolor(255, 255, 255, 200), x*1.2, "default", "left", "top", false, false, false, true, false) dxDrawRectangle(x*694, y*466, x*86, y*29, (isMouseInPosition(x*694, y*466, x*86, y*29) and tocolor(125, 38, 205, 200) or tocolor(0, 0, 0, 150)), false) dxDrawText("Retirar", x*716, y*469, x*751, y*480, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) end elseif (window == 3) then local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then dxDrawRectangle(x*636, y*472, x*89, y*29, (isMouseInPosition(x*636, y*472, x*89, y*29) and tocolor(125, 38, 205, 200) or tocolor(0, 0, 0, 150)), false) dxDrawText("Pegar", x*662, y*475, x*697, y*487, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) end elseif (window == 4) then local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then dxDrawText("Preencha o motivo da Multa.", x*579, y*283, x*639, y*299, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) dxDrawText("Preencha o valor da Multa.", x*590, y*358, x*650, y*374, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) dxDrawRectangle(x*620, y*460, x*116, y*34, (isMouseInPosition(x*620, y*460, x*116, y*34) and tocolor(125, 38, 205, 200) or tocolor(0, 0, 0, 150)), false) dxDrawText("Multar", x*658, y*466, x*718, y*482, tocolor(255, 255, 255, 255), x*1.20, "default", "left", "top", false, false, false, false, false) end end end addEventHandler("N3xT.onPainelPolicial", root, function(click) if (visible ~= true) then addEventHandler("onClientRender", root, pm) showCursor(true) playSoundFrontEnd(20) setElementData(localPlayer, "ReceiverPM", click) visible = true window = 1 end end ) bindKey(tecla, "down", function() if (visible == true) then removeEventHandler("onClientRender", root, pm) showCursor(false) setElementData(localPlayer, "ReceiverPM", nil) playSoundFrontEnd(8) visible = false for i = 1, #edit do guiSetVisible(edit, false) end end end ) addEventHandler("onClientClick", root, function(button, state) if (button == "left") and (state == "down") then if (visible == true) then if (window == 1) then if isMouseInPosition(x*517, y*326, x*308, y*41) then -- Algemar. setTimer(function() triggerServerEvent("N3xT.onAlgemar", localPlayer) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*428, x*308, y*41) then -- Colocar na viatura. setTimer(function() triggerServerEvent("N3xT.onViatura", localPlayer) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*275, x*308, y*41) then -- Agarrar. setTimer(function() triggerServerEvent("N3xT.onAgarrar", localPlayer) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*224, x*308, y*41) then -- Revistar. setTimer(function() window = 2 updateArmas() guiSetVisible(edit[4], true) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*377, x*308, y*41) then -- Remover itens. setTimer(function() window = 3 triggerServerEvent("N3xT.ItensPM", localPlayer, 1) guiSetVisible(edit[3], true) playSoundFrontEnd(1) end, 10, 1) elseif isMouseInPosition(x*517, y*479, x*308, y*41) then -- Multar. setTimer(function() window = 4 guiSetVisible(edit[1], true) guiSetVisible(edit[2], true) playSoundFrontEnd(1) end, 10, 1) end end end end end ) function updateArmas() local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then guiGridListClear(edit[4]) for _, v in ipairs(getPedWeapons(receiver)) do guiGridListAddRow(edit[4], getWeaponNameFromID(v)) end end end addEventHandler("onClientClick", root, function(button, state) if (button == "left") and (state == "down") then if (visible == true) then if (window == 2) then if isMouseInPosition(x*694, y*466, x*86, y*29) then if (guiGridListGetSelectedItem(edit[4]) ~= -1) then local arma = guiGridListGetItemText(edit[4], guiGridListGetSelectedItem(edit[4]), 1) triggerServerEvent("N3xT.takeWeaponPM", localPlayer, arma) else triggerEvent("N3xT.dxNotification", root, "Selecione uma arma!", "error") end end elseif (window == 3) then if isMouseInPosition(x*636, y*472, x*89, y*29) then if (guiGridListGetSelectedItem(edit[3]) ~= -1) then local item = guiGridListGetItemText(edit[3], guiGridListGetSelectedItem(edit[3]), 1) local quantia = guiGridListGetItemText(edit[3], guiGridListGetSelectedItem(edit[3]), 2) triggerServerEvent("N3xT.ItensPM", localPlayer, 2, item, quantia) else triggerEvent("N3xT.dxNotification", root, "Selecione um item!", "error") end end elseif (window == 4) then if isMouseInPosition(x*620, y*460, x*116, y*34) then local motivo = guiGetText(edit[1]) local valor = guiGetText(edit[2]) if (motivo ~= "Motivo") and (motivo ~= "") then if tonumber(valor) and (tonumber(valor) >= 1) then triggerServerEvent("N3xT.onMultar", localPlayer, motivo, valor) else triggerEvent("N3xT.dxNotification", root, "Coloque um valor válido!", "error") end else triggerEvent("N3xT.dxNotification", root, "Coloque um motivo válido!", "error") end end end end end end ) addEventHandler("N3xT.refreshGridItemPM", root, function(itable) if (type(itable) == "table") then guiGridListClear(edit[3]) for _, v in ipairs(itable) do guiGridListAddRow(edit[3], v[1], v[2]) end end end ) addEventHandler("N3xT.setWindowPM", root, function(value) window = value for i = 1, #edit do guiSetVisible(edit, false) end end ) addEventHandler("onClientRender", root, function() local receiver = getElementData(localPlayer, "ReceiverPM") if (receiver) then if (visible == true) then local x, y, z = getElementPosition(localPlayer) local px, py, pz = getElementPosition(receiver) if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) > 3) then removeEventHandler("onClientRender", root, pm) showCursor(false) setElementData(localPlayer, "ReceiverPM", nil) playSoundFrontEnd(8) visible = false for i = 1, #edit do guiSetVisible(edit, false) end end end end end ) addEventHandler("onClientRender", root, function() for k, v in ipairs(getElementsByType("player")) do if getElementData(v, "Algemado") then local k, anim = getPedAnimation(v) if (anim ~= "gift_give") then setPedAnimation(v, "kissing", "gift_give", 500, true, false, false, true) end setPedAnimationProgress(v, 'gift_give', 0.10) end end end ) addEventHandler("onClientKey", root, function(button) if (button) then if (getElementData(localPlayer, "Algemado") == true) or (getElementData(localPlayer, "NaViatura") == true) then cancelEvent() end end end ) function getPedWeapons(ped) local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons,wep) end end else return false end return playerWeapons end function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end @Im_PlayerGTA Link to comment
ImSoCrzy Posted August 9, 2021 Author Share Posted August 9, 2021 29 minutes ago, Blaack said: @Im_PlayerGTA Bom Dia Está a dar este erro ao iniciar a resource, fica o painel bugado e aparece esse erros no debugscript @Blaack Link to comment
Blaack Posted August 9, 2021 Share Posted August 9, 2021 1 hour ago, Im_PlayerGTA said: Bom Dia Está a dar este erro ao iniciar a resource, fica o painel bugado e aparece esse erros no debugscript @Blaack addEvent("N3xT.onAlgemar", true) addEvent("N3xT.onViatura", true) addEvent("N3xT.onAgarrar", true) addEvent("N3xT.onMultar", true) addEvent("N3xT.ItensPM", true) addEvent("N3xT.takeWeaponPM", true) local comando = "policial" addCommandHandler(comando, function (thePlayer, _, id) local id = tonumber(id) if id then local player = getPlayerByID(id) if player and isElement(player) then local conta = getPlayerAccount(thePlayer) if conta and not isGuestAccount(conta) then local acc = getAccountName(conta) if isObjectInACLGroup("user."..conta, aclGetGroup("Policial")) then triggerClientEvent(thePlayer, "N3xT.onPainelPolicial", resourceRoot, player) end end end end end) getPlayerByID = function (id) local pReturn = false for i, v in ipairs(getElementsByType("player")) do local idp = getElementData(v, "ID") or false if idp then if idp == tonumber(id) then pReturn = v end end end return pReturn end addEventHandler("N3xT.onAlgemar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not getElementData(receiver, "Algemado") then setElementData(receiver, "Algemado", true) message(source, "O jogador foi algemado.", "success") message(receiver, "Você foi algemado!", "info") else setElementData(receiver, "Algemado", nil) setPedAnimation(receiver, false) message(source, "O jogador foi desalgemado.", "success") message(receiver, "Você foi desalgemado.", "info") end end end ) local carros = {} function salvacarro(vei, assento, vitima) carros[source] = vei end addEventHandler("onPlayerVehicleEnter", root, salvacarro) addEventHandler("N3xT.onViatura", root, function() local receiver = getElementData(source, "ReceiverPM") local vtr = carros[source] if (receiver) and (vtr) then local vrx, vry, vrz = getElementRotation(vtr) local px, py, pz = getElementPosition(vtr) if not getElementData(receiver, "NaViatura") then if not isPedInVehicle(receiver) then setElementData(receiver, "NaViatura", true) message(source, "O jogador foi colocado na viatura.", "success") message(receiver, "Você foi colocado na viatura!", "info") attachElements(receiver, vtr, 0.2, -1.5, 0, 0,0,90) setPedAnimation(receiver, 'ped','CAR_dead_LHS') setElementRotation(receiver, vrx, vry, vrz + 83) end else setElementData(receiver, "NaViatura", nil) message(source, "O jogador foi retirado da viatura.", "success") message(receiver, "Você foi retirado da viatura!", "info") detachElements(receiver, getElementAttachedTo(receiver)) setElementPosition(receiver, px + 2, py + 2, pz) setPedAnimation(receiver) end end end ) addEventHandler("N3xT.onAgarrar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not (getElementData(receiver, "Agarrado") == true) then setElementData(receiver, "Agarrado", true) message(source, "O jogador foi agarrado.", "success") message(receiver, "Você foi agarrado!", "info") attachElements(receiver, source, 0, 1, 0) else setElementData(receiver, "Agarrado", nil) message(source, "O jogador foi desagarrado.", "success") message(receiver, "Você foi desagarrado!", "info") detachElements(receiver, source) end end end ) addEventHandler("N3xT.onMultar", root, function(motivo, valor) local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then local money = getPlayerMoney(receiver) if (money >= tonumber(valor)) then message(source, "A multa foi aplicada com sucesso.", "success") message(receiver, "Você foi multado no valor de #00ff7fR$"..valor.." #ffffffpelo motivo: #a9a9a9"..motivo.."#ffffff.", "info") takePlayerMoney(receiver, tonumber(valor)) else message(source, "O jogador não possuí o valor da multa!", "error") end end end ) addEventHandler("N3xT.ItensPM", root, function(value, item, quantia) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local next = exports.n3xt_inventario if (value == 1) then local itemTable = next:getAllItens(receiver) triggerClientEvent(source, "N3xT.refreshGridItemPM", resourceRoot, itemTable) elseif (value == 2) then next:takeItemS(source, receiver, item, tonumber(quantia)) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) end end end ) addEventHandler("N3xT.takeWeaponPM", root, function(arma) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local id = getWeaponIDFromName(arma) takeWeapon(receiver, id) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) message(source, "A arma foi retirada com sucesso.", "success") message(receiver, "Foi retirado de você a arma #00ff7f"..arma.."#ffffff.", "info") end end ) function message(player, message, type) triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type) end Tinha esquecido de um parentese... @Im_PlayerGTA Link to comment
ImSoCrzy Posted August 9, 2021 Author Share Posted August 9, 2021 (edited) 15 minutes ago, Blaack said: addEvent("N3xT.onAlgemar", true) addEvent("N3xT.onViatura", true) addEvent("N3xT.onAgarrar", true) addEvent("N3xT.onMultar", true) addEvent("N3xT.ItensPM", true) addEvent("N3xT.takeWeaponPM", true) local comando = "policial" addCommandHandler(comando, function (thePlayer, _, id) local id = tonumber(id) if id then local player = getPlayerByID(id) if player and isElement(player) then local conta = getPlayerAccount(thePlayer) if conta and not isGuestAccount(conta) then local acc = getAccountName(conta) if isObjectInACLGroup("user."..conta, aclGetGroup("Policial")) then triggerClientEvent(thePlayer, "N3xT.onPainelPolicial", resourceRoot, player) end end end end end) getPlayerByID = function (id) local pReturn = false for i, v in ipairs(getElementsByType("player")) do local idp = getElementData(v, "ID") or false if idp then if idp == tonumber(id) then pReturn = v end end end return pReturn end addEventHandler("N3xT.onAlgemar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not getElementData(receiver, "Algemado") then setElementData(receiver, "Algemado", true) message(source, "O jogador foi algemado.", "success") message(receiver, "Você foi algemado!", "info") else setElementData(receiver, "Algemado", nil) setPedAnimation(receiver, false) message(source, "O jogador foi desalgemado.", "success") message(receiver, "Você foi desalgemado.", "info") end end end ) local carros = {} function salvacarro(vei, assento, vitima) carros[source] = vei end addEventHandler("onPlayerVehicleEnter", root, salvacarro) addEventHandler("N3xT.onViatura", root, function() local receiver = getElementData(source, "ReceiverPM") local vtr = carros[source] if (receiver) and (vtr) then local vrx, vry, vrz = getElementRotation(vtr) local px, py, pz = getElementPosition(vtr) if not getElementData(receiver, "NaViatura") then if not isPedInVehicle(receiver) then setElementData(receiver, "NaViatura", true) message(source, "O jogador foi colocado na viatura.", "success") message(receiver, "Você foi colocado na viatura!", "info") attachElements(receiver, vtr, 0.2, -1.5, 0, 0,0,90) setPedAnimation(receiver, 'ped','CAR_dead_LHS') setElementRotation(receiver, vrx, vry, vrz + 83) end else setElementData(receiver, "NaViatura", nil) message(source, "O jogador foi retirado da viatura.", "success") message(receiver, "Você foi retirado da viatura!", "info") detachElements(receiver, getElementAttachedTo(receiver)) setElementPosition(receiver, px + 2, py + 2, pz) setPedAnimation(receiver) end end end ) addEventHandler("N3xT.onAgarrar", root, function() local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then if not (getElementData(receiver, "Agarrado") == true) then setElementData(receiver, "Agarrado", true) message(source, "O jogador foi agarrado.", "success") message(receiver, "Você foi agarrado!", "info") attachElements(receiver, source, 0, 1, 0) else setElementData(receiver, "Agarrado", nil) message(source, "O jogador foi desagarrado.", "success") message(receiver, "Você foi desagarrado!", "info") detachElements(receiver, source) end end end ) addEventHandler("N3xT.onMultar", root, function(motivo, valor) local receiver = getElementData(source, "ReceiverPM") if (receiver) and not isPedInVehicle(receiver) then local money = getPlayerMoney(receiver) if (money >= tonumber(valor)) then message(source, "A multa foi aplicada com sucesso.", "success") message(receiver, "Você foi multado no valor de #00ff7fR$"..valor.." #ffffffpelo motivo: #a9a9a9"..motivo.."#ffffff.", "info") takePlayerMoney(receiver, tonumber(valor)) else message(source, "O jogador não possuí o valor da multa!", "error") end end end ) addEventHandler("N3xT.ItensPM", root, function(value, item, quantia) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local next = exports.n3xt_inventario if (value == 1) then local itemTable = next:getAllItens(receiver) triggerClientEvent(source, "N3xT.refreshGridItemPM", resourceRoot, itemTable) elseif (value == 2) then next:takeItemS(source, receiver, item, tonumber(quantia)) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) end end end ) addEventHandler("N3xT.takeWeaponPM", root, function(arma) local receiver = getElementData(source, "ReceiverPM") if (receiver) then local id = getWeaponIDFromName(arma) takeWeapon(receiver, id) triggerClientEvent(source, "N3xT.setWindowPM", resourceRoot, 1) message(source, "A arma foi retirada com sucesso.", "success") message(receiver, "Foi retirado de você a arma #00ff7f"..arma.."#ffffff.", "info") end end ) function message(player, message, type) triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type) end Tinha esquecido de um parentese... @Im_PlayerGTA Certo, resolveu a parte do erro a vermelho, porem ainda tem o menu bugado quando inicia a resource penso que seja algo no client Tentei dar o comando /policial (id) e apareceu outro erro @Blaack Edited August 9, 2021 by Im_PlayerGTA Link to comment
ImSoCrzy Posted August 9, 2021 Author Share Posted August 9, 2021 32 minutes ago, Im_PlayerGTA said: Certo, resolveu a parte do erro a vermelho, porem ainda tem o menu bugado quando inicia a resource penso que seja algo no client Tentei dar o comando /policial (id) e apareceu outro erro @Blaack @Blaack Já consegui alterei umas coisas no MainS.lua e coloquei o MainC.Lua original e funcionou, mas obrigado pela ajuda se não fosse voce nao tinha conseguido Obrigado! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now