Leaderboard
Popular Content
Showing content with the highest reputation on 13/09/19 in all areas
-
setVehicleHandling(vehicle, "engineAcceleration", handling.engineAcceleration + 0.4) setVehicleHandling(vehicle, "maxVelocity", handling.maxVelocity + 19)1 point
-
Tente isto: hpMin = 15 Tempo = {} ColMedic = {} function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end --==== function ChecarVida() for i, player in pairs (getElementsByType("player")) do if not getElementData(player, "PlayerCaido") then local conta = getAccountName(getPlayerAccount(player)) if getElementHealth(player) >= 1 then if getElementHealth(player) <= hpMin then removePedFromVehicle(player) setElementData(player, "PlayerCaido", true) setElementFrozen(player, true) setPedAnimation(player, "CRACK", "crckdeth3", 1, false, true, false) setTimer(function() if getElementData(player, "PlayerCaido") then killPed(player) end end, 240000, 1) end end else setPedAnimation(player, "CRACK", "crckdeth3", 1, false, true, false) end end end setTimer(ChecarVida, 200, 0) function ChecarVidaA() for i, player in pairs (getElementsByType("player")) do if getElementData(player, "PlayerCaido") then local conta = getAccountName(getPlayerAccount(player)) if getElementHealth(player) >= 31 then setElementData(player, "PlayerCaido", false) setPedAnimation(player, false) setElementFrozen(player, false ) end end end end setTimer(ChecarVidaA, 200, 0) function SetarCaidoComHS() player = source if not getElementData(player, "PlayerCaido") then removePedFromVehicle(player) setElementHealth(player, 20) setElementData(player, "PlayerCaido", true) setPedAnimation(player, "CRACK", "crckdeth3", 1, false, true, false) setTimer(function() if getElementData(player, "PlayerCaido") then killPed(player) end end, 240000, 1) end end addEvent("OnHS", true) addEventHandler("OnHS", getRootElement(), SetarCaidoComHS) function curar_jogador ( thePlayer, comando, id ) if id then id = tonumber ( id ) if id then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Samu") ) then local player_a_ser_curado = getPlayerID(id) if not player_a_ser_curado then return outputChatBox("#bebebeJogador não encontrado!",thePlayer,255,255,255,true) end local samux, samuy, samuz = getElementPosition ( thePlayer ) local curadox, curadoy, curadoz = getElementPosition ( player_a_ser_curado ) local dist = getDistanceBetweenPoints3D ( samux, samuy, samuz, curadox, curadoy, curadoz ) if player_a_ser_curado == thePlayer then outputChatBox("#bebebeVocê não pode se curar!",thePlayer,255,255,255,true) return end if ( dist > 3 ) then outputChatBox("#bebebeChegue mais perto do jogador!", thePlayer, 255, 255, 255, true) elseif ( dist < 3 )then setPedAnimation( thePlayer, "MEDIC", "CPR", 4500, true, false, false, false) setTimer ( function() if not isElement(player_a_ser_curado) then return end setElementHealth ( player_a_ser_curado, 100 ) setPedAnimation(player_a_ser_curado, false) setElementFrozen( player_a_ser_curado, false ) setElementData(player_a_ser_curado,"PlayerCaido",false) end, 4500, 1 ) end end else outputChatBox("#bebebe["..comando.."]: id inválido", thePlayer, 255, 255, 255, true) end else outputChatBox("#bebebeSintaxe: /"..comando.." [id]", thePlayer, 255, 255, 255, true) end end addCommandHandler ( "curar", curar_jogador )1 point
-
Hello guys, A while ago I've been thinking "saving data is pretty annoying.. alot of lines, you are often doing it multiple times for different scripts." So I decided to make a resource as a central handler of data storing/loading. Now I want to share this resource to the community and hope that it will also help you save some time at scripting. The resource (including its functions) are added to the MTA Wiki which can be found here. What is xmlData? xmlData is a resource that provides 3 shared (so server- and client-side) exported functions for automated saving/loding/deleting of files: xmlSaveData (Wiki Page) xmlLoadData (Wiki Page) xmlDeleteData (Wiki Page) xmlSaveData require the data it should store to be a table and xmlLoadData will return the data as a table. These functions are exported function by the resource, so you need to call them. Example: local xml = exports.xmlData local tbl = {posX = 500, posY = 300, sizeX = 300, sizeY = 200} -- Saving xml:xmlSaveData("myFileName", tbl, false, true) -- This will save the file non-serverProtected but encrypted -- or you can do this xml:xmlSaveData("myFileName", tbl, 7) -- This will save the file serverProtected, encrypted, resourceProtected -- Loading local myTable = xml:xmlLoadData("myFileName", 7) -- This will attempt to load the data saved in highest security level -- Note: You need to load the data on the same security level as you saved it. Data security This resource also gives you ways to secure the data you want to store: Server protection -- If a file is server protected, only the server that has created it is able to read/modify it Encryption -- If a file is encrypted humans won't be able to read/modify it Resource Protection -- If a file is resource protected only a resource with the same name is able to read/modify it Combining these parameters will give you different levels of security for your file. For simplification you can instead of passing booleans just pass the security level you want to have (see the functions syntax please) 0 - No protection (any server, any resource or humans could read/modify) 1 - Very low protection (creator resource on any server or humans could read/modify) 2 - Very low protection (any resource on any server could read/modify, humans cant) 3 - Low protection (only creator resource on any server could read/modify, humans cant) 4 - Medium protection (any resource on the creator server or humans could read/modify) - Default setting if no 'security parameters' are given 5 - Medium protection (only creator resource on the creator server or humans could read/modify) 6 - High protection (any resource on the creator server could read/modify, humans cant) 7 - Very high protection (only creator resource on creator server could read/modify, humans cant) Other uses You can ofc use this script for example to save protected login data, but you can also use it in these ways for example: Cross-Resource communication: You could save a file called "settings" in resourceA and then load it in resourceB. Like this you have an easy way to make your server resources talk with each other without the need of events, exported functions and passing arguments. (if the file is not resourceProtected) Cross-Server communication: One step further could be that for example mapping script settings could be synchronized between different mapping servers (if the file is not serverProtected) Download The download for this resource can be found on the MTA Community page. Note: This resource does not require admin/any acl rank. I hope you like it and it will save you some work Sincerely, Ceeser1 point
-
Too scared to show your code? The people that do not show their code, are often using code that is not theirs and they are very well aware of that. Not sure if that is the case with you, but it is absolutely ? ! ? ! ? ! ? to make sure that nobody can help you anyway!1 point
-
You might check that: https://springrts.com/wiki/Lua_Performance Loops, localize variables, unpack, and much more. I don't recommend to use ipairs at all. Int loop is much faster.1 point
-
1 point
-
Você precisa ter um sistema de id e no script substitui o getPlayerFromPartialName pelo getElementData com a data do ID do jogador. Lembre-se de postar o código com a formatação Lua clicando no botão <> @danielpaulino1 point
-
1 - Coloca uma verificação antes de chamar a função getPlayerByID, assim: if not tonumber(id) then return outputChatBox( "sintaxe: /".._.." [id]", police, 230,20,20 ) end 2 - Converta para number: local preso = getPlayerByID (tonumber(id))1 point
-
Adicione isso no script de prender, fora da função: function getPlayerByID (id) for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then return player end end end E na função que vc quer que seja por ID, troque o getPlayerFromPartialName (name) por getPlayerByID (id). Não se esqueça de substituir o parâmetro de função name por id. function colocanavtr (police, _, id) if hasObjectPermissionTo (police, "function.Prender") then local preso = getPlayerByID (id) local px, py, pz = getElementPosition (police) local bx, by, bz = getElementPosition (preso) local dist = getDistanceBetweenPoints3D (px, py, pz, bx, by, bz) if not preso then return outputChatBox ("Jogador invalido.", police, 190, 190, 190, true) end if preso == police then return outputChatBox ("Você não pode prender a si mesmo.", police, 190, 190, 190, true) end if getPlayerWantedLevel (preso) == 0 then return outputChatBox ("Este jogador não está sendo procurado.", police, 190, 190, 190, true) end if getPedOccupiedVehicle (police) then return outputChatBox ("Você não pode prender de dentro da viatura.", police, 190, 190, 190, true) end if getPedOccupiedVehicle (preso) then return outputChatBox ("Você não pode prender um bandido enquanto ele estiver dentro de um veículo.", police, 190, 190, 190, true) end if dist >= 2 then return outputChatBox ("Você precisa chegar mais perto para prender.", police, 190, 190, 190, true) end setElementData (preso, "navtr", true) addEventHandler ("onPlayerCommand", preso, onCommand) local vtr = carros[police] setElementData (vtr, "compreso", true) attachElements (preso, vtr, 0.2, -1.5, 0, 0, 0, 90) setElementFrozen (preso, true) toggleAllControls (preso, false) takeAllWeapons (preso) setPedAnimation (preso, "ped", "CAR_dead_LHS") vrx, vry, vrz = getElementRotation (vtr) setElementRotation (preso, vrx, vry, vrz+83) warpPedIntoVehicle (police, vtr) outputChatBox ("Leve o preso para a delegacia mais próxima #00ffff(sirenes azuis).", police, 190, 190, 190, true) end end addCommandHandler ("prender", colocanavtr)1 point
-
السلام عليكم ورحمة الله وبركاته اليوم سويت تعديل علي مود كان منزله واحد اجنبي بس عجبني قلت اطور فيه لفهم وظيفة المود تابع الصور ملاحظة المود للعرض بس .. لو عجب بعض الناس الي في القلب بينزل قبل التطوير للوحة الاختيار للوحة عرض الكل للوحة اذا بحث عن معلومات للاعب اذا بحثت عن اسم شخص مدخلش الخادم او بحثت عن سريال شخص لم يدخل الخادم او ايبي او حساب يجيب نفس رسالة الشات :\ بعد التطوير شكل اللوحة بعد التطوير رسائل الأخطاء : اللوحات الجديد والمعدلة ياريت يعجبكم المود والسلام عليكم ورحمة الله وبركاته التحيات لله1 point
-
Most likely that's an issue with permissions. Can you try to chmod the folder recursively in filezilla (right click) and set it to 755? @BurN ✸1 point
-
o convertnumber vai por numeros como 100000 para 100.000 function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end local caixa = getElementData(localPlayer,"Bank:Caixa") local convertido = convertNumber(caixa) -- exemplo dxDrawText("BANCO"..convertido, x*1500, y*86, x*158, y*37, tocolor(255, 255, 255, 255), x*1.30, "arial", "left", "top", false, false, false, false, false) caso queira usar1 point
-
Algum script tá criando essa mensagem no chat. Procure por ele e remova, provavelmente está no evento onPlayerWasted. @ViniGuzela1 point
-
Server opened! IP: mtasa://46.105.250.205:26014 Discord: https://discord.gg/kCKy4KV Updates Visit and take a look!1 point
-
1 point
-
Não. Tem erro de indentação também. E está faltando um end no final.1 point
