Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 28/01/19 in all areas

  1. اليوم رجعتلكم بوظيفة جديدة والوظيفة واضحة من اسمها getPlayerInfo - Server side only الحين نجي للساينتكس playername, accountname, serial, ip, money, teamname, vehicle, health, armor, dimension, interior = getPlayerInfo(thePlayer) Source Code : function getPlayerInfo(thePlayer) if isElement(thePlayer) and getElementType(thePlayer) == "player" then local aName = getPlayerName(thePlayer) local aAcc = getPlayerAccount(thePlayer) if not isGuestAccount(aAcc) then aAccName = getAccountName(aAcc) else aAccName = "Guest" end local hisSerial = getPlayerSerial(thePlayer) local aIP = getPlayerIP(thePlayer) local hisMoney = getPlayerMoney(thePlayer) local hisTeam = getPlayerTeam(thePlayer) or false if hisTeam ~= false then hisTeamName = getTeamName(hisTeam) else hisTeamName = "N/A" end if isPedInVehicle(thePlayer) then local theVehicle = getPedOccupiedVehicle ( thePlayer ) hisVehicleName = getVehicleName(thePlayer) else hisVehicleName = "On Foot" end local hisHealth = getElementHealth(thePlayer) local hisArmor = getPedArmor(thePlayer) local hisDimension = getElementDimension(thePlayer) local hisInterior = getElementInterior(thePlayer) else error("Bad Argument At Argument #1 player not found") end return aName, aAccName, hisSerial, aIP, hisMoney, hisTeamName, hisVehicleName, hisHealth, hisArmor, hisDimension, hisInterior end مثال : function getPlayerInfo(thePlayer) if isElement(thePlayer) and getElementType(thePlayer) == "player" then local aName = getPlayerName(thePlayer) local aAcc = getPlayerAccount(thePlayer) if not isGuestAccount(aAcc) then aAccName = getAccountName(aAcc) else aAccName = "Guest" end local hisSerial = getPlayerSerial(thePlayer) local aIP = getPlayerIP(thePlayer) local hisMoney = getPlayerMoney(thePlayer) local hisTeam = getPlayerTeam(thePlayer) or false if hisTeam ~= false then hisTeamName = getTeamName(hisTeam) else hisTeamName = "N/A" end if isPedInVehicle(thePlayer) then local theVehicle = getPedOccupiedVehicle ( thePlayer ) hisVehicleName = getVehicleName(thePlayer) else hisVehicleName = "On Foot" end local hisHealth = getElementHealth(thePlayer) local hisArmor = getPedArmor(thePlayer) local hisDimension = getElementDimension(thePlayer) local hisInterior = getElementInterior(thePlayer) else error("Bad Argument At Argument #1 player not found") end return aName, aAccName, hisSerial, aIP, hisMoney, hisTeamName, hisVehicleName, hisHealth, hisArmor, hisDimension, hisInterior end addCommandHandler("getmyinfo", function(plr) local name, accountname, serial, ip, money, team, vehicle, health, armor, dimension, interior = getPlayerInfo(plr) outputChatBox("Your Name: "..name, plr,255,0,0,true) outputChatBox("Your Account name: "..accountname, plr,255,0,0,true) outputChatBox("Your Serial: "..serial, plr,255,0,0,true) outputChatBox("Your IP: "..ip, plr,255,0,0,true) outputChatBox("Your Money: "..money, plr,255,0,0,true) outputChatBox("Your Team: "..team, plr,255,0,0,true) outputChatBox("Your Vehicle: "..vehicle, plr,255,0,0,true) outputChatBox("Your Health: "..health, plr,255,0,0,true) outputChatBox("Your Armor: "..armor, plr,255,0,0,true) outputChatBox("Your Dimension: "..dimension, plr,255,0,0,true) outputChatBox("Your Interior: "..interior, plr,255,0,0,true) end ) النتيجة : _____________________________________________ ادري ان اغلبكم ما بيتهم للفنكشن ولاكن سويته للأفادة في امان الله
    2 points
  2. @Peti 1. + 3. To answer this, you need to understand the difference between client and serverside: The server is a computer. Which RUNS serverside. The Clients are multiple computer connected to the server. Which RUNS clientside. The internet and the network is in between. (ping is the delay which separates those two types of computers) In case of a local-server the ping 0, but both sides are still separated. And that will give the result as @Patrick2562 said. 2. You make peds created by clientside/serverside shoot at clientside. The reason why it can't be done serverside is because MTA doesn't support it yet.
    2 points
  3. addEventHandler + group elements I noticed that some people like to add 10000000000000000 addEventHandlers for each element, while you probably only need 1 addEventHandler. Using ONE addEventHandler on a group of elements? Answer: local group = createElement("groupMyCutePeds") -- Create a custom element and save it in to the variable <group>. -- Create 3 peds. local ped1 = createPed(120, 5540.6654, 1020.55122, 1240.545) local ped2 = createPed(120, 5541.6654, 1021.55122, 1240.545) local ped3 = createPed(120, 5542.6654, 1022.55122, 1240.545) -- Set the parent of the 3 peds. setElementParent(ped1, group) setElementParent(ped2, group) setElementParent(ped3, group) -- Add an addEventHandler and use the <group> as <attachedTo> element. addEventHandler("onPedWasted", group, -- "onPedWasted" = serverside. "onClientPedWasted" = clientside. function () outputChatBox("One of my cute peds just died. ;'( No exceptions!") end) Code is untested, but the method is tested. Syntax for functions in example createElement syntax element createElement ( string elementType, [ string elementID = nil ] ) setElementParent syntax bool setElementParent ( element theElement, element parent ) addEventHandler syntax bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [ bool getPropagated = true, string priority = "normal" ] ) DO NOT disable getPropagated getPropagated: A boolean representing whether the handler will be triggered if the event was propagated down or up the element tree (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to false will only be triggered if source == this). If you disable this, children of the <group> element are not included. Make use of the element tree Element tree For applying addEventHandlers to elements created by the resource: Use: resourceRoot / getResourceRootElement For applying addEventHandlers to elements created by scripts of the resource: Use: getResourceDynamicElementRoot For applying addEventHandlers to elements created by maps of the resource: Use: getResourceMapRootElement I hope your code will be without... print(10^10^10^10) -- Print here: https://www.lua.org/cgi-bin/demo ...addEventHandlers in the future.
    1 point
  4. Deixando um like no meus comentários deste tópico já esta ótimo clique nesse botão de coração que tem no meu comentário.
    1 point
  5. I think I understood it now. Getting the length of all values from table: local totalLength = 0 for _,s in ipairs(textTable) do totalLength = totalLength + s:len() end print( totalLength ) Checking if at least one value is >= than 25: local textTable = { "abcdefghijklmnopqrstu", "abcdefghijklmnopqrstu123", "abcdefghijklmnopqrstu124", } local lengthsGreaterThan25 = 0 for _,s in ipairs(textTable) do if s:len() >= 25 then lengthsGreaterThan25 = lengthsGreaterThan25 + 1 end end print( lengthsGreaterThan25 )
    1 point
  6. You can only get the cursor's position if cursor is showing. https://wiki.multitheftauto.com/wiki/IsCursorShowing local sx, sy = guiGetScreenSize() function getpos() if isCursorShowing() then local cx, cy = getCursorPosition() return sx*cx, sy*cy end return false end
    1 point
  7. Abra seu survivorSystem.lua e aperte CTRL + F e procure por animation. Você vai achar uma linha igual essa: setPedAnimation (source,"FOOD","EAT_Burger",nil,false,false,nil,false) Agora vamos para a parte da correção: Você deve por -1 no lugar do nill exemplo: setPedAnimation (source, "FOOD", "EAT_Burger", -1, false, false, nil, false)
    1 point
  8. It should have worked, maybe it's some problem with your ACL. I guess that's because it has an extra symbol in the code that appears when copying from the forums. This is happening to me when I copy the client-side code (look at the end of the code): Converting to ANSI: Be sure to remove these symbols and test your script again.
    1 point
  9. in your escolhaJanelaArmas() function change resourceRoot in the triggerServerEvent function to localPlayer. Then in your server code the "source" will be your player. function darArmaClient(textoIDArma) outputChatBox("Ola" ..textoIDArma, getPlayerName(source)) nomeA = getWeaponNameFromID(textoIDArma) outputChatBox(nomeA) giveWeapon(source, textoIDArma, 999) outputChatBox("Erro") end addEvent("darArmaClient", true) addEventHandler("darArmaClient", root, darArmaClient)
    1 point
  10. You need to change "param" into a table to catch all other subsequent params by using "..." then using table.concat to join them. -- Test the function function test(player, command, ...) local msg = table.concat({...}," ") sendDiscordMessage(msg) end addCommandHandler("dcmessage", test)
    1 point
  11. 1 point
  12. @DNL291 OBRIGADO DEU CERTO! ?
    1 point
  13. Well, the first option just converts it to Lua bytecode, the second does the same AND uses a block cipher on it(like TEA).
    1 point
  14. 1. If you create the ped on client side, the ped only visible for the client. But you create it on server side, the ped visible for everybody. 2. Both 3. Server.
    1 point
  15. Дерево элементов - это простейшая структура, которая напоминает собой настоящее дерево с ветвями. Места объединения ветвей называют узлами или нодами. Root - это нематериальный узел, который просто стоит выше всех в дереве. Ниже идут узлы игроков и ресурсов. Дерево очень полезно при вызове определенных событий. Например, если мы хотим, чтобы событие распространялось на все элементы дерева - нужно просто вызвать triggerEvent и указать root или getRootElement(). При этом событие пройдет по всем ветвям и узлам, дав о себе знать всем без исключения нодам. Но представим ситуацию, что мы хотим затронуть лишь определенные узлы, начиная с некоторого. Что для этого нужно сделать? Верно, расположить эти узлы под каким-то другим узлом и вызвать triggerEvent, указав этот самый узел. Событие будет распространяться только по нисходящим дочерним узлам. Функция getElementRoot() возвращает root элемент. То есть, можно сказать root = getElementRoot(), они идентичны, и переменная root нужна просто для удобства. Точно так же обстоят дела с getResourceElement(getThisResource()), которая идентична resourceRoot. Если мы хотим, чтобы событие затронуло только элементы под узлом resourceRoot - мы вызываем triggerEvent("onSomeEvent", resourceRoot, ...). Если заходить дальше, то вызов triggerEvent так же затрагивает узлы выше. То есть, triggerEvent("onSomeEvent", player, ... ) так же даст о себе знать root элементу. По поводу того, что такое дерево можно более подробно поискать в интернетах.
    1 point
  16. Server Name : KSA | ~ Team BoT' - فريق بوت للشوتر ~ | Saudi Shooter ip: mtasa://145.239.37.24:55555 Photo of Server - Login Panel - Avatar System - Skins Panel - Lights Panel - Map info - MP3 Panel - When someone win at game - Votemanager - Tab - instagram : 4.hf -
    1 point
  17. Respondendo ao título do seu tópico: Não, você não é burro. Você só seria burro se você nem tentasse.
    1 point
  18. شوف هذا طريقة دخول تلقائي عدل عليها عشان تصير تحفظ بس
    1 point
  19. Как исправить белые (пустые) номера на сервере? кто сталкивался? P.S: Винду переустанавливал, МТА и ГТА:СА переустанавливал. P.SS: На других серверах с номерами все нормально. Что может быть не так?
    1 point
  20. Right here: https://community.multitheftauto.com/index.php?p=resources&s=details&id=693
    1 point
×
×
  • Create New...