Jump to content

vicisdev

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by vicisdev

  1. Wait, how were you able to run MTA in wine? Which version are you running?
  2. I tested 4 and for 10000 iterations on every frame it would increase the frame drawn time by about 4ms (on my PC). I don't know if someone would get a UI with more than 10000 function calls per render, but creating tables does decrese performance. About the third point, I'm not asking to rewrite the MTA API, this practice could be good for later community created libraries. The second point the first sentence I think it's not a problem since you have to know what every parameter means anyway. The first one, I don't fear writing more in order to get better readability. I see a lot of people writing a function call in a single line +100 characters long specially when using DX because they think less lines is better or even naming variables on character long. From the perspective of the interpreter just minify your files and you're good. This is very specialized. I'm not a Lua expert, I had no clue about this opcode, I have no idea what's happening here but it's cool. But this opcode would need to be added in the MTA's Lua library, wouldn't it? It's not a configuration you can toggle in your server config files.
  3. Please read the edited version of my answer if you have not already
  4. Ok, I know I could create a workaround to it but this is just a discussion. Also, you wouldn't want to call two unpacks on a function like interpolateBetween which run on every frame. Your first example is quite interesting and made me search for "Lua named argument". It turns out Lua already have named arguments built in, but it's not how you wrote it. It would be something like this: local function coolFunction(args) -- ... end coolFunction { param1 = "val1", param2 = "val2", param3 = "val3" } I've already used it but I totally forgot about it lol. Anyway the discussion remains the same.
  5. Often times more complex function which do a lot to the user requires a lot of required and optional parameters. Think about InterpolateBetween function. Is it a best practice to instead of countless parameters passed in to a function to pass in a single table which keys matches those parameters? If not can we turn this into a best practice? A thing such as passing an options table makes the code auto documented so when you look at it you know exaclty what that "false" value means. Bad way The code below shows how clueless it can be when you have a lot of parameters to a function. To be honest, it could be even worst if written all in a sigle line. interpolateBetween( 0, 0, 0, 10, 10, 10, 0.5, "Linear" ) Good way This seems more interesting, doesn't it? You know exactly what all those values means. What do you think? interpolateBetween({ from = { 0, 0, 0 }, to = { 10, 10, 10 }, progress = 0.5, easing = "Linear" }) This also makes it easier to work with optional parameters
  6. I fixed it. You can now download the repository again and hopefully use it.
  7. I'm sorry. I've accidentally deleted my repository where the server's binary were stored. I'll be fixing this today. As soon as I finish this, I'll let you know.
  8. You can still download and use it, but I stopped working on this for quite a while now. Don't expect this to work 100% properly. This maily lacks meta.xml support. You can download it here https://github.com/alvesvin/mtabt-template/archive/refs/heads/master.zip
  9. Very cool stuff. One thing that would be great it's letting users to access types definitions from the global scope as described in the Typescript documentation for global module declaration. I was planning to work with type declaration for TypescriptToLua in MTA and I found it's better to work on a fork of this official lua types repository. They've created pretty decent typing declarations for all versions of Lua. The only thing to do here is to remove what's not from Lua 5.1 and then implement the MTA specific library. If you know Typescript well it will be awesome. I just scratch the surface when it comes to Typescript knowledge.
  10. This is not being maintained, but you still should try it Hey, people. In this topic I'm going to present you to a tool I've been working for a little while now. It's called MTA Build Tool. If you develop for the web you know there are tons of frameworks that automate and make the development experience satisfying. As you probably know, there's no such a thing to MTA resource development. This tool it's aimed to provide you a whole new experience of resource development. Current features At this point it features a built in development server, meaning it automatically downloads a MTA server for you to work on. The "repository" it's maintained by me and it's currently using MTA server version 1.5.8. Keeping on the development perspective, the tool comes with the ability to auto refresh your resources when some file in the resources directory changes. Another great thing is that it automatically generates a Meta.xml for all your resources. You won't need to bother with Meta.xml anymore (kind of). So, when developing new resources all you have to do is to create a directory and start writing .lua files into it. By the way, you need to follow the sugested resources directory structure where the naming of your directories does matter. Directories names surrounded by brackets will not be recognized as a resource directory. Now on the release side, it already comes with the ability to compile all your scripts. To compile, it uses the MTA Lua Compiler with obfuscation on level 3. It's, also, possible to compact all your resources to a .zip file. Future features I'm planning to give support to Typescript to Lua which is a hot project that make it possible to write lua scripts with Typescript. I think it would be cool to design a development environment that enforces great quality script development, but I'm not sure. Maybe it's beyond scope. Contributions Currently it's a private repository, but soon I'll open this project for contribution. I've never done open source before, so I'm not really sure how it goes. You can right now try this alpha alpha version by cloning this repository https://github.com/alvesvin/mtabt-template. This tool depends on NodeJS. If you've never worked with Node before you must install it in order to be possible to execute commands like npm run dev and npm run build.
  11. Pode continuar a usar o VSCode normal. Esses vídeos, inicialmente, saíram para uma outra plataforma e fazia sentido usar VSCodium lá. Mas, caso ainda queira usar o VSCodium, você precisa baixar o arquivo da extensão e instalar pelo menu Install from VSIX. Link da extensão: https://github.com/Subtixx/vscode-mtalua/releases/download/2.4.0/mtasa-lua-2.4.0.vsix
  12. Entendi. É meio contra intuitivo da forma que está, mas os últimos vídeos são sempre melhores que os primeiros, então tem mais chance de alguém gostar quando ver kkk Valeu, Lord.
  13. Curti, embora faltam dados mostrando os testes feitos para sustentar o que você ta falando. Eu acho meio estranho um flood no chat padrão afetar gravemente a performance do servidor. E também sobre comandos protegidos por ACL. Dá pra disponibilizar testes de performance?
  14. Fala, galera. Pra quem sempre quis saber como escrever os próprios scripts para MTA, mas nunca conseguiu se organizar para começar, eu trago a solução. Estou construindo uma playlist de vídeos relacionados a script para MTA. O foco principal é ensinar a API do MTA e não necessariamente programação em Lua, portanto, para aqueles que desejam acompanhar melhor é recomendado que já saiba programar em Lua. Por outro lado, não sinta-se incapaz de seguir a playlist mesmo não sabendo Lua. Você pode tentar entrar de cabeça, sem ter esse background muito sólido. Vai ser mais difícil, mas não é impossível. Eu já vi alguns gringos fazendo um post numa espécie de thread para seus próprios vídeos, mas não sei se é contra as regras. Se for, desculpe. Eu vou ir mantendo o vídeo mais atualizado no topo. Mas a playlist pode ser conferida aqui. MTA SCRIPT #22: Sistema de Exports MTA SCRIPT #21: Introdução à tabelas e OOP MTA SCRIPT #20: DX Scripting - Exibindo imagens na tela MTA SCRIPT #19: DX Scripting - Animações com InterpolateBetween MTA SCRIPT #18: DX Scripting - OnClientCursorMove MTA SCRIPT #17: DX Scripting - OnClientClick MTA SCRIPT #16: DX Scripting - Posição e Escala pt.2 MTA SCRIPT #15: DX Scripting - Posição e Escala pt.1 MTA SCRIPT #14: DX Scripting - Introdução MTA SCRIPT #13: Solucionando problemas de código MTA SCRIPT #12: Controle de Acesso (ACL) MTA SCRIPT #11: Pickups MTA SCRIPT #10: Markers MTA SCRIPT #09: Bind de teclas MTA SCRIPT #08: Manipulando eventos pt.2 MTA SCRIPT #07: Manipulando eventos pt.1 MTA SCRIPT #06: Variáveis globais predefinidas e Árvore de elementos MTA SCRIPT #05: Introdução aos comandos MTA SCRIPT #04: Script de Cliente x Servidor x Compartilhado MTA SCRIPT #03: Escrevendo seu primeiro resource MTA SCRIPT #02: Administrando o servidor MTA SCRIPT #01: Preparando o ambiente
  15. Turns out it's unapplicable and has a lot of performance issues due to loadstring being used heavily.
  16. Why? Yeah, as soon as I can fix some issues and write a doc.
  17. Fala galerinha. A maioria dos servidores tendem a "bindar" teclas de forma totalmente inconveniente como por exemplo colocando inventário no I, mouse no M, já cheguei a ver inventário no K, etc. Isso pode levar à uma má experiência por parte dos usuários já que dessa forma seria-los necessário tirar a mão de um controle principal do jogo - mouse, WASD - para executar funcionalidades secundárias. Além de que, bindar muitas teclas diferentes pode causar confusão e dificulta a memorização delas. Então, para tentar resolver esse tipo de situação, comumente vista em servidores estilo RPG, esse resource torna fácil a criação de teclas com multi-funcionalidades baseada em contextos. Sua principal aplicação é juntamente com os colshapes. Com eles é possível anexar diferentes colshapes à diferentes elementos e fazer uma única tecla executar funcionalidades em ambos eles. Alguns exemplos básicos são interações com NPCs, interagir com vending machines, reparar uma parte específica de um veículo chegando perto e apertando a mesma tecla e muito mais. Depende só da criatividade. Eu vou lança-lo assim que eu documentá-lo e corrigir alguns problemas de performance, mas vocês podem dar uma olhada na minha página do Github. Infelizmente eu gravei o vídeo só em inglês, mas basicamente eu mostro como é fácil alterar a funcionalidade de uma tecla apenas mudando os contextos em que ela se aplica.
  18. Multi Key Context System (UNAPPLICABLE) Most of server owners tend to bind keys in an unconvenient way like show inventory bound to letter I or K. This can lead to a bad user experience while playing in your server as it would be needed to leave a main control to activate a secondary - leave mouse or WASD to press F1, F2, Fn. Also, binding too much different keys can cause confusion and it's hard to remember. To overcome this lack of keys, which happens mainly in RPG style, this resource makes multi functionalities bound to a key easy to use following a context based approach. The main useful thing of it is with colshapes. You can attach colshapes to different elements and make a single key interact with both in different ways. Some examples are interaction with NPCs, sprunk vending machine, repair single car parts by getting close and pressing a key and much more. It's all about creativity. I'll release it as soon as I can fix some performance issues and make a documentation, but you can see it on my Github.
  19. Yeah, this is the approach I'm following now. Where can I share it when it's finished, like a showcase and stuff?
  20. Yeah, but the main thing is adding new entries programatically which leads to server/client only insertions. It would be magic if I could force a shared environment when calling a function so the api knows "ok this has to be added here and there" just like what happens when you manually, directly, make calls or insert data on a shared file. There is a way to extract a loaded function's implementation so you get its string? If so ... maaan, revolutionary!
  21. Ooh, great solution, actually. I've read loadstring doesn't return values, I was wrong. I'll need to change some implementations, but this is fine, thank you!
  22. I'm making a key binding api for my server, but I'll need to change the approach I guess I would really like to know what @IIYAMA has to say about this
  23. Yeah guys ... it sadly doesn't work -- shared_script.Lua addEventHandler("onPlayerJoin", root, function() local server_table = { function() return true end, function() outputChatBox("ANOTHER FUNCTION") return false end, "sadsad" } for k, v in pairs(server_table) do triggerClientEvent("r", source, k, v) end end) addEvent("r", true) addEventHandler("r", root, function(i, v) outputChatBox("RECEIVED > " .. inspect(i) .. " > " .. inspect(v)) end) https://i.imgur.com/E5TV6dS.png (i cant insert images ,_, )
  24. Idk really ... I've tried to store the table full of functions in the root element with setElementData and all entries gone nil, so maybe functions are not synceable ... idk :p
  25. I'll try it. But I have almost sure the entries are going to be nil ... let me see and I'll give feedback
×
×
  • Create New...