Jump to content

iDannz

Helpers
  • Posts

    13
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by iDannz

  1. MTA:SA API SOURCE CODE AND DOCS Why I created this API? As MTA doesn't have a proper API to fetch server information, I decided to create it by myself, because its being requested by the community for a long time. What are the endpoints available? GET https://mtasa-api.com/servers GET https://mtasa-api.com/stats GET https://mtasa-api.com/server/?ip=SERVER_IP&asePort=SERVER_ASE_PORT Note: Check the complete docs. Note: This is a unofficial API, which means it's not maintained by the MTA Team. Special Thanks: The MTA Team for maintaining this great game. @TEDERIs for the ase2json repository.
  2. Hello Captain07, how are you? First, you will have to configure a web-api (or use other common services like mailchimp or sendinblue) that will handle the requests, and then you will have to use fetchRemote (server-side) to tell the API to send the email using the parameters sent by your mta server. If you want to set up your own email service, I would recommend the PHP's own email sending, or if you are more familiar with javascript using node, you can use a module called "nodemailer" (there may be several other modules, but IHMO this is the best) Anyway, there are several tutorials on the internet on how to create a mail server, it might be worth learning, good luck.
  3. iDannz

    help !

    Hello HermitJr First you must make sure that the ports are really open. (you can use the "openports" command on the server console or use this website: https://nightly.multitheftauto.com/ports) If the result is positive and your server still does not appear in the list, try using another server name to test. (apparently, some server names can contain prohibited (or reserved) words and may cause the server not to appear in the list) If the result is negative, read this page carefully: Also, keep in mind that the master list takes a while to update, so if it's your first time opening the server, it's normal to take a few hours for your server to appear in the list.
  4. Hello Currently you can use the resource `object_preview`. Wiki page: <https://wiki.multitheftauto.com/wiki/Resource:Object_preview> Community page: <https://community.multitheftauto.com/index.php?p=resources&s=details&id=11836>
  5. Go to your server's resources folder, delete the `editor_dump` folder and try again If the problem persists, download the latest resources version (here), paste it into your server's resources folder (replace the old files) and try again
  6. Eai, tudo certo? Existem diversas maneiras de atingir esse objetivo, vou tentar te explicar a maneira que eu usaria. Na resource em que você faz a troca de linguagens: -- Adicione um evento, que será chamado sempre que houver mudança na seleção de idioma addEvent('onChangeLanguage', true) -- Adicione alguma maneira de trocar o idioma enquanto joga, já que no seu caso ele só está sendo setado entrar no jogo -- Por exemplo: ao clicar em um combobox de seleção de linguagens, chame a funçao abaixo SetNewLanguage = function(newLang) setElementData(localPlayer, 'language', newLang) -- Chame o evento (depois de atualizar o valor da linguagem atual) triggerEvent('onChangeLanguage', localPlayer) end Na outra resource (onde você criou alguma interface GUI): -- Incie uma tabela para armazenar os dados local toTranslate = {} -- Crie uma função para inserir os elementos dentro da tabela AssignTranslation = function(element, value) toTranslate[element] = value end -- Crie uma função para traduzir todos os elementos da tabela TranslateUI = function() for elem, value in pairs(toTranslate) do guiSetText(elem, exports.DayZ:getLanguageTextClient(value)) end end -- Adicione um handler para o evento de quando se troca de idioma, para forçar a tradução dos elementos que estão na tabela addEventHandler('onChangeLanguage', localPlayer, TranslateUI) -- Crie os elementos gui e configure uma tradução pra eles local guiWindow CreateUI = function() local w, h = 500, 500 guiWindow = guiCreateWindow((sW - w) / 2, (sH - h) / 2, w, h, '', false) AssignTranslation(guiWindow, 'settingsL') guiSetVisible(guiWindow, false) local label = guiCreateLabel(100, 100, 200, 200, '', false, guiWindow) AssignTranslation(label, 'playL') end addEventHandler('onClientResourceStart', resourceRoot, CreateUI) -- Adicione um comando para exibir/esconder a janela addCommandHandler('toggle', function() if (not isElement(guiWindow)) then return false end local state = not guiGetVisible(guiWindow) -- Caso vá exibir a janela, chamamos a função para traduzir os textos if state then TranslateUI() end guiSetVisible(guiWindow, state) showCursor(state) end) Dessa forma, sempre que você trocar de linguagem ou abrir a interface, todos os elementos GUI serão traduzidos para a linguagem atual do jogador. No caso de funções DX (como dxDrawText), não é necessário fazer esse procedimento, já que elas são chamadas a cada frame com o valor atualizado, a única recomendação que eu deixaria é que você crie uma função para fazer cache das traduções, justamente para evitar ficar chamando via exports o tempo todo, que pode causar uma grande perda de desempenho. Algo como: local cache = {} Translate = function(text) if (cache[text] == nil) then cache[text] = exports.DayZ:getLanguageTextClient(text) end return cache[text] end Dessa forma, ao invés de ficar sempre chamando o exports, voce chamaria diretamente a função Translate. Boa sorte
  7. Tente incluir uma screenshot da tela de crash, isso pode ajudar a identificar
×
×
  • Create New...