Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/04/18 in all areas

  1. Isso poderia ter sido perguntado na sessão de scripting. Um banco de dados é onde ficam salvos diversos tipos de dados que são usados entre as sessões dos jogadores e do servidor, isto significa que mesmo se o jogador relogar no servidor ou até mesmo o servidor reiniciar, os dados salvos no banco de dados não são perdidos. (se o script que salvou lá foi feito corretamente). O MTA já cria 2 bancos de dados padrão quando vc cria seu servidor, são eles: internal.db - Onde são salvos todos os dados das contas dos jogadores, login, senha, grana do bolso, posição do jogador quando deslogou, vida, colete, skin, armas, munição, etc. registry.db - Onde são salvos todos os dados que são utilizados pelos resources, como por exemplo melhores pontuações das corridas (race gamemode), proprietários das casas, dados bancários dos jogadores, saldo bancário dos jogadores, carros comprados pelos jogadores, roupas compradas pelos jogadores, empresas adquiridas pelos jogadores, etc. Estes dois banco de dados estão na pasta deathmatch do seu servidor, estão na linguagem SQLite. Você ainda pode criar outros bancos de dados, para serem usados pelos resources, mas na minha opinião isso não é recomendável, uma vez que vc usaria MySQL, que é mais complexo e exige certos cuidados de acesso e domínio, mas alguns servidores profissionais precisam fazer assim pois fizeram os bancos de dados ficarem fora do servidor em outro IP por segurança, dai é necessário ter bancos de dados externos. Para salvar alguma coisa na conta do jogador, isto é, no internal.db, você usa setAccountData, e para recuperar esses dados depois, use getAccountData. Para salvar alguma coisa no registry.db, é um pouco mais complicado, uma vez que vc vai precisar criar uma tabela nova para cada resource. Por exemplo, vc acabou de criar um resource de ranking por kills/deaths e você deseja salvar esse ranking no banco de dados para que ao reiniciar o resource ou o servidor, o ranking não seja perdido. Para isso vc vai precisar primeiramente criar uma tabela no banco de dados registry.db, essa tabela será acessada pelo resource, que irá salvar os dados dele lá. Para fazer qualquer coisa neste banco de dados (criar tabelas, inserir/alterar/remover valores em determinada tabela, deletar determinada tabela, inserir colunas em determinada tabela, etc) vc vai precisar usar isso: executeSQLQuery. (aqui, será necessário conhecimento em SQLite para fazer isso, mas é mais fácil do que aprender uma linguagem de programação nova, pois suas opções e sintaxes são menores do que uma linguagem inteira de programação, você não vai inventar nenhum sistema novo aqui, apenas criar e gerenciar tabelas e dados.) Criar tabela nova no banco de dados: (o Caps Lock não é uma regra, mas é melhor para entender oq é código e oq é nome) [Os seguintes códigos só funcionam server-side] executeSQLQuery ("CREATE TABLE IF NOT EXISTS nomedatabela (nomecoluna1 TEXT, nomecoluna2 REAL, nomecoluna3 INTEGER)") TEXT = Valores desta coluna serão textos. Podem ter símbolos, números e espaços. REAL = Valores desta coluna serão numéricos reais. (números com vírgula, positivos, negativos e 0.0) INTEGER = Valores desta coluna serão numéricos inteiros. (positivos, negativos e 0) (não existe tipo BOOLEAN, use TEXT e insira valor "false" ou "true") (existe valor NULL, é diferente de vazio, mas NULL não é um tipo de dado e sim um valor nulo. Você pode atribuir valor NULL a qualquer célula.) Deletar tabela do banco de dados: executeSQLQuery ("DROP TABLE nomedatabela") Todas as linhas, colunas, células e valores desta tabela são deletados junto. Deletar linhas da tabela: (as células não ficarão NULL) executeSQLQuery ("DELETE FROM nomedatabela WHERE colunaespecífica=?", valorDaCelulaEspecifica) O ? indica que o valor está após a declaração do SQL. Você poderia colocar o valor direto no lugar do ?. Mas por alguma razão, as vezes isso gera erro. Além disso, se o valor da célula estiver em uma variável no seu script, você não pode declarar a variável no lugar do ?. Ali só pode ser o valor direto, pois a declaração SQL inteira se trata de uma string. Por isso o uso do ?, que está recebendo o valor da variável que está depois da vírgula. Obs: Para verificar se uma célula tem valor nulo, não se usa os operadores lógicos de ==, <= >=. Para isso, usa-se IS NULL ou IS NOT NULL. Ex: executeSQLQuery ("DELETE nomecoluna1,nomecoluna2 FROM nomedatabela WHERE nomecoluna3 IS NULL") Isso vai deletar todas as células da linha onde a coluna 3 tem uma célula de valor NULL. Se a coluna 3 não tiver nenhuma célula de valor NULL, nada acontece. Inserir nova linha de valores: (ele vai criar automaticamente uma nova linha com novas células) executeSQLQuery ("INSERT INTO nomedatabela(nomecoluna1,nomecoluna2,nomecoluna3) VALUES(?,?,?)", valorCelulaColuna1, valorCelulaColuna2, valorCelulaColuna3) Neste caso, ele está inserindo 3 novos valores, cada valor em uma coluna. Se você não declarar os nomes das colunas, ele vai preencher na ordem das colunas automaticamente. Você pode deixar de declarar uma coluna se não quiser atribuir valor na célula daquela coluna. Se o tipo de valor da variável não for do tipo de dado daquela coluna, dará erro. Atualizar valores de células que já existem em uma tabela: (não é possível alterar os tipos de valores, é necessário editar o tipo da coluna se quiser fazer isso) executeSQLQuery ("UPDATE nomedatabela SET nomecoluna2=?,nomecoluna3=? WHERE nomecoluna1=?", valorCelulaColuna2, valorCelulaColuna3, valorCelulaColuna1) No caso acima, ele vai atualizar as células das colunas 2 e 3 onde o valor da célula da coluna 1 for igual ao valor de valorColunaCelula1. OBS: Nada impede que você coloque as primeiras variáveis junto à declaração SQL, mas para fazer isso você deve "cortar" a string, inserir as variáveis e depois continuar a string, Ex: executeSQLQuery ("UPDATE nomedatabela SET nomecoluna2= '".. valorCelulaColuna2 .."',nomecoluna3='".. valorCelulaColuna2 .."' WHERE nomecoluna1=?", valorCelulaColuna1) Lembrando que o valor destas variáveis também são strings na declaração, portanto use aspas simples antes e depois de cada corte para transformar os valores em string. Os dois pontos (..) significam que estes valores fazem parte do argumento SQL. Da mesma forma, se vc usar "1" .. "1", será igual a "11". (Por isso acho muito mais fácil deixar tudo ? na declaração SQL e colocar as variáveis todas após a string.) Selecionar determinadas células da tabela: (usado geralmente para obter os valores destas células para usar no script, você pode selecionar somente 1 célula ou várias) executeSQLQuery ("SELECT nomecoluna1,nomecoluna2 FROM nomedatabela WHERE nomecoluna3=?", valorCelulaColuna3) Neste exemplo, ele vai selecionar a célula da coluna 1 e a célula da coluna 2, na linha onde a célula da coluna 3 for igual a valorCelulaColuna3. Alterar a tabela (adicionar coluna nova) [SQLite não suporta deletar coluna nem editar tipo de coluna] executeSQLQuery ("ALTER TABLE nomedatabela ADD nomecoluna4 REAL") Devido a limitações do SQLite, ALTER TABLE não pode ser usado para deletar uma coluna nem para editar seu tipo. Para fazer isso é necessário recriar a tabela inteira com as novas alterações. No exemplo acima, ele vai adicionar uma nova coluna chamada "nomecoluna4". Fiz um código com vários testes de banco de dados. Cada comando faz alguma coisa. Espero ter ajudado. Boa sorte.
    2 points
  2. 1st April 2019: THIS TOPIC HAS BEEN CLOSED BY MODERATOR ON REQUEST OF TOPICSTARTER EMERALD GAMING ROLEPLAY https://emeraldgaming.net WHO WE ARE We are a small team with 21 years of combined roleplaying experience amongst us all put together and we all have the same goal - creating a roleplaying environment that is enjoyable, accessible and most importantly - fair for everyone. Each of us have all held a administrative or leadership role within popular roleplaying servers in the past which has given us an in-depth understanding of all aspects within roleplay - civilian, legal, illegal and government. No matter what server, one thing has always been persistent; no community was able to continuously fulfill the three goals stated above. This eventually led us to come together and form a community of our own. WHAT WE PLAN TO DO Creating the ideal roleplaying environment which will appeal to everyone and all sides will take time and feedback - this is why we have gone public quite early in development; to build from the ground up based on community feedback in order to ensure we create the ideal server filled with features, rules and guidelines dictated by the community. At the end of the day it is you who'll be primarily playing and on the end of everything, not us. By removing the bureaucracy that most other communities revolve around, we're creating something that is built by the players themselves to ensure we stick to the right path and work from ideas and suggestions that the players have approved of. We aim to be a medium-to-heavy roleplaying server, enforcing the highest levels of immersion, roleplaying rules and at the same time, maintaining a high level of enjoyability. We feel that roleplaying nowadays has lost its touch with what it used to be years ago, a sort of grounds where you could come online, play with friends, build up what you desire or play any role within roleplay and enjoy doing it - whereas now it seems to be is competition, cops versus robbers and all about winning. Read more about Emerald Gaming here: https://forums.emeraldgaming.net/topic/35-what-is-emerald-gaming/ DEVELOPMENT CONCEPT There have been numerous communities that crumbled because of lack of attention given to a certain part of development or a feature, and that's why working without a deadline and at our own pace gave us the opportunity to work on features more thoroughly and in-depth. We've seen this in the past from other communities that have failed as a result of increasing desire and pressure to launch an unfinished server. We have devoted a great deal of our time to not only development but also to research what players expect from a server and how to improve from the mistakes of other communities, overall creating a more enjoyable experience. A substantial part of the process we need to go through is not only reducing the internal bureaucracy of the staff, or ensuring that everyone has equal opportunities, but also the experience of not being restricted by the server's script capabilities. WHAT WE HAVE TO OFFER All concepts, ideas and showcases are currently in their early alpha stages and do not represent actual gameplay, they are subject to change at any given moment throughout development until the final public release. 3D User Interfaces This is the primary feature that we believe will make us unique and re-invent the way roleplay is conducted on MTA. By creating graphical interfaces within the 3D world, players can interact with things such as vehicles or objects seamlessly like any open world game where pointing the center of your screen at the element triggers the ability to interact with it. Expanding on this idea, having 2D GUIs on screen all the time or for each interaction can leave the user feeling quite clustered - so we've minimized it all down to simple prompts and selections to get what you need done. An example of this concept can be seen below, where a player interacts with an ATM to withdraw money - the ATM interface is drawn as soon as the player approaches it, and you can begin interacting with it like any other GUI. Please bear in mind that the example below is a very rough draft to show the concept and does not represent the final project. Advanced Inventory & Item System Our item and inventory system is one that provides the highest level of immersion and accessibility. With custom models for objects to reflect the actual item itself, a sleek and simple inventory with an easier level of interaction to use - you'll get used to it as if you've been using it for years in no time. The inventory is split up into 4 portions. The main inventory holds all of your basic items such as your wallet, keys, clothing, accessories and storage items. The weapon inventory holds.. weapons. When a weapon is placed into this inventory, it'll appear on the player and be added to their hotbar for usage. Ammo is fed to the weapon directly from the main inventory. The hotbar is a concept we wanted to try out and see what the community thinks - you can place items into your hotbar by dragging and dropping them to any of the six available slots. From there you can pin your hotbar so it remains on screen wherever you like when you close your inventory. When roleplaying, you can then scroll through each item within your hotbar with number keys 1-6 or your mouse scroll wheel. This can be used to select weapons to equip in-hand, or hold out items such as your car keys to unlock your car, handcuffs to use before handcuffing a player and so on - the possibilities are endless! The storage inventory is only visible when you click on a storage item such as a backpack, dufflebag, basket, armor and so on. The size and slots that can be stored within the storage item depends on the item itself and its predefined slots. Dropping a storage item on the ground with contents inside will retain its contents, so you can finally fill a briefcase up with tons of money and pass it over the table to a mob gangster just like in the movies. Unique GUI System We use a custom GUI system which draws amazingly designed and easy to use interfaces instead of the stock MTA GUIs. Player Report Panel accessible via F1. Administrative Item Spawn Panel. Character creation. Character creation skill points allocation. (This will be explained in-depth at a later date.) Video displaying the full character creation. Focus on all sides of Roleplay We aim to provide enough script support for all sides of roleplay. Be it legal, illegal, government or just plain civilian. Leaving one side more superior and focused with features scriptwise can result in a loss of incentive of to play other roles, so making one role just as enjoyable as the next is key. Law Enforcement Because LEO roleplay is quite major and requires quite a lot of equipment on the script end to assist in being able to carry out essential tasks such as using an MDC, a prison system and tactical equipment, we'll be sure to incorporate everything a law enforcement officer needs to get the job done. Starting from just a pen and ticket book, all the way to a remote controlled bomb disposal bot. Illegal Roleplay The other major role of every roleplaying community. Illegal roleplayers are the heart and soul of creating exciting roleplay opportunities for other players such as gangs, large factions, shootouts and the general illegal atmosphere. With the Faction Team already functioning and prepared, we spent a considerable amount of time thinking of ways to provide life and new innovative features to illegal roleplay. We're making it easier than ever to grow drugs with a fully detailed drug system, requiring as minimal staff interaction as possible and allowing players to roleplay independently. We'll be putting measures in place to make sure that the economy is balanced to allow healthy illegal roleplay. Legal Roleplay When attempting to achieve a perfect balance between all sides of roleplay, legal RP plays a major role. Be it a bar, club or a trucking service - it's going to be a pleasant experience for company leaders, employees and entrepreneurs. Everything you need is going to be accessible in-game, such as creating a faction by going through the typically mundane process of acquiring a business license from the government. The Faction Team is more than open to hearing your suggestions and will have an announcement up in the coming weeks for more information, we can't wait to hear what you think! Customization Everyone loves customization and personalization. It helps you feel more comfortable and make something yours, and to do that we've added a ton of customization opportunities throughout. If you've seen the video above of the inventory system, then you already know you can move each inventory anywhere you want and save it's location. Pin and unpin your hotbar so its constantly on-screen or only appear whenever you hit a scroll number key. Adjust your HUD style to whatever theme you like through the settings menu, as of now we have two styles already available for all players, 'White on Black' and 'Black on White' with more coming soon. We even plan to open up design submissions to the community, so anyone can make their own HUD design using our provided templates and if it receives enough approval, we'll add it in-game! White on Black HUD Style. Black on White HUD Style. A ton of extra settings exist and can be found in the F10 menu in-game to toggle on graphical enhancements, shaders, or adjust how certain scripts react to your actions and make them do what you prefer. Preventing Abuse As with every server, we plan to have a large staff team at some point, and tracking the actions of each and every member can be quite time consuming, and some unintended actions can slip past unnoticed. We've tailored different ideas as to how we can resolve this, and at the end of the day we can have as many policies, regulations and rules in place but this doesn't stop the pesky habits of administrators who think they can slip past them all to get a quick weapon, item or vehicle fix. Everything and anything they do is logged, along with live notifications being sent to managers on duty with their actions for every command that can be abused in one way or another. If a staff member abuses the commands they have access to or breaks any rule and there is no manager online to see it, there are measures we put in place, allowing us to ensure that everyone is maintaining a very high standard. Performance Hey, with everything going on and all these great features being brought forward, where do we stand in terms of performance? All our code is written and rewritten multiple times until we're happy that it's at its most optimal and the highest standard possible. Promising such great and advanced features is one thing, being able to use them seamlessly is another so we've taken it as our goal to ensure that low end computers still have a chance to experience what we have to offer. We continuously check and monitor the usage of each resource occasionally to avoid the common mistakes other servers make, such as memory leak or high CPU usage. Prior to a public launch, we plan to run tests on virtual machines and try out different specifications to see how resources react and assess the playability until we're satisfied. A public graph will also be provided displaying the minimum and recommended specifications. Please bare in mind that MTA functions on only one CPU core, so even if you have a beefy super computer with an i9 processor and a ram size of 512GB, you'll still experience FPS drops for rendering and object loading in minor occasions. DEVELOPED BY YOU Development is a process that requires a lot of decisions to be made. An ideal community can only be built up when ideas and decisions are put into discussions - the best way to do is to hear everyone out, the whole community. We want to make roleplaying enjoyable for everyone, in all areas, fields and roles of roleplay. The reason we are publicizing the community rather early in development is for the sake of determining important decisions and features which will be utilized by the players for months to come. Each month we will be posting what progress has been made, constantly be creating surveys and initiating discussions regarding what features we need to pursue in order to satisfy every kind of player. We urge you to contribute to discussions and to make your opinion heard, everything is equally considered. The community will pave the road ahead. If you possess programming skills that you believe are of use to us, we always appreciate and urge developers willing to dedicate themselves to this project to apply for the Development Team here. Keep in mind that we have a very high standard that we maintain throughout development in order to reach the perfect balance of performance and enjoyability. We urge all newcomers with roleplaying experience to start a discussion, introduce themselves within the community or give us feedback regarding our ideas! When you've gotten comfortable, send us your suggestions and what you want to see in the server. Let's make something great together. Thanks for reading! CREDITS All content displayed is developed directly by the Emerald Gaming Development Team with the exception of any listed resources and/or code obtained from external sources. @thisdp for his original dxLibrary. @Grozz for assistance with 3D interface functions. @ryden for original superman resource. Stay up to date with Emerald Gaming and our progress!
    1 point
  3. I think the ped would only be virtualized and won't fall at all until a player gets in streaming distance. Even if it would fall, the ground itself/collisions are not loaded unless a player is in the area, so the ped would just fall forever and again. I'm not completely sure of this, though - maybe somebody more knowledgeable can step in and give us a definitive answer?
    1 point
  4. Will this improve my errors I wrote above? Please answer
    1 point
  5. function list () local ping = {} for i, player in pairs(getElementsByType("player")) do table.insert(ping, getPlayerPing(player)) end return unpack(ping) end
    1 point
  6. function getPlayersName () local playerNames = {} for i, player in pairs(getElementsByType("player")) do table.insert(playerNames, getPlayerName(player)) end return unpack(playerNames) end
    1 point
  7. [ [ [ "Ciastuus", 28 ] ] ] I create a list of players with information about them in php. And that's how it looks The problem is that if there are more players, everything breaks down @gpetersz do you have a discord?
    1 point
  8. function listPlayer( ) local playersTable = {} for _, player in ipairs( getElementsByType ("player") ) do local name = getPlayerName( player ) local ping = getPlayerPing( player ) table.insert( playersTable, {name, ping} ) end return playersTable end addCommandHandler("testfunction", function() -- function test command outputChatBox(tostring(toJSON(listPlayer())), getRootElement()) end)
    1 point
  9. Puedes hacer que ese shader se cargue únicamente en 1 zona, algo que yo hice hace poco.
    1 point
  10. function listPlayer( ) local table = {} for _, player in ipairs( getElementsByType ("player") ) do local name = getPlayerName( player ) local ping = getPlayerPing( player ) table.insert( table, {name, ping} ) end return table end
    1 point
  11. Only solution that won't require any players nearby would be to manually collect the possible positions for the airdrop ground point and 'fake' the randomness by just randomly selecting one location from your list and spawn supplies there (or actually 200 units above, so you can move it to the ground). I personally dislike this type of solution as it requires quite a bit of setup, but I believe there's no other way that wouldn't imply having a player present in the area to query the engine for ground position. I'd recommend using a custom element type in the map editor for the supply drop, to quickly lay out the locations and to keep them easily editable.
    1 point
  12. Send the ping, with the names to the php. local playername = getPlayerName( player ) local ping = getPlayerPing( player ) table.insert( players, {playername, ping} )
    1 point
  13. Tienes que usar shaders
    1 point
  14. Não tenho conhecimento com shaders. Já tentei aprender aqui mas o pessoal (pelo menos da área internacional) não quis me dar uma luz. Se tiver dúvidas quanto a programação Lua, dai posso te ajudar.
    1 point
  15. Resumindo todas as suas perguntas: Salvar dados entre as sessões dos jogadores, evitando que percam tudo ao deslogar. Depende do script, e da quantidade de acessos simultâneos que é feito no banco de dados. Acessar um banco de dados não é tão leve assim. O uso de banco de dados se deve com o objetivo de salvar dados entre as sessões, não para poupar processamento. É claro que, é muito mais viável e mais leve você salvar em um banco de dados do que ficar criando mil variáveis no seu script. Imagine salvar cada coordenada dos jogadores em uma variável do seu script, cada jogador iria consumir a memória de 3 variáveis só para salvar sua posição. Sim. Um grande exemplo disso é o sistema de casas. A staff cria as casas no servidor e elas ficam lá mesmo se o servidor for reiniciado. Para salvar as posições e configurações de cada casa, o script salva tudo no banco de dados. Ao ser iniciado, o script carrega os dados novamente e já cria as casas nas posições e configurações salvas. Além é claro, de salvar os proprietários das casas, para não ser necessário comprar novamente a casa após reiniciar o resource.
    1 point
  16. @#ibrahim انسان طيب وخلوق @iMr.WiFi..! م يقصصر طول عمرهه للاسف م اعرف كثير ناس ب المنتدى .. والبقيه كلكم بالقلب .
    1 point
  17. الاسم : محمد 2016 -2018 mta بدايتي في تعلمت : lua ..
    1 point
  18. It's only play sound when enter to the vehicle from OUTSIDE. More tasks: https://wiki.multitheftauto.com/wiki/List_of_player_tasks Maybe you need: TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE, TASK_SIMPLE_CAR_OPEN_LOCKED_DOOR_FROM_OUTSIDE, TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_INSIDE, TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_OUTSIDE -- CLIENT function checkEnter() local a,b,c,d = getPedTask(getLocalPlayer(), "primary", 3) if tostring(b) == "TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE" then playDoorSound() removeEventHandler("onClientRender", getRootElement(), checkEnter) end end function playDoorSound() outputChatBox("playSound()") end addEventHandler("onClientVehicleStartEnter", getRootElement(), function(player) if player ~= localPlayer then return end addEventHandler("onClientRender", getRootElement(), checkEnter) end)
    1 point
  19. ابيك انت وافكارك كلمني بالخاص
    1 point
  20. http://xg-clan.com Visitem Servidor sempre 32/32 cheio de PT's pros ^^
    1 point
  21. If your MTA crashes on startup or during game load, or complains "Your client has been modified," please try the following before starting a new topic: If MTA is claiming that you have a modified client, please be sure you are running MTA on a clean, unmodified installation of Grand Theft Auto. If you are unsure, reinstall both the game and MTA 0.5r2 and try again. Delete the gta_vc.set or gta3.set file located in the GTA Vice City User Files or GTA3 User Files (depending on which game you have issues with) in your Documents folder/library (Windows Vista and 7 users) or My Documents directory (Windows XP users). If you're getting an "Invalid Executable" error, try Talidan's Invalid Executable Patcher if you have a German or Australian copy of GTA:VC. Otherwise, try to find a 1.0 No-CD executable. If your anti-virus is claiming MTAClient.exe as a virus, add an exception and read here for an explanation. Install the latest DirectX runtimes. If your issue is not listed here, check the Known Issues with MTA 0.5r2 topic for more obscure issues and potential fixes. If none of the above help your issue, please try reinstalling both GTA and MTA 0.5r2. If that still doesn't resolve your issue, please post a new topic and describe in detail what your issue is. Thank you!
    1 point
×
×
  • Create New...