Jump to content

SrPattif

Members
  • Posts

    74
  • Joined

  • Last visited

About SrPattif

  • Birthday 18/07/2001

Details

  • Location
    Brazil

Recent Profile Visitors

1,066 profile views

SrPattif's Achievements

Transformer

Transformer (11/54)

16

Reputation

  1. Salve. Tenho um sistema de mostrar os FPS's na tela, que utiliza o onClientRender() pra atualizar, mas ele atualiza muito rápido* e nem da pra ver o FPS, por que ele fica variando entre 59~60~61, e não fica muito legível. Existe alguma forma para definir o tempo para os FPS's atualizarem? Algo como 1 vez por segundo ou algo assim... Pensei em setTimer, mas não consegui... Código: local fps = 0 function getCurrentFPS() return fps end local function updateFPS(msSinceLastFrame) fps = (1 / msSinceLastFrame) * 1000 end addEventHandler("onClientPreRender", root, updateFPS) function screenFPS() fps = math.floor(fps) local enviado = getNetworkStats().packetsSent local recebido = getNetworkStats().packetsReceived local packetLoss = getNetworkStats().packetlossTotal local mostrar = getElementData(localPlayer, "hud:informacoes") if mostrar == nil then setElementData(localPlayer, "hud:informacoes", true) end if mostrar == true then dxDrawText("FPS: "..fps, (screenW * 0.1555) - 1, (screenH * 0.0362) - 1, (screenW * 0.1992) - 1, (screenH * 0.0537) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("FPS: "..fps, (screenW * 0.1555) + 1, (screenH * 0.0362) - 1, (screenW * 0.1992) + 1, (screenH * 0.0537) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("FPS: "..fps, (screenW * 0.1555) - 1, (screenH * 0.0362) + 1, (screenW * 0.1992) - 1, (screenH * 0.0537) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("FPS: "..fps, (screenW * 0.1555) + 1, (screenH * 0.0362) + 1, (screenW * 0.1992) + 1, (screenH * 0.0537) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("FPS: "..fps, screenW * 0.1555, screenH * 0.0362, screenW * 0.1992, screenH * 0.0537, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("PING: "..getPlayerPing(localPlayer), (screenW * 0.1977) - 1, (screenH * 0.0362) - 1, (screenW * 0.2414) - 1, (screenH * 0.0537) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("PING: "..getPlayerPing(localPlayer), (screenW * 0.1977) + 1, (screenH * 0.0362) - 1, (screenW * 0.2414) + 1, (screenH * 0.0537) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("PING: "..getPlayerPing(localPlayer), (screenW * 0.1977) - 1, (screenH * 0.0362) + 1, (screenW * 0.2414) - 1, (screenH * 0.0537) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("PING: "..getPlayerPing(localPlayer), (screenW * 0.1977) + 1, (screenH * 0.0362) + 1, (screenW * 0.2414) + 1, (screenH * 0.0537) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("PING: "..getPlayerPing(localPlayer), screenW * 0.1977, screenH * 0.0362, screenW * 0.2414, screenH * 0.0537, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) end end addEventHandler ( "onClientRender", root, screenFPS ) Quem puder ajudar, ficaria grato.
  2. O que eu fiz: Ao lado CLIENTE, ele faz a solicitação da tabela getResources() via triggerServerEvent. Ao lado SERVIDOR, depois que o triggerServerEvent foi chamado, ele faz um triggerClientEvent, retornando nele, a tabela do getResources()
  3. This helped me, but it only shows the scripts already initialized. -- client-side function carregarResources() local resourceRoots = getElementsByType("resource") for i=1, #resourceRoots do local thisResourceRoot = resourceRoots[i] local resourceName = getElementID ( thisResourceRoot ) if resourceName then local res = getResourceFromName(resourceName) if res and res ~= resource then guiGridListAddRow(GUI.gridlist[1], getResourceName(res)) end end end end
  4. Hi. I had this script via server-side: -- server_side for i,v in ipairs(resourceTable) do print(getResourceName(v)) end server-side, works normally. But in client-side, it does not work. It just dont print nothing. -/> i got the resources table via triggerServerEvent, and the type() of the response via client-side is really table. if you can help, I would be grateful.
  5. Sei da existência, mas gostaria de fazer um painel mais adaptativo, e que pessoas específicas tenham acesso á inicialização de scripts SEM a necessidade do cargo Admin. Como eu disse, se simplesmente puder ajudar, ficaria grato.
  6. Salve. Queria adicionar row's á uma GridList com todos os resources. Tentei isso: -- server_side function abrirPainel(thePlayer) local resources = getResources() triggerClientEvent ( thePlayer, "abrirP", thePlayer, resources ) end addCommandHandler("resources", abrirPainel) -- client_side aberto = false; GUI = { gridlist = {}, window = {}, button = {}, label = {} } local screenW, screenH = guiGetScreenSize() GUI.window[1] = guiCreateWindow((screenW - 567) / 2, (screenH - 311) / 2, 567, 311, "RESOURCE MANAGEMENT", false) guiWindowSetSizable(GUI.window[1], false) guiSetProperty(GUI.window[1], "CaptionColour", "FF1DA7E1") GUI.gridlist[1] = guiCreateGridList(38, 39, 379, 250, false, GUI.window[1]) guiGridListAddColumn(GUI.gridlist[1], "RESOURCE", 1) GUI.button[1] = guiCreateButton(427, 111, 126, 21, "INICIAR", false, GUI.window[1]) guiSetProperty(GUI.button[1], "NormalTextColour", "FFFFFFFF") GUI.button[2] = guiCreateButton(427, 142, 126, 21, "REINICIAR", false, GUI.window[1]) guiSetProperty(GUI.button[2], "NormalTextColour", "FFFFFFFF") GUI.button[3] = guiCreateButton(427, 173, 126, 21, "PARAR", false, GUI.window[1]) guiSetProperty(GUI.button[3], "NormalTextColour", "FFFFFFFF") GUI.label[1] = guiCreateLabel(38, 26, 379, 13, "CARREGANDO RESOURCES", false, GUI.window[1]) guiLabelSetHorizontalAlign(GUI.label[1], "center", false) guiLabelSetVerticalAlign(GUI.label[1], "center") GUI.button[4] = guiCreateButton(427, 264, 126, 21, "ATUALIZAR LISTA", false, GUI.window[1]) guiSetProperty(GUI.button[4], "NormalTextColour", "FFA9A9A9") guiSetVisible(GUI.window[1], false) function abrir(tabela) if aberto == false then guiSetVisible(GUI.window[1], true) guiSetText(GUI.label[1], "CARREGANDO RESOURCES") carregarResources(tabela) showCursor(true) aberto = true else guiSetVisible(GUI.window[1], false) showCursor(false) aberto = false end end addEvent( "abrirP", true ) addEventHandler( "abrirP", localPlayer, abrir ) function carregarResources(tabelaDeResources) for resourceKey, resourceValue in ipairs(tabelaDeResources) do local name = getResourceName(resourceValue) guiGridListAddRow(GUI.gridlist[1], name) end end Não apresenta nenhum erro, só não adiciona os resources. Grato se puderem ajudar...
  7. Hi. I want to make a invisible window, but the window's parents needs to be visible. Example The label "SEU VOTO PARA PRESIDENTE" is a GUI Parent. I want to make the GUI invisible, but the label still visible. If you can help, I will be very gratefull
  8. Salve. Queria saber como posso definir a posição de um botão e de uma label de acordo com uma imagem de background. Por exemplo: Tem uma imagem dx de uma interface de uma Urna Eletrônica no fundo. Gostaria de colocar a label GUI em uma posição de código que fique na posição correta em relação á imagem. Tive a ideia de criar uma janela GUI na frente da imagem, centralizar a imagem e o GUI e colocar os botões e label dentro desse GUI, mas quando defino o alpha desse GUI para deixar ele invisível, todos os parentes do GUI adquirem a mesma propriedade. Ou seja, os botões e labels ficam invisíveis também. Poderiam me ajudar? Imagem:
  9. Opa, tudo bom? Vim traduzir um tutorial gringo que foi criado aqui no forum do MTA mesmo pois achei interessante. Ele basicamente envia mensagens do seu servidor até algum canal do Discord. *todos os passos possuem uma imagem para auxiliar. Clique no spoiler para vê-la. PASSO 1: Para que o script envie mensagens para o Discord, iremos utilizar um WebHook. Comece criando um. (Botão direito no canal > Editar Canal > Integrações > Webhooks > Novo Webhook) PASSO 2: Insira as informações do WebHook (nome e canal) e clique em Copiar URL do webhook PASSO 3: Efetue o download do script e coloque-o em seu servidor. Download Clique em Code > Download ZIP PASSO 4: Ele irá fazer o Download de um arquivo chamado mtasa-dcwebhook-master.zip Utilizando o WinRar, clique com o botão direito e clique em Extrair Aqui. Renomeie a pasta que foi extraída para webhook PASSO 5: Abra a pasta webhook e edite o arquivo webhookS.lua Na parte superior, altere "url" pelo seu link do webhook. Lembre-se de mantê-lo entre aspas. PASSO 6: Salve o arquivo que editou, feche-o, e mova a pasta para os arquivos do seu servidor. Pronto Agora você pode enviar mensagens para o Discord usando outro script ou utilizando /dcmessage. Método para utilizar em outro script: exports.webhook:sendDiscordMessage("seu texto") É possível que você precise declarar a versão no meta.xml. Para isso, abra o meta.xml do webhook e altere para: <meta> <info author="MrZsemle" name="Discord webhook messages" /> <script src="webhookS.lua"/> <min_mta_version client="1.5.4" server="1.5.4-9.11413"/> <export function="sendDiscordMessage" type="server" /> </meta> Créditos: Tradução e Postagem em Português: SrPattif Postagem em Inglês: MrZsemle Desenvolvedor do Script: MrZsemle
  10. Creio que o tópico que deveria utilizar é "Programação em Lua" https://forum.multitheftauto.com/forum/127-programação-em-lua/ Quando á sua dúvida. Você pode utilizar dxDrawImage() combinado com guiGetScreenSize(). Isso depende do tamanho da sua imagem.
  11. Jesus, deixa eu ver se eu entendi: Aos na acl "Ilegal": pode assaltar, mas não recebe a notificação Aos na acl "policial": não pode assaltar e recebe a notificação Isso? Tente deixar a sua dúvida / problema de uma forma mais explicativa da próxima vez
  12. Então o jogador que executou escuta, e os próximos não? Se sim, descarta a possibilidade do arquivo simplesmente não conter nenhum audio (um áudio silencioso) Se não, verifique se o arquivo .mp3 realmente contém um áudio.
  13. Se ainda precisar, pode utilizar, ao invés de "fivem://connect/IPDOSERVIDOR": mtasa://IP:PORTA
  14. Nome, você diz, o nick do MTA ou o nome dele em RolePlay? Se for do MTA, você pode criar um evento de quando ele alterar o nick (onPlayerChangeNick), ele salva alguma informação na conta dele (setAccountData) dizendo que o nick já foi alterado. Algo assim: -- server-side function aoTrocarNick(oldNick, newNick) local acc = getPlayerAccount(source) if getAccountData(acc, "trocouNick") == true then -- // COLOQUE SEU CÓDIGO PARA QUANDO O NICK FOI ALTERADO MAIS DE UMA VEZ -- // PODE UTILIZAR UM outputChatBox() OU ALGUMA NOTIFICAÇÃO PERSONALIZADA cancelEvent() else setAccountData(acc, "trocouNick", true) end end addEventHandler("onPlayerChangeNick", getRootElement(), aoTrocarNick) Espero ter te ajudado
  15. Este script está rodando server-side ou client-side? Pois o método playSound3D só funciona client-side... Além disso, algum erro aparece no console ou utilizando /debugscript 3?
×
×
  • Create New...