Leaderboard
Popular Content
Showing content with the highest reputation on 07/04/18 in all areas
-
What's the exact problem with tea encryption? It's ofc not as powerful as something like AES, but it's not possible to implement an effective and secure encryption of assets anyway as you'd always have to send the secret key to the client at some point. Thus, just intercepting the secret is much easier and faster than trying to break/brute-force TEA. The easiest way to make use of compression is to set up an external http server and enable gzip compression in its config. Topic: C++ addons will not be implemented because of the reasons Saml1er mentioned in his post above. If you really need specific functions though (e.g. AES encryption functions for Lua), you can request them on mantis or submit a pull request on GitHub.2 points
-
No exemplo que eu dei, ele já faz isso quando vc aperta a tecla N em cima do marker. Ele desconta $10 do jogador.1 point
-
Estou vendo aqui, que o resource calcula a fome somente com base no tamanho da barra de fome e não salva esse valor em lugar nenhum. Se o resource for reiniciado ou o jogador reconectar no servidor, ele volta ao 100%. Além disso, pelo que entendi do código, ele come automaticamente o hamburger ao encostar no marker, e recarrega de graça toda a fome. Mas você quer q seja necessário apertar a tecla N depois que entrou no marker para comprar o lanche. Na última função do markerHit (client.lua), delete a função e cole isso tudo: function recarregaFome (key, state) if (getHungerState (localPlayer) < 60) then if getPlayerMoney () >= 10 then setHungerState (localPlayer,100) outputChatBox ("Você pagou $10 pelo hamburger.",255,255,0,false) outputChatBox ("Você está alimentado :D",0,255,0,false) triggerServerEvent ("take10money", localPlayer) -- Executa a função no server.lua else outputChatBox ("Você não tem dinheiro suficiente!",255,0,0,false) end else outputChatBox ("Você não está com fome!",255,0,0,false) end end addEventHandler ("onClientMarkerHit",getRootElement(), function(hitEle,dim) if (localPlayer == hitEle) and (getElementData (source,"HAMBURGUER!") == true) then bindKey ("n", "down", recarregaFome) guiSetVisible (windowMessage, true) -- Mostra a mensagem GUI que já foi criada antes. end end) addEventHandler ("onClientMarkerLeave",getRootElement(), function(leaveEle,dim) if (localPlayer == leaveEle) and (getElementData (source,"HAMBURGUER!") == true) then unbindKey ("n", "down", recarregaFome) guiSetVisible (windowMessage, false) -- Oculta a mensagem GUI. end end) Para fazer o jogador pagar, você deve fazer isso server-side, pois tirar dinheiro do jogador client-side não vai dar certo, já que vai tirar uma "grana falsa" e ele vai continuar com a mesma quantidade no servidor. Para isso, crie um script server.lua, declare-o no meta.xml e coloque isso no server.lua: function pagarHamburger () takePlayerMoney (client, 10) end addEvent ("take10money", true) addEventHandler ("take10money", getRootElement(), pagarHamburger) Declaração no meta.xml: <script src="server.lua" type="server"/> Para criar a mensagem GUI, informando para apertar a tecla N para comprar o hamburger, volte ao início do script client.lua, no começo da primeira função e crie o painel GUI com a mensagem lá, bem no início da função do onClientResourceStart. Coloque isso lá: windowMessage = guiCreateWindow (0.0260,0.6,0.1828,0.08, "Lanchonete", true) message = guiCreateLabel (0.05,0.5,1,1,"Pressione 'N' para comprar hamburger.",true, windowMessage) guiSetVisible (windowMessage, false)1 point
-
Return will return the value after it to the caller. In this case your "return ... end" actually just stopped executing the rest of the code. if (1 == 1) then return end print "This will never get triggered." An example of how return can be used... local function getAge(name) if (name == "John") then return 30 elseif (name == "Jane") then return 31 end end print("John's age is " .. (getAge "John")) -- Will print John's age is 30 print("Jane's age is " .. (getAge "Jane")) -- Will print Jane's age is 31 print("Jack's age is " .. (getAge "Jack" or "unknown")) -- Will print Jack's age is unknown1 point
-
Seems it does save the position but the camera is not faded in. Add the following line of code after setCameraTarget. fadeCamera(source, true) Full script would now look like this: local randomSpawnTable = { { x = 270.92654418945, y = -1986.3665771484, z = 797.52966308594, rotation = 0, model = 312, interior = 0, dimension = 0 }, { x = 270.92654418945, y = -1986.3665771484, z = 797.52966308594 }, { x = 270.92654418945, y = -1986.3665771484, z = 797.52966308594 } } -- Once the player logs in, let's spawn them to their saved position or a random spawnpoint addEventHandler("onPlayerLogin", root, function(_, account) -- Get the saved x, y, z position from the account data local x, y, z = getAccountData(account, "posX"), getAccountData(account, "posY"), getAccountData(account, "posZ") -- Get the saved rotation from the account data and default to 0 local rotation = getAccountData(account, "rotation") or 0 -- Get the saved model (skin) from the account data and default to 312 local model = getAccountData(account, "model") or 312 -- Get the saved interior from the account data and default to 0 local interior = getAccountData(account, "interior") or 0 -- Get the saved dimension from the account data and default to 0 local dimension = getAccountData(account, "dimension") or 0 -- If account data was missing any of the coordinates if (not x) or (not y) or (not z) then -- Get a random spawnpoint from the spawnpoint table local randomSpawnPoint = randomSpawnTable[math.random(#randomSpawnTable)] -- Overwrite coordinates and other details with spawnpoint details or fall back to the data above x, y, z = randomSpawnPoint.x or 0, randomSpawnPoint.y or 0, randomSpawnPoint.z or 3 rotation = randomSpawnPoint.rotation or rotation model = randomSpawnPoint.model or model interior = randomSpawnPoint.interior or interior dimension = randomSpawnPoint.dimension or dimension end -- Spawn the player to the location spawnPlayer(source, x, y, z, rotation, model, interior, dimension) -- Give weapons giveWeapon(source, 46) giveWeapon(source, 9) giveWeapon(source, 25, 5000) giveWeapon(source, 28, 5000) giveWeapon(source, 31, 5000) giveWeapon(source, 22, 5000, true) -- Reset their camera target and fade the camera in setCameraTarget(source) fadeCamera(source, true) end) -- Let's create a new savePlayer function for general use function savePlayer(player, account) -- Make sure we have passed in an element if (isElement(player)) then -- Get the player's account account = account or getPlayerAccount(player) -- If the player has an account if (account) then -- Get the player element position local x, y, z = getElementPosition(player) -- Get the player element rotation local _, _, rotation = getElementRotation(player) -- Set the account data setAccountData(account, "posX", x) setAccountData(account, "posY", y) setAccountData(account, "posZ", z) setAccountData(account, "rotation", rotation) setAccountData(account, "model", getElementModel(player)) setAccountData(account, "interior", getElementInterior(player)) setAccountData(account, "dimension", getElementDimension(player)) return true end end return false end -- Once the player logs out, let's save the player to their old account addEventHandler("onPlayerLogout", root, function(account) savePlayer(source, account) end) -- Once the player disconnects, let's log them out (which triggers savePlayer) addEventHandler("onPlayerQuit", root, function() logOut(source) end)1 point
-
مافي الا انك تسوي احداثيات للبيد في الاماكن الي تبيها وبعدين تسوي راندوم للاحداثيات طبعا تكون الاحداثيات بجدول وبعد ماتجيب الاحداثيات تسوي البيد وتحط علامة بالخريطة على البيد وخلاص1 point
-
Ah bom. Só criar o botão que vai ficar aparecendo sempre na tela e não ocultar ele ao iniciar o resource. Faça assim: function criarPainel () local screenX, screenY = guiGetScreenSize () -- Recebe a resolução atual do jogador. (no meu caso: screenX = 1366 e screenY = 768) ----------------- CRIA A JANELA ------------------------------------------------------------------ janelaPrincipal = guiCreateWindow (0.4, 0.4, 0.2, 0.2, "Janela Qualquer", true) -- Cria a janela. mensagem = guiCreateLabel (0.05, 0.2, 1, 0.2, "Texto de informação qualquer aqui.\nOutra linha de informação aqui.", true, janelaPrincipal) -- Cria o texto na janela. guiSetVisible (janelaPrincipal, false) -- Oculta a janela depois dela ser criada, para que ela não apareça ao iniciar o resource. botaoGeral = guiCreateButton (0, screenY/2, 30, 30, ">>", false) -- Cria o botão na tela. ----------- MOSTRA/OCULTA A JANELA (clicando no botão da tela) ---------------------------------------- function mostraPainel (button, state) if button == "left" then if not isVisible then guiSetVisible (janelaPrincipal, true) -- Torna o painel visivel. showCursor (true) -- Mostra o cursor na tela. else guiSetVisible (janelaPrincipal, false) -- Torna o painel invisivel. showCursor (false) -- Oculta o cursor da tela. end isVisible = not isVisible -- Alterna entre visivel/invisivel a cada vez que clicar no botão. end end addEventHandler ("onClientGUIClick", botaoGeral, mostraPainel, false) -- Executa a função mostraPainel ao clicar no botao >> end addEventHandler ("onClientResourceStart", getRootElement(), criarPainel) -- Faz isso tudo ao iniciar o resource no jogador. Obs: Para conseguir clicar no botão da tela, vc pode usar a tecla T ou o F8 (pra mostrar o cursor).1 point
-
1 point
-
Favor não usar formatação de fonte em tamanhos muito grandes, ninguém aqui é cego e isso pode ser considerado como Spam. Voltando a sua dúvida, sugiro que leia a Wiki na parte de GuiCreateWindow, já que vc precisa primeiramente criar uma janela GUI, com os botões e textos nela, depois vc configura uma tecla para fazer essa janela aparecer na tela. Fiz este exemplo para mostrar algumas funções principais, como o guiCreateWindow, guiCreateLabel, guiCreateButton, guiSetVisible, showCursor e onClientGUIClick function criarPainel () ----------------- CRIA A JANELA ------------------------------------------------------------------ janelaPrincipal = guiCreateWindow (0.4, 0.4, 0.2, 0.2, "Janela Qualquer", true) -- Cria a janela. mensagem = guiCreateLabel (0.05, 0.2, 1, 0.2, "Texto de informação qualquer aqui.\nOutra linha de informação aqui.", true, janelaPrincipal) -- Cria o texto na janela. botaoFechar = guiCreateButton (0.4, 0.7, 0.2, 0.2, "FECHAR", true, janelaPrincipal) -- Cria o botão na janela. guiSetVisible (janelaPrincipal, false) -- Oculta a janela depois dela ser criada, para que ela não apareça ao iniciar o resource. ------------- MOSTRA A JANELA (pela tecla K) ----------------------------------------------------- function mostraPainel (key, keystate) guiSetVisible (janelaPrincipal, true) -- Torna o painel visivel. showCursor (true) -- Mostra o ponteiro do mouse na tela. end bindKey ("k", "down", mostraPainel) -- Executa a função mostraPainel ao apertar a tecla K. ----------- OCULTA A JANELA (clicando no botão da janela) ---------------------------------------- function ocultaPainel (button, state) if button == "left" then -- Se o botão do mouse que clicou for o botão esquerdo, então: guiSetVisible (janelaPrincipal, false) -- Torna o painel invisivel. showCursor (false) -- Oculta o ponteiro do mouse. end end addEventHandler ("onClientGUIClick", botaoFechar, ocultaPainel, false) -- Executa a função ocultaPainel ao clicar no botaoFechar. end addEventHandler ("onClientResourceStart", getRootElement(), criarPainel) -- Faz isso tudo ao iniciar o resource no jogador. Sugiro que leia cada link mencionado acima para saber como funciona cada um. Deixei comentários pelo código para ficar mais fácil de entender.1 point
-
Sobre a pasta [ModsEmDesenvolvimento] que você nomeou para o resource, talvez você já tenha entendido como funciona, mas explicando o uso dos colchetes: Isso serve como uma pasta para deixar tudo melhor organizado, por exemplo, você quer separar scripts em desenvolvimento no seu servidor, então você cria uma pasta [desenvolvimento] na pasta de resources, e dentro dela, todos seus resources ao qual se aplica a essa pasta. Assim como já vem as pastas padrão do MTA gamemodes, managers, gameplay, etc. Então no comando resource src dentro do mtaserver.conf, você carrega resource por resource. Parâmetros: startup - 1 : ligado; 0 : desligado protected - 1 : não será possível parar o resource; 0 : padrão Com relação ao código Lua, você está separando a parte do comando e da função em lados diferentes, te aconselho a ir se aprofundando em tutoriais sobre server e client, não sei se você já tem um conceito básico sobre client em multiplayer (isso facilitaria mais pra você aprender mais rapidamente), mas enfim, qualquer dúvida é só perguntar aqui. Sendo assim, o seu código que é do lado server, deve ser colocado todo junto assim como o Lord já explicou.1 point
-
Já que vc está começando a estudar a linguagem Lua do MTA, sugiro que leia a Wiki: https://wiki.multitheftauto.com/wiki/PT-BR/Introdução_ao_Scripting Você precisa ser administrador do seu servidor para poder mexer nele. Ou então vc pode ir no Console (aquela espécie de Prompt de Comando que aparece quando vc liga seu servidor) e mandar o comando refresh nele. (não se usa a / ali) e depois usar start darGrana Mas de qualquer forma, você vai precisar ter acesso admin no seu servidor para fazer as coisas nele.1 point
-
Não use a função givePlayerMoney no lado Client, pois vai setar uma "grana falsa" na sua tela, mas no servidor vc vai continuar tendo a grana de antes. E isso não vai funcionar <resource src="ModsEmDesenvolvimento" startup="1" protected="0" /> Pois você deve colocar o nome do resource e não o nome da pasta principal. Faça assim: Na sua pasta [ModsEmDesenvolvimento], crie outra pasta dentro dela com o nome darGrana. (pode ser outro, é um exemplo) O nome desta sub-pasta será o nome do seu resource. Dentro da pasta darGrana, crie 2 arquivos.txt vazios. Depois renomeie 1 deles para server.lua (pode ser qualquer coisa.lua) e o outro para meta.xml (tem q ser exatamente assim) Abra o meta.xml e cole isso: (oq importa é a linha do script, mas é importante vc já saber colocar as infos no seu resource.) <meta> <info author="Leonardo" version="1.0.0" name="Dar dinheiro" description="Dá $500 para si mesmo ao usar o comando /grana." type="script" ></info> <script src="server.lua" type="server" /> </meta> Salve e feche o meta.xml, depois abra o server.lua e cole isso: function receberGrana (thePlayer) givePlayerMoney (thePlayer, 500) end addCommandHandler ("grana", receberGrana) Salve e feche o server.lua. Vá no seu servidor, e use /refresh. Abra o painel admin, na aba resources, dê refresh na lista de resources e procure por darGrana. Selecione-o e clique em Start. Feche o painel admin, e use o comando /grana E receba os $500 que vc programou no script. Não se esqueça de colocar o seu resource para iniciar automaticamente ao ligar o server. Coloque isso no mtaserver.conf: <resource src="darGrana" startup="1" protected="0" /> Para verificar se há problemas em seu script, deixe o /debugscript 3 ativado. Qualquer dúvida, volte a perguntar aqui mesmo. Espero ter ajudado, boa sorte.1 point
-
Yes you need to add it again. Better to clear the innerHTML in text-chat instead.1 point
-
Denny199 his reply is very useful. This will give you everything you need.1 point
-
Several others with the same Error 5: access denied were running AVG anti-virus, just like you. AVG is probably causing it, whitelist MTA & GTA or disable/uninstall AVG. Inform us of the results, @Slammer1 point
-
بسم الله الرحمن الرحيم السلام عليكم ورحمة الله وبركاته سكربت للتحكم باذونات الـACL سكربت يسهل عليك التحكم باذونات الـACL لقطة : الميزات: القدرة على اضافة اذونات جديده او حذف اذونات موجودة والقدرة على التعديل على الاذونات الموجوده مثل السماح او المنع او الحذف القدرة على إعادة تحميل ملف الاذونات acl.xml عن طريق الزر Reload ACL المتطلبات: * يجب اضافة السكربت لـ قروب ادمن * يجب عليك اضافة نفسك إلى قروب كونسل ( القروب المسموح له افتراضياً ) تستطيع التعديل عليه من الاعدادات الاستخدام : * أكتب /apm لفتح النافذه التحميل : https://community.multitheftauto.com/ind ... ls&id=6622 ارجو منكم التقييم و التعليق ^^1 point
-
السلام عليكم , حسب إشاعات في موقع التواصل الإجتماعي ; قد كلم أخو مستر قراند شخص بأنه قد توفي , الله يرحمه , ادعوله بالرحمة @MR.GRAND وقد ورد أنه توفي بحادث .0 points
-
الله اعلم لكن الله يرحمه ويسكنه فسيح جناته هذا الدعاء يجوز للحي والميت فمافي ضرر منه0 points
