Leaderboard
Popular Content
Showing content with the highest reputation on 07/12/21 in Posts
-
O tutorial de hoje é sobre tabelas! Tabelas irão facilitar a sua vida na hora de programar. Além de economizar dezenas de linhas de código, ele ficará muito mais fácil de ser lido por outras pessoas, e também por você mesmo, depois de um certo tempo sem ter contato com o código. Não só essas coisas, como irá te abrir um mar de possibilidades. Clique no texto abaixo para ir diretamente ao site onde o tutorial está. Optei por escrevê-lo no Gist (do GitHub), como uma forma de organizar um pouco melhor. Ir para o tutorial ?2 points
-
Introdução O conteúdo deste tópico será separado por seções, ensinando passo-a-passo cada detalhe - desde criar um BOT no site do Discord Developers, até finalmente ligá-lo e executar os comandos, que serão enviados para o seu servidor MTA. Siga todos os passos para que tudo dê certo. Configurando o ambiente Bom, para que nós possamos iniciar, é necessário instalar duas coisas no seu computador: Node.js e Visual Studio Code. Só um adendo: não é estritamente necessário usar o VSCode, estou apenas sugerindo-o, e também é a IDE que irei utilizar neste tutorial. Após instalá-los, seguiremos a próxima seção. Como criar um BOT no Discord Developers Acesse este link: https://discord.com/developers/applications - se você não estiver com uma sessão do Discord aberta no navegador, faça o login para que você possa acessar as funcionalidades desse site. Provavelmente, após entrar numa sessão, uma página como esta irá surgir: Ignore as minhas aplicações. O seu estará vazio - eu acho. Para iniciarmos a criação de uma nova aplicação, clique no botão que está no canto superior direito: Escolha o nome que desejar, isso não importa muito para este tutorial. Uma vez criada, uma outra página aparecerá, com mais informações. Primeiramente, vá até a aba Bot. O botão fica ao lado esquerdo: Agora, para que criemos de fato o BOT, clique no botão ao lado direito: Um pop-up irá aparecer, basta clicar em Yes, do it! Mais uma vez, irá carregar, na mesma aba, mais informações, agora sobre o seu BOT. Não compartilhe nada do que estiver escrito na página, com ênfase no seu token, que faz o seu BOT ficar online. Agora, voltemos para a aba principal: Nessa aba, você possui o Client ID da sua aplicação. Esse ID não é o token, você não precisa se preocupar caso compartilhe com alguém: Copie-o e acesse este link para que possamos dar continuidade: https://discordapi.com/permissions.html. Nesse site, nós podemos gerar o link de convite, no qual você irá precisar para adicionar o BOT no seu servidor do Discord. Cole o ID que você copiou neste campo: Também, selecione a permissão de administrador, que fica logo acima: Feito todos os passos, copie o link, abra uma nova aba no seu navegador e acesse o link gerado. Ele é parecido com este: Assim que você acessar, selecione o servidor no qual você quer adicionar o BOT e confirme tudo o que é pedido. Caso você tenha feito corretamente, o seu BOT já está no seu servidor. Vamos a próxima seção. Clonando o repositório do BOT Optei por criar um repositório no GitHub para que fique mais fácil este tutorial. Se você não sabe o que é clonar, apenas clique no botão de baixar, ao invés de clonar. Ele é assim: Clique em Download ZIP. Uma vez que temos o repositório no computador, descompacte-o na área de trabalho mesmo. Feito isso, uma pasta será criada. Agora, abriremos o VSCode. Siga estas instruções: Você irá selecionar a sub-pasta, que está dentro do pasta descompactada. Preste atenção ao selecionar. Há uma outra pasta dentro daquela que extraímos, abra a pasta correta. O resultado deve ser este: Ignore os ícones, fonte, cor de fundo. São extensões que eu uso. Vamos a próxima seção. Como instalar os pacotes da aplicação Ainda no VSCode, pressione CTRL + ' (aspas simples). O terminal irá abrir. Com ele aberto, digite o comando npm install. Os pacotes serão instalados - uma nova pasta e arquivo serão gerados. Não se preocupe com isso, não faz parte deste tutorial. Próxima seção! Como habilitar o Modo Desenvolvedor no Discord Para que nós possamos avançar a próxima seção, nós precisamos habilitar o modo desenvolvedor, para obter os IDs de canais, servidor, usuário, cargos e outros. É simples. Acesse as configurações da sua conta, clique na aba Aparência, desça tudo e irá se deparar com isto: O meu já está ativado. Caso o seu não esteja, ative-o. Next... Configurando as variáveis do BOT Agora que nós já podemos copiar o ID de alguns elementos do Discord, iremos configurar os arquivos que estão dentro da pasta config, abra-a. Os arquivos são estes: Primeiramente, crie um canal no seu servidor do Discord e copie o ID dele. Basta clicar com o botão direito em cima e copiá-lo. Abra o arquivo channel.js e apenas altere o valor que está lá. Salve o arquivo e abra o próximo, guild.js. Para eu não me estender muito, você fará os mesmos passos acima, copiando o ID e substituindo. Para copiar o ID do seu servidor, basta clicar com o botão direito em cima do nome dele. Já no arquivo mta.js, você deve alterar as informações de acordo com o seu servidor. Veja a explicação abaixo. ip - do seu servidor. httpPort - a porta HTTP do seu servidor, você pode consultá-la aqui neste site. username - crie um usuário no seu servidor e dê permissões administrativas para ele. password - a senha que você colocou no usuário. ATENÇÃO: USE UM USUÁRIO E SENHA QUE NÃO SEJA FÁCIL DE DESCOBRIR, LOGO NÃO COMPARTILHE COM NINGUÉM. Em relação ao outro arquivo, prefix.js, é apenas o prefixo que você usará nos comandos, altere se quiser. O arquivo token.js fala por si só, você irá pegar o token de acesso do seu BOT, lá no site do Discord Developers e substituir dentro do arquivo. Acompanhe na imagem abaixo. Bom, já disse na seção passada que você não deve compartilhar o token. Seguiremos a próxima. Clonando o repositório do resource Assim como no repositório do BOT, o resource também está no GitHub. Baixe-o, da mesma forma do BOT, mas agora adicione no seu servidor MTA, na pasta resources. Lembrando que deve-se extrair e colocar a pasta correta, verifique bem a sub-pasta. Uma vez adicionado no seu servidor, use o comando refresh para atualizar a lista de resources e inicie-o. Ah, e também dê permissões administrativas para ele! Pronto. Já podemos prosseguir. Iniciando o BOT Estamos quase ao ponto de executar os comandos. Vamos iniciar o BOT. Agora no VSCode, naquele mesmo terminal, use o comando npm start. Se tudo foi feito corretamente, ele irá se iniciar sem erros e uma mensagem dizendo que o BOT foi ligado deve aparecer. Testando os comandos Lembra que nós criamos um canal para executar os comandos? Pois é agora que iremos utilizá-lo. Lembre-se: o seu servidor deve estar ligado - entre nele também para que você possa ver as mensagens no chat. Alguns comandos que eu fiz, apenas para exemplificar. Você pode adicionar mais comandos se quiser. Se você não alterou o prefixo, aqui estão os comandos que fiz. (Você deve ser ADMINISTRADOR do seu servidor para executá-los) $settime <hora> <minuto> - $settime 12 00 | Irá alterar o clima no servidor. $text <mensagem> - $text opa, jogadores, tudo bem? | A mensagem será enviada no chat do servidor. $status | Mostrará algumas informações do servidor no chat do Discord. $mute <jogador> - $mute andr0xy | O jogador ficará mutado até se reconectar. $givemoney <jogador> <quantia> - $givemoney andr0xy 15000 | Dá dinheiro ao jogador. $cgroup <nome> - $cgroup VIP | Cria um grupo na ACL. Apenas uma observação: é possível sim, nos comandos que envolvem jogadores, executá-los pelo ID. Basta você editar o resource - não irei explicar como faz isso, pois não tem relação ao tutorial. Agradecimento & Informações Muito obrigado por seguir o tutorial. Fiz com o ❤ para toda a comunidade. Espero que vocês evoluam ambos códigos e que isso se torne muito maior dentro do servidor de vocês. Lembre-se que tudo é possível no MTA, contribuam sempre de alguma forma para que outros também possam evoluir. A união é importante nessa área. Busquem conhecimento! Crédito ao autor da SDK, o que faz ser possível conectar-se ao servidor MTA. 4O4 - GitHub Edições neste tutorial 28.01.2021 - AVISO: renomeie o resource para discordapp. 29.01.2021 - CORREÇÃO: texto confuso na seção Clonando o repositório do BOT. 29.01.2021 - AVISO: código do resource refatorado, sendo mais fácil adicionar novos comandos.1 point
-
Multi Theft Auto: San Andreas 1.5.9 is released! Happy autumn! We've been working hard and today we're proud to announce the release of MTA:SA 1.5.9. You will receive an automatic update soon, but if you don't have MTA installed, you can get it from the home page. Statistics This is the 26th 1.x.x release 355 days 49 new functions 16 new events 0 deprecations 77+ bug fixes and changes 334 commits (see comparison) 189 new open GitHub issues (see list) 81 resolved GitHub issues (see list) 135 closed GitHub issues (see list) 71 new open GitHub pull requests (see list) 207 merged GitHub pull requests (see list) 53 closed GitHub pull requests (see list) 38 contributors of which 11 are new (see list) 94+ total contributors (see list) 13 vendor updates Download This release is (mostly) backwards compatible with the older 1.5.x releases (1.5.8, 1.5.7, all the way to 1.5). If you're a server owner, please take note of the Changes in 1.5.9 wiki page, more specifically the Backwards Incompatible Changes. You may need to update your scripts for 1.5.9. Servers: binaries are available. Don't forget to update your default resources. WANT TO DOWNLOAD THE MOD? CLICK HERE (Win7/Win8/Win10) Twitch We hosted a community livestream event at the end of July which was very nice! We hung out and played MTA with you on various servers. You can watch a recording of the livestream on our YouTube channel at https://youtu.be/n2KcspT0F0A. We wish to do more of these livestreams soon! Merch We launched a 100% non-profit merch store on Spreadshirt earlier this year! If you feel like getting some of that official MTA swag, check out the merch store here: https://multitheftauto.myspreadshop.net/all and wear that MTA gang drip at school or work. Check out https://streamlabs.com/mtaqa/merch for merch! AMX (SAMP) amx is a software package that allows the execution of unmodified San Andreas: Multiplayer 0.3.7 gamemodes, filterscripts and plugins on Multi Theft Auto: San Andreas 1.5.8 and higher servers. It is open source, and a prebuilt binary for Windows is available for testing purposes right now. The AMX team hopes that more people get involved with the development on GitHub as they need some help! Check out our GitHub repo for more information on how to use your SAMP scripts in MTA! 1.5.9 Highlights This release includes many additions, improvements, and fixes: You can now use the new onPlayerResourceStart server-side event to trigger when client is ready! Thanks to @Lpsd You can now detect element interior or dimension change through two new client and server-side events onElementInteriorChange and onElementDimensionChange – should reduce some of your code! Thanks to @Patrick and @Strix You can now edit element bone behavior through 7 new bone manipulation functions! Great for some dynamic animations. Get started at setElementBonePosition and setElementBoneRotation. Thanks to @Saml1er More vehicle customisation options! You can now edit vehicle dummy positions per vehicle. See setVehicleDummyPosition. Thanks to @botder More audio customisation with sound effect parameters! See setSoundEffectParameter. Thanks to @Strix and @Sarrum More client download transfer box customisation options! See for example onClientTransferBoxProgressChange. Thanks to @botder and @CrosRoad95 You can now allocate custom objects and vehicles through engineRequestModel. One of the most sought after features in a long time. Thanks to @TheNormalnij You can now use scalable vector graphics (SVG) in MTA! See svgCreate for more info. Thanks to @Lpsd You can now use peds and vehicles as the camera target. Thanks to @TheNormalnij A lot more features for scripters to build even more immersive experiences with! Many synchronization improvements! Many varying size fixes, quality of life improvements, updates and security enhancements! Many default resource fixes, refactors and upgrades, including webmap working once again! We have also improved the detection of world objects in map editor (editor_main resource), so you can select many more objects that you couldn't before - such as bushes, fences and many more! You can now also remove world objects inside interiors. This should help mappers a lot. If you are a scripter, you really should wanna dig in to these improvements! Show off your creations on our #showroom channel on our Discord server and have a chance at getting your work featured on our social media pages. Read the 1.5.9 release notes for a complete set of changes and more information about the improvements listed below. Watch or star our GitHub repository to keep on top of all the things we're working on. Important future script changes This will be the last 1.5 update and in the next version of MTA there will be numerous backwards incompatible changes and refactors that may affect old code. We will try to focus on making migration from 1.5.9 to the next version smooth for everyone. From 1.6 onwards we will be making at least the following changes: callRemote callbacks currently set the error code to nil when there is no error. In 1.6, to be consistent with fetchRemote, the error code reported will be 0. See GitHub #294. Since July 2016 if you provide an invalid string like "randomstring" when a function expects a number, the string will be treated as 0 and raise a script warning. In 1.6 this will be an error. You will still be able to provide strings containing numbers (e.g. "100" and "12.34"), this change only affects invalid strings. See GitHub #1043. When providing a width and height of (0, 0) to createBrowser or guiCreateBrowser you will encounter a script error instead of a warning. The warning was introduced Feb 2019. See GitHub #1069. Some functions expect only unsigned integers (positive numbers), and since Jan 2016 providing negative numbers would be a warning. This will now be an error. See GitHub #1070. Since Aug 2015, we replaced the custom mtalocal:// URL scheme with http://mta/resourceName/blah.html. This mtalocal:// URL scheme will now be removed. See GitHub #1071. This list is incomplete and we may introduce more changes later. What's next? Our eyes are now on the next version of MTA, which will break backwards compatibility in many ways as we work to refactor MTA's codebase. We are looking to host more community livestreams in the future, especially when we get further into the development of the next version of MTA. Stay tuned for more info most likely starting next year! We are also still working on our community 2.0 website with an internal goal of having phase 1 of development finished by August 2022. Latest news on this is that we've had major advancements on our stack which has been long overdue. We have also continued design on both backend and frontend. We will keep you updated should any news on this project surface. Multi Theft Auto depends on community input and contributions. To keep a project like MTA going we need LOTS of people. You can help in the following areas: Testing and bug reporting Whenever you encounter a bug or recognise a need for improvement, we can't fix it until you tell us your problem! We're continually working on new features and fixes for MTA, and this always needs testing. Join our Nightly release stream and make sure you keep in touch with on Discord and report issues on GitHub. Programming If you know C++ you may be interested in helping improve Multi Theft Auto's client. Working on open-source software may seem scary, but the best way is to try! Read GitHub's open source guide, and then find an itch to scratch, or scratch your own! Documentation Documentation is important, but also time consuming. If you enjoy writing and have some knowledge of English, or you would like to translate the English version to your native language, you’re very welcome to do so. Just head over to our wiki, create an account, and start editing! Support Do you like people? Can you give calm and thought-out responses to users needing help? Then you can spend some time providing support to those who need it. Many answers can be found on our wiki, so make sure to take some time to read it. Then, either join our chat or forums (linked below), or simply help us sort out issues and answer questions on the GitHub repository. Translation Want to translate MTA to your own language? Awesome! Visit us on Pootle. As soon as your translation is approved, it will be pushed to our repository for use in future releases. Donations Keeping the MTA downloads, master server and websites alive costs money! If you want to help us sustain our financial expenses, please donate! Show your creativity! We are actively looking for new creations on our #showroom channel on Discord, as well as #mtasa on Twitter for content we would like to repost on our social media pages and pin on our annual recap forum post. Follow us on our social media channels: Twitch, YouTube, Facebook, Reddit, LinkedIn. Thank you! Thank you to the following community members for their donations this year: @Arran, @Azukie, @Dmi7ry, @IIYAMA, Malone, Berni, @NoHear, lupinek, @Flatliner_, @Sarrum, Shine, @Trumavarium Thank you very much to the following community members for their work towards this release: @botder, @myonlake, @Pirulax, @TheNormalnij, @sbx320, @Dutchman101, @Strix, @qaisjp, @Zango, @Sarrum, @Lpsd, @Jusonex, @Woovie, @cleopatra, @Saml1er, @Patrick, @TEDERIs, @ccw, @fastman92, @Allerek, drop-club, @CrosRoad95, @iDannz, @JeViCo, @STR6, se16n, @FileEX, delinx, emre1702, @Disinterpreter, @LosFaul, @NanoBob, @pieT, PauloKim1246, ecastro98, @Luxy.c, Unde-R, TeteX1, @The_GTA, @leetIbrahim, @mertcan4555, @Lvrent, @Inder00, @Arran, @iDannz, @xLive, jlillis, ricksterhd123, @srslyyyy, @androksi, Yamsha75, @AfuSensi, Dark-Dragon, umithyo, brenodanyel, Mkl21, 1lyncon, Dante383, @turret001, Dezash, @Deihim007, @0xCiBeR and many others who contributed to our Wiki and helped out with issues. (If your name is missing or you want to change your entry above, please let us know on Discord!) You could be on this list! We're always on the lookout for new contributors. Contribute on GitHub, and chat with us on Discord. We have channels for scripting, general support (bugs), mod development, and many more! And one more thank you to every member of the MTA staff who helps support this forum and Discord. Without your efforts, this project would not be nearly as successful as it is now. Also a big thank you to the new MTA helpers team who support our users on this forum and Discord! Finally, please give a ? to our newest staff members @androksi, @Pirulax, @Sarrum and @xLive; newest contributors colistro123, @Pirulax and @TheNormalnij, as well as our newest addition to the MTA team @myonlake! Have a good autumn! — MTA Team1 point
-
1 point
-
Sobre Blowid Roleplay ? Blowid Roleplay é um servidor roleplay com sistemas inovadores que tem como intuito de disponibilizar para nossos jogadores uma jogabilidade moderna e diferente dos demais servidores. A cidade está aberta ? O projeto ainda está em desenvolvimento mas logo logo estaremos lançando nossa cidade. Comtamos com scripts exclusivos. Discord https://discord.gg/ESjX5eDwch1 point
-
إعطاء الفلوس لازم يكون في جانب السيرفر إذا ضغط زر استعمل triggerServerEvent عشان تتصل بجانب السيرفر من الكلاينت بعدها استخدم isObjectInACLGroup للتحقق إن الحساب حق الاعب موجود في قروب الاسل givePlayerMoney وظيفة إعطاء المال1 point
-
OK. Then let me try to help you by asking you about this faulty code excerpt. It has been pointed at by the error message so it should be no suprise to you. By having one year of experience you should be able to formulate some basic ideas. if (getServerConfigSetting( "bullet_sync" ) == "1" ) then tee end What did you mean by these code lines? Especially, what is the reason behind putting the "tee" specifier into your code which is a parameter of the event handler?1 point
-
1 point
-
Adicionar um dxDrawImage não impossibilita dele jogar, só de ver o jogo. Para impedir que ele se movimente, vc pode mostrar o cursor na tela com showCursor (true) ou então desabilitar todos os controles do jogador com toggleAllControls (false).1 point
-
Você vai precisar usar o isTransferBoxActive para checar se o jogar esta baixando algo do seu servidor . Para esse script ser o primeiro a ser baixado antes dos outros , basta colocar no meta a seguinte linha <download_priority_group> 1 </download_priority_group> , como dito acima. Já para o player "não poder jogar" , basta adicionar um dxDrawImage que ocupe a tela inteira , impossibilitando-o de jogar.1 point
-
Tem como Me explicar Melhor? Sou novo Nisso1 point
-
Olá, primeiramente veja nossas regras aqui: Na próxima vez, poste na seção adequada Portuguese/Português >> Programação em Lua.1 point
-
SQLite it's similar to MySQL, but it doesn't require a SQL server like MySQL does. I will explain the new db functions. dbConnect dbExec dbQuery dbPoll dbFree dbConnect So you must use dbConnect, to open a connection with the database (the .db file) which you can later use with dbQuery to execute a query. dbConnect connects to a .db file, or create it if it doesn't exist. The path can be the resource, another resource or the global databases folder. Ex: --In the same resource local connection = dbConnect ( "sqlite" , "newDB.db" ) --Another resource local connection = dbConnect ( "sqlite" , ":resourceName/newDB.db" ) --Global databases folder local connection = dbConnect ( "sqlite" , ":/newDB.db" ) And later you will use the variable connection with dbQuery. You can destroy the connection with destroyElement. dbQuery You use dbQuery to execute a query and it returns a query handler which can be used with dbPoll to get the result, or dbFree if you don't want it at all. You can also use dbExec If you want to execute a query and you don't want a result. Ex: The example is a continue to the above example. local queryHandle = dbQuery ( connection , "SELECT * FROM someTable" ) --Another example local queryHandle = dbQuery ( connection , "CREATE TABLE IF NOT EXISTS someTable (column1 TEXT,column2 TEXT)" ) --Another example local queryHandle = dbQuery ( connection , "INSERT INTO someTable (column1,column2) VALUES (?,?)", "text" , "text2" ) The question mark can be used to insert a value as an argument, without having to quote it or anything, I use them personally. If you don't know what to type in the query, look in the old sqlite functions wiki page for examples. dbPoll When you use dbQuery it returns a query handle, in order to get the result you have to use dbPoll. Ex: --Without timeout setting. local queryResult = dbPoll ( queryHandle , -1 ) --With timeout setting. local queryResult = dbPoll ( queryHandle , 10 ) The second argument: dbFree just frees the result no more explaining needed. dbExec executes a string, without any values returned. Ex: dbFree ( dbQuery ( connection , "UPDATE someTable SET column1 = ?" , "row1" ) ) --OR JUST (AS A REPLACEMENT) dbExec ( connection , UPDATE someTable SET column1 = ?" , "row1" ) viewtopic.php?f=91&t=37892#p3903841 point
