Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 25/08/21 in Posts

  1. MTASA Typescript I am developing utility packages for transpiling TypeScript into an MTASA-compatible Lua code. I would like to share that project to receive some suggestions and, I believe, to help someone in resource writing. Why Lua is not so good Classes. Lua does not support classes (syntax) from scratch. If you want to write OOP code with your own classes, you have to use metatables to implement class objects behavior. That's make the source code more complicated, than it could be. Hints (from your IDE). Lua is dynamic typed language, therefore, it's hard to determine, what the variable is and, hence, IDE cannot hint you function declarations, object methods and etc. MTASA Lua is still 5.1 (it is not developing). Lua, like any programming language, is developing, however MTASA core strongly linked to Lua 5.1. Why TypeScript There is TypeScriptToLua project. My project is based on TypeScriptToLua (I use it as a dependency). General purpose of TypeScriptToLua: convert (transpile) typescript code into Lua code. Thus, you can use TypeScript without modifying MTASA core. You are available to not use types in some parts of code (you are not restricted to use types everywhere). The TypeScript is being developed by Microsoft and, I believe, that TypeScript will be alive for several years. When to not use TypeScript (where to use Lua instead of TypeScript) 1. If you are not familiar with Lua or with scripting in general. 2. if you are writing simple script. Introduction Video I have made the video, where I describe Lua disadvantages, explain, why I have chosen TypeScript (and language transpiling) and write an example. Few word about mtasa-lua-types I have created this package to provide MTASA declarations in TypeScript. If you would like to create a resource, you haven't to install it manually, just use the boilerplate. Quick Start I have provided the tutorial here: https://github.com/mtasa-typescript/resource-boilerplate. So, you have to install NodeJS and download my boilerplate. And,... you are ready to code. If you have any ideas, issues or suggestions -- post them below, or in youtube comments, or in github issues ? Example code (from youtube video) import { Player } from 'mtasa-lua-types/types/mtasa/server/oop/Player'; import { mtasa } from 'mtasa-lua-types/types/mtasa/server'; interface GithubCommitApiResponse { commit: { message: string; } } mtasa.addCommandHandler('getcommit', function(player: Player, cmd: string) { mtasa.fetchRemote( 'https://api.github.com/repos/mtasa-typescript/mtasa-lua-types/commits?per_page=1', (data: string) => { const json = mtasa.fromJSON(data) as GithubCommitApiResponse mtasa.outputConsole(`The last commit message: ${json.commit.message}`) } ) }) Future plans - Github bot, that will crawl mtasa wiki and update mtasa-lua-types continuously - Add better hinting for `addEventHandler` function Links WebSite: https://mtasa-typescript.github.io/ GitHub MTASA TypeScript Projects: https://github.com/mtasa-typescript Resource Boilerplate: https://github.com/mtasa-typescript/resource-boilerplate Resource Example: https://github.com/mtasa-typescript/resource-example
    1 point
  2. Olá! Seja bem-vindo(a) ao fórum. ? O sistema que você deseja não é tão complicado de ser feito, embora seja necessário um certo conhecimento em programação. Mesmo que eu te explique aqui, não iria adiantar, pois presumo que você não saberia por onde começar. Recomendo que você leia estes seguintes artigos: Como a Wiki funciona. Tutorial Lua para iniciantes. Playlist para você aprender a escrever os seus próprios scripts. Curso sobre algoritmos. De qualquer forma, acredito que valha a pena escrever sobre a lógica por trás. Então, serei breve: Vamos lá. O jogo irá começar quando houver 20 pessoas esperando. Para isso, nós precisamos de uma tabela, onde os jogadores ficarão armazenados. A cada jogador que digitar o comando para participar, nós o inserimos na tabela. Caso ele saia do servidor ou morra (no jogo ?), nós o retiramos da tabela, para que não ocorra bugs desnecessários. Mostrando isso em código, ficaria mais ou menos desta forma: É claro que falta algumas coisas, como por exemplo dar uma outra arma ao jogador, caso ele mate X jogadores. Espero que tenha ajudado de alguma forma.
    1 point
  3. ?. Скорее всего вы были заблокированы за использование чит-программ. Можете внимательно ознакомиться с этой темой: И затем попробовать подать апелляцию.
    1 point
  4. Olá! Tópico movido para a seção correta por se tratar de código Lua. Sobre a sua questão, nós temos dois cenários aqui. O primeiro seria rotacionar o objeto infinitamente; o segundo, rotacionar o objeto apenas quando alguém executar uma ação. Acredito que sua vontade seja rotacionar o tempo todo. Aqui esta um tópico sobre o assunto:
    1 point
  5. Vc só tem 2 GB de RAM. Isso é bem pouco. E vc estava com Chrome aberto com várias abas.
    1 point
×
×
  • Create New...