Jump to content

RomanDev

Members
  • Posts

    12
  • Joined

  • Last visited

About RomanDev

  • Birthday 21/12/2004

Details

  • Gang
    I don't have a gang.
  • Location
    Brazil
  • Occupation
    Developer
  • Interests
    Helping developers who have questions on the forum

Recent Profile Visitors

477 profile views

RomanDev's Achievements

Square

Square (6/54)

1

Reputation

  1. Eaeee, para isso você poderia utilizar element-data que facilitaria o seu processo de criação. Utilize do exemplo abaixo para a criação do seu sistema; function bate_ponto(player) if (isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(player))), aclGetGroup("Permissão Necessária"))) then if (not getElementData(player, "bate_ponto")) then outputChatBox("Você entrou em serviço!", player); setElementData(player, "bate_ponto", true); else outputChatBox("Você saiu de serviço!", player); removeElementData(player, "bate_ponto"); end else outputChatBox("Sem permissão!", player); end end addCommandHandler("bateponto", bate_ponto);
  2. Obrigado pela crítica, irei estudar mais sobre o assunto antes de fazer algum post no fórum! Obrigado pela crítica, eu já fiz as alterações no meu post!
  3. dxDrawImageSection Para quem tem dúvidas sobre o dxDrawImageSection, leia esse mini tutorial! (Espero que ajude algum desenvolvedor) Argumentos Obrigatórios: 1º PosX da sua Imagem 2º PosY da sua Imagem 3º Largura da sua Imagem 4º Altura da sua Imagem 5º Posição absoluta do canto superior esquerdo (não entendi muito bem isso) 6º Posição absoluta do canto superior esquerdo (não entendi muito bem isso) 7º Largura da sua Imagem 8º Altura da sua Imagem 9º O caminho de sua imagem Como utilizar? Para utilizar, veja os exemplos abaixo! (Eu vou fazer como se fosse em uma hud, para ficar mais fácil) local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1360), (screenH/768) function onHudPanel() dxDrawImageSection(x * 800, y * 400, x * 400 * (math.floor(getElementHealth(localPlayer)/100)), y * 80, 0, 0, x * 400 * (math.floor(getElementHealth(localPlayer)/100)), y * 80, "assets/imgs/progress_health.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) --[[ Acima, o código vai renderizar a imagem em horizontal! Para colocar em vertical, é só mudar o "* (math.floor(getElementHealth(localPlayer)/100))" para a altura da imagem (4º e 8º argumento do código)! --]] end OBs: A função "math.floor" retorna um número inteiro (ele arredonda o valor passado para baixo) | Exemplo: local numero = 34.3434453452345 print(math.floor(numero)) Resultado: 34 Caso haja dúvidas, me chame no Discord ou em meu Privado do fórum!
  4. Olá novamente, desculpe-me pelo meu erro acima! Eu acho que consegui entender o que você precisa, sendo assim eu fiz outro código (baseado no seu) com algumas funções a mais. function getNearestVehicle(player, distance) local lastMinDis = distance - 0.0001 local nearestVeh = false local px, py, pz = getElementPosition(player) local pint = getElementInterior(player) local pdim = getElementDimension(player) for _, v in pairs(getElementsByType("vehicle")) do local vint, vdim = getElementInterior(v), getElementDimension(v) if vint == pint and vdim == pdim then local vx,vy,vz = getElementPosition(v) local dis = getDistanceBetweenPoints3D(px, py, pz, vx, vy, vz) if dis <= distance then if dis <= lastMinDis then lastMinDis = dis nearestVeh = v end end end end return nearestVeh end local gpStaff = "Staff" function detachVehicle(player) if (isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(player))), aclGetGroup(gpStaff))) then local pPos = {getElementPosition(player)} -- Posição do player local pVeh = getNearestVehicle(player, 3) -- Todos os veículos até 3 metros de você local pMarker = createMarker(pPos[1], pPos[2], pPos[3], "cylinder", 1.5, 255, 255, 0, 180) attachElements(pMarker, player, 0, 0, -1) setTimer( function() destroyElement(pMarker) end , 2000, 1) if (pVeh and isElement(pVeh)) then if (not getElementData(player, "vehMarkerHited")) then outputChatBox("pegou") attachElements(pVeh, player) setVehicleDamageProof(pVeh, true) setElementData(player, "vehMarkerHited", true) else outputChatBox("soltou") setVehicleDamageProof(pVeh, false) setElementData(player, "vehMarkerHited", false) if (isElementAttached(pVeh)) then detachElements(pVeh, player) end end end end end addCommandHandler("t", detachVehicle) Espero que te ajude!
  5. Já tentou utilizar o attachElements? addCommandHandler("car", function(player) local pPos = {getElementPosition(player)} local pRot = {getElementRotation(player)} local pVeh = createVehicle(429, pPos[1], pPos[2], pPos[3], 0, 0, pRot[3]) attachElements(pVeh, player, 0, 0, 0) end ) Ou, caso queira verificar se o carro próximo está com o attachsElements, use: isElementAttached: addCommandHandler("proxcar", function(player) local pPos = {getElementPosition(player)} for _, vehicle in ipairs(getElementsByType("vehicle")) do local vPos = {getElementPosition(vehicle)} if (getDistanceBetweenPoints3D(pPos[1], pPos[2], pPos[3], vPos[1], vPos[2], vPos[3]) <= 3) then if (isElementAttached(vehicle)) then print("O veículo está atachado.") else print("Não está atachado!") end end end end )
  6. Ok, sorry! Code in JS: const {exec} = require("child_process"); var readline = require('readline'); var leitor = readline.createInterface({ input: process.stdin, output: process.stdout }); leitor.question("Arquivo para ser compilado: ", function(answer) { exec(`curl.exe -s -X POST -F compile=1 -F debug=0 -F obfuscate=3 -F luasource=@${answer} http://luac.multitheftauto.com/ > compiled.lua`, (error,data,getter) =>{ if(error){ console.log("error", error.message) return; } if(getter){ console.log("data",data) } console.log("Arquivo compilado com sucesso!") }) leitor.close(); });
  7. Hello Mature, I didn't quite understand your question, but I think you want to use the luac API, correct? Have you seen this example that is attached to the API (https://luac.multitheftauto.com/api/)? local TO = "compiled.lua" local FROM = "example.lua" fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&obfuscate=3", function(data) fileSave(TO, data) end, fileLoad(FROM), true) OR function obfuscateScript(rOne, rTwo) if (rOne and rTwo) then if (isObjectInACLGroup("resource."..getResourceName(getThisResource()), aclGetGroup("Admin"))) then fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&obfuscate=3", function() fileSave(rTwo, data) end , fileLoad(rOne), true) print("The script has been compiled!") else print("I don't have permissions.") end end end
  8. Okay, sorry! New code: -- Server-Side addEvent("dataClient:CameraMatrix", true) addEventHandler("dataClient:CameraMatrix", root, function(data) outputChatBox("The player camera matrix is: [1] x = "..(data[1])..", y = "..(data[2])..", z = "..(data[3]).." [2] x = "..(data[4])..", y = "..(data[5])..", z = "..(data[6]).." [3] x = "..(data[7])..", y = "..(data[8]), source) end ) -- Client-Side function getPlayerFromID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end addCommandHandler("getcam", function(_, id) if (tonumber(id)) then local playerID = getPlayerFromID(id) if (playerID) then local cameraMatrix = {getCameraMatrix(playerID)} triggerServerEvent("dataClient:CameraMatrix", localPlayer, cameraMatrix) else outputChatBox("The player is not online", localPlayer) end else outputChatBox("You did not enter the id", localPlayer) end end )
  9. Did you know that getCameraMatrix is shared? So you could do it on the server side... function getPlayerFromID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end addCommandHandler("getcam", function(player, _, id) if (tonumber(id)) then local playerID = getPlayerFromID(id) if (playerID) then local cameraMatrix = {getCameraMatrix(playerID)} outputChatBox("The player's camera matrix is: [1] x = "..(cameraMatrix[1])..", y = "..(cameraMatrix[2])..", z = "..(cameraMatrix[3]).." [2] x = "..(cameraMatrix[4])..", y = "..(cameraMatrix[5])..", z = "..(cameraMatrix[6]).." [3] x = "..(cameraMatrix[7])..", y = "..(cameraMatrix[8]), player) else outputChatBox("The player is not online", player) end else outputChatBox("You did not enter the id", player) end end ) I think it's something like this! I hope this helps.
×
×
  • Create New...