Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 13/06/19 in all areas

  1. [TUT] Scaling DX The reason why I am creating this topic, is because there are a lot of people asking this question: And to be honest there is no best practice for. But here you have my recommendation as guidance for display them the ~s~a~m~e~ for all screen formats. There are two important factors while dealing with screen formats 1. Pixel density Indication: PPI(Pixels Per Inch) and some also use the term DPI(Dots Per Inch) They do not have to be the same while talking about printing stuff. This indication tells us about how many pixels are used per inch. Which more or less tells us how sharp/smooth things like text can be looking. PPI doesn't really play a big role, but to display something nicely you need enough pixels to display it. Else it will be either too small or too crispy. So be careful to not scale things (especially text) too small. 2. Display aspect ratio Wiki The difference between resolution X and resolution Y as a ratio. A list of common ratios: 4:3 5:4 3:2 16:10 16:9 So for example if we take: fHD: 1920x1080 Which has the ratio 16:9 that is calculated like this: 1920 / 16 = 120 120 * 9 = 1080 Scaling without ratio Before I am going to explain any of this, I am going to ask you an important question: Like this: (vertical) ▮ Or horizontal? ▅ I assume most people would agree to play MTA horizontal, else you are probably reading a book or document. p.s If you play MTA on a vertical screen, then we developers do not like you at all, sorry. So what does this tell us? You can assume that the X-resolution is never going to be smaller than the Y-resolution. Useful? You will figure it out. Doing the scaling Note: This part is ABOUT SCALING and not positioning. So what we are going to do is: Calculating a scale which can display the same DX on multiple screen formats > without messing with the ratio. Example: A computer runs MTA at a resolution of 1920 x 1080. Lets define that! local devScreenX = 1920 local devScreenY = 1080 If this code is used by a different pc, we also need to know on which resolution it is running: local screenX, screenY = guiGetScreenSize() For the next step we have to look at this screenshot: I have cut out of the wide-screen format a square. Squares have the ratio 1:1, which means that we have removed our ratio difference from this screen resolution. It is very easy to do, as our Y * Y resolution makes exactly that beautiful square! The next thing we have to do is creating our scaling value. This value is required for adjust our resolution values so that they match to every screen format. So to use our ratio 1:1, we use the Y resolution to achieve that: local scaleValue = screenY / devScreenY And as last we can create a rectangle shape that is displayed at the center of every screen format, perfectly! local devScreenX = 1920 local devScreenY = 1080 local screenX, screenY = guiGetScreenSize() local scaleValue = screenY / devScreenY addEventHandler("onClientRender", root, function () -- create a scaled size local sizeX = scaleValue * 300 -- 300px local sizeY = scaleValue * 50 -- 50px -- get the center of the screen local centerX = screenX / 2 local centerY = screenY / 2 -- calculate the starting point of the rectangle local startRectangleX = centerX - (sizeX / 2) local startRectangleY = centerY - (sizeY / 2) dxDrawRectangle ( startRectangleX, startRectangleY, sizeX, sizeY, tocolor ( 255, 255, 255, 255 ) ) end) Lower limit What if we have a resolution of 800x600? And the text is getting too small? Making sure that the pixel density is OK, is very important. So to counter that we have to make sure that the text is not getting too small. Our development Y resolution is 1080 pixels. And we are dealing with an Y resolution 600 pixels. The first thing we are going to look at, is what the scale is going to be at that point. 600 / 1080 = 0.55555555555555555555555555555556 It is not very nice to have your text scaled to 55.5% of the original size, when having low resolution already. But without scaling, the DX stuff might fill up the entire screen and that is just as bad. So what we now need is a limit, in this case a lower limit. scaleValue = math.max(scaleValue, 0.65) The math.max function returns the highest value of all the arguments you put in to it. In this case it contains the: scaleValue: 0.555 And the lower limit of: 0.65 This will make sure that the DX stuff is not getting smaller than 65%. This might make text read able for a 800x600 resolution. Positioning Do you want to place your dx-effects at a specific place on your screen? See the following useful function: https://wiki.multitheftauto.com/wiki/GetScreenStartPositionFromBox
    3 points
  2. السلام عليكم ورحمة الله وبركاته تعديل من لوحة ادمنية اضغط على settings اكتب o هتطلع اسمAdminMsg مثلا AdminMsg [name] [text] ومنها انت تقدر تغير اي اسم ِ وفي هذه البرنامج قمت ببعض التعديلات مثل إضافة إظهارأو إخفاء كلمة السر وتذكرني و اختيار اللغة عربي او انجليزي وهنا في خانة send عند text تقدر تكتب اي نص ولو طويل جدا يمكنك ان تراه باكمله Options وهنا في هذه الصورة عند تحـريك المربع اللي باللون الازرق بأي اتجاه تريده وتكبير وتصغر المربع وكذلك تكبير وتصغير الخط للتحميل من هــــنــــا وشكرا ارجوا ان ينال رضاكم
    3 points
  3. A definitive fix is available. Install this update: https://nightly.multitheftauto.com/?mtasa-1.5-rc-latest @Flexxy @Willian#
    2 points
  4. Cara, as janelas são criadas client-side. Você deve usar guiSetVisible (janela, false) logo depois de criar a janela, assim ela não vai aparecer pra ninguém. Depois vc mostra ela novamente somente pros jogadores específicos usando triggers. Mas pra isso vc vai precisar mandar pro server, pra ele então mandar pros outros clientes. client-side: local x,y = guiGetScreenSize() -- Padrão de qualquer painel. guiPanel = {} -- Faz todos os elementos GUI dentro de 1 table pra economizar espaço na memória. function createPanel () -- ======(PAINEL FEITO DE QUALQUER JEITO SÓ DE EXEMPLO)====== guiPanel["window"] = guiCreateWindow (x/2 - 150, y/2 - 150, 300, 300, "Default Window", false) -- Janela qualquer. guiPanel["edit"] = guiCreateEdit (10, 20, 280, 30, "(Nick exato do outro player)", false, guiPanel["window"]) -- Campo de input pra botar o nick do outro jogador. (tem que incluir os códigos de cores, se tiver. No seu caso é uma gridList que funciona diferente disso) guiPanel["button1"] = guiCreateButton (300/2 - 50, 300 - 40, 100, 30, "CHAT", false, guiPanel["window"]) -- Botão qualquer, que serve pra ativar o trigger. guiSetVisible (guiPanel["window"], false) -- Oculta de cara a janela, pra ela não aparecer pra ninguém. -- O painel vai estar criado em todos os clientes, mas não estará visível em nenhum deles. end addEventHandler ("onClientResourceStart", resourceRoot, createPanel) addCommandHandler ("testar", function (cmd) -- Comando qualquer pra fazer o painel aparecer só no cliente que executar o comando. guiSetVisible (guiPanel["window"], true) showCursor (true) -- Mostra o cursor para poder interagir com o painel. end) function interactionPanel (button, state) if (button == "left" and state == "up") then -- Verificação de segurança padrão. if (source == guiPanel["button1"]) then -- Verificação de botão clicado padrão. local theOther = getPlayerFromName(guiGetText(guiPanel["edit"])) -- Recebe o jogador usando o nick informado no campo de input. if theOther then -- Se existe um jogador com o nick informado, então: guiSetVisible (guiPanel["window"], false) -- Oculta a janela principal. guiPanel[guiGetText(guiPanel["edit"])] = guiCreateWindow (x - 400, y/2 - 200, 400, 400, guiGetText(guiPanel["edit"]), false) -- Cria a janela com o nick do outro cara como título. triggerServerEvent ("ClientServerChat", theOther) -- Ativa este evento no servidor, usando o outro jogador como source. Isso vai criar a janela no outro cara também, com o nosso nick. else outputChatBox ("Player não encontrado, informe o nick exato junto com os códigos de cores.") end end end end addEventHandler ("onClientGUIClick", guiRoot, interactionPanel) -- (Aprendi esses dias aqui no fórum) guiRoot ativa para todos os elementos GUI deste resource. É mais leve do que root. function getUpdate (otherPlayer) -- Isso aqui executa no outro jogador. Nós somos o otherPlayer. guiPanel[getPlayerName(otherPlayer)] = guiCreateWindow (x - 400, y/2 - 200, 400, 400, getPlayerName(otherPlayer), false) -- Cria a janela com o nick do otherPlayer. end addEvent ("ServerClientChat", true) -- Recebe o painel do servidor. Normalmente junto com a mensagem e o jogador que está mandando a mensagem. addEventHandler ("ServerClientChat", resourceRoot, getUpdate) server-side: function transferData () -- Imagine isso apenas como uma ponte entre os clientes. Pode ser usado para tranferência das mensagens. triggerClientEvent (source, "ServerClientChat", client) -- source = o outro player | client = o localPlayer de onde veio este evento (nós) -- Ativa o evento "ServerClientChat" no cliente do source (outro cara) usando client (nós) como parâmetro de função. end addEvent ("ClientServerChat", true) -- Este evento é ativado no servidor pelo nosso cliente. addEventHandler ("ClientServerChat", resourceRoot, transferData)
    1 point
  5. Já mostrei o que você precisa, você não entendeu com clareza por que não entende nada de scripting. Se quiser código pronto com mais clareza está aqui:
    1 point
  6. Does the problem occur with this version of MTA? https://nightly.multitheftauto.com/mtasa-1.5.6-rc-16588-20190310.exe
    1 point
  7. عاااش جداً واصل يابطل .. ❤?
    1 point
  8. نمزح ي ذكي . في احد يتهاوش عشان سكربت ؟؟ ?
    1 point
  9. setTimer ( function ( source ) if getElementData( source, "onMission" ) == true then if playersIntoMission < 1 then OutPut ( "✱⌠ ! لم تبدأ مهمة الركض لعدم توفر اللاعبين ⌡✱", root, 255, 0, 0, true ) killPed ( source ) setElementData( source, "onMission", false ) playersIntoMission = 0 MissionStart () return end end end, 3000, 1 ,source) لو مـ اشتغل اطرح لنا الكود كامل
    1 point
  10. Please refer to last posts in: https://forum.multitheftauto.com/topic/117131-network-trouble/?do=findComment&comment=956229 We found another issue and will release a new update ASAP. @Willian#
    1 point
  11. Okay, we just confirmed the problem. The revert of buggy changes failed partially. Thanks for helping us to test, stick to that build until we get a final update.
    1 point
  12. @Flexxy, i just checked your client and it turns out you're not using the right update. You're on r18560 and the fix for spectator issues arrived in r18660. You can verify that you're not updated by writing "ver" in F8 console. Please install this build: https://nightly.multitheftauto.com/?mtasa-1.5-rc-latest So all doubts about the fix in this topic are thus far unconfirmed
    1 point
  13. This looks like the issue described earlier in https://forum.multitheftauto.com/topic/103371-lag-while-spectating-players/ Should be unrelated. Contact the server admins/scripter. Note: there are 2 reported cases of this, the other one is at https://forum.multitheftauto.com/topic/117431-network-trouble/. It appears that in both cases, the affected server is FFS Gaming. Maybe they tried applying a (hacky) script fix to try work around the network troubles that were fixed yesterday, before it got fixed in an MTA update. It could also be that this was just sometimes present on FFS, and you notice now because your attention is pinned on it now. Please contact FFS admins, nonetheless I'll also try to dig a little deeper.
    1 point
  14. www.amdoren.com is very good
    1 point
  15. Why not store the credentials in a XML file on the client's PC? Using db stuff for this doesn't make sense. Oh, and remember to use https://wiki.multitheftauto.com/wiki/PasswordHash for the password.
    1 point
  16. @salh This code doesn't do anything. You haven't defined the `getUserAndPass` function. Furthermore, you wouldn't be saving the actual password, you'd be using a token based system. @Master_11 Please see this tutorial which includes a "remember me" functionality
    1 point
  17. Está iniciando seu servidor ou começando scripting no MTA? Aqui será listado tudo o que você precisa para aprender desde configurar seu servidor, ACL, colocar resources, até aprender Lua no MTA e criar scripts para modificar o jogo por meio da programação. Se você é totalmente leigo no assunto você também verá links que irá te introduzir no nível básico da programação, basta ter o mínimo de esforço e acompanhar os tutoriais aqui mostrados. Se você já têm uma noção de programação, encontrará tutoriais que irão te ajudar a se aprofundar na programação Lua e ter uma boa experiência de Scripting no MTA. Informações relacionadas ao MTA Se você busca configurar corretamente o seu Servidor e entender como as coisas funcionam, estes links serão de grande ajuda: Links traduzidos para português Manual do Servidor ACL - Lista de Controle de Acesso Resources (ou Recursos) - O que são? O arquivo meta.xml Quer programar scripts? Acompanhe este links: Nota: Se você é um iniciante na programação veja também os tutoriais para iniciantes em: Iniciando na programação Introdução a Scripting no MTA (link útil) Programar GUI no MTA Depurando seu código Programação e a linguagem Lua Iniciando na programação: Vídeo - Introdução a Algoritmos Introdução aos Algoritmos Vídeo - Lógica de programação Programação Lua: Conheça a linguagem Lua Manual de Referência de Lua 5.1 Playlist - Programando em Lua (vídeo) Playlist - Curso de programação em Lua (vídeo) Introdução à linguagem de programação Lua Teaching-lp seminario-Lua PDF Outros links (em inglês): Lua.org Lua wiki www.tutorialspoint.com/Lua Lista de tutoriais e manuais Lua Sub-fórum - Tutorials E também: Tutoriais: sub-fórum da seção Portuguesa Editores para programar e Ferramentas Com plugins/extensões do MTA disponíveis: - Notepad++ | Plugins do MTA - Sublime Text | Plugins (Atualizado: link) - Visual Studio Code | Extensões: MTA:SA Lua Debugger: MTA:SA Debugger and Test Framework - Atom Editor | Plugins Sem plugins do MTA: - ZeroBrane Studio - IntelliJ IDEA - Eclipse - Decoda Lua IDE Também: Lua for windows | GitHub
    1 point
  18. وظيفة triggerLatentClientEvent الكثير منا يتجاهلها ويستخدم triggerClientEvent والفرق اللي بينهم ان triggerClientEvent اسرع في النقل لانها بتحمل الداتا كلها مرة واحدة ولكن triggerLatentClientEvent تاخد وقت ااكثر بقليل جدا من التريقر العادي للنقل 15% CPU ولكن لما تستخدم التريقر العادي هيسحب من ال CPU ولكن بالتريقر ليتينت ما راح يسحب شئ من ال لذالك انصح باستخدام triggerLatentClientEvent بالتوفيق
    1 point
  19. السلام عليكم عيد مبارك على الكل عم اعاني من مشكلة و هي انو السيرفر بيتوقف عن العمل احيانا و انا مسوي تجديد و كل شي تمام معي سيرفر هجوله و انا تعبت و انا ارستر المودات من جديد و تقريبا هاذ الشي يحصلي مرة كل اسبوع و هاذ الخطأ من الادارة حق الاستضافة و كل الناس بتعاني منه يرجى من طاقم الادارة اصلاح الخطأ رجاءا و شكرا و اللي عنده اقتراح او حل لهاي المشكلة يقلي @Micro
    0 points
×
×
  • Create New...