Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 28/10/19 in Posts

  1. Veja o comentário que deixei na linha 8. Mova destroyElement(finalm2) para o timer depois do removeEventHandler.
    1 point
  2. freeroam > fr_server.Lua Procura por createBlipAttachedTo e desativa a linha.
    1 point
  3. Normalmente vai dentro do trecho da função de dominar, vai depender da sua lógica definida no código. Se tiver alguma dificuldade, posta aqui seu código.
    1 point
  4. Yes and no. It does have some limitations, when it comes to multiple resources. You can't assign children to parents of different resources. A possible way around: Resource 1 local vehicleParent = createElement("vehicleParent") local newVehicle newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) Resource 2 local vehicleParent = createElement("vehicleParent") local newVehicle newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) Resource 3 local vehicleParents = getElementsByType ("vehicleParent") -- getElementChildren doesn't work at this first line, because those elements are not direct children of the root element. for i=1 #vehicleParents do local vehicleParent = vehicleParents[i] local vehicles = getElementChildren ( vehicleParent, "vehicle" ) for j=1 #vehicles do local vehicle = vehicles[j] end end
    1 point
  5. Ohh. I see. I wasn't aware about the streamed argument. Respecting the elements tree, the functionallity looks interesting. Might It could bring me a better result isntead dealing with arrays. Thanks newly It helped me a lot. Regards.
    1 point
  6. Good question. Yes it will get all vehicles by default. There is one thing that I do not know and that is: "Will vehicles in a different dimension be considered as streamed in?" Because getElementsByType does have a setting that allows the user to only collect streamed in vehicles. Which is incredible useful to improve the performance of the script. But if you need all streamed out vehicles as well, it might not be a good solution. https://wiki.multitheftauto.com/wiki/GetElementsByType Syntax (clientside) table getElementsByType ( string theType, [ element startat=getRootElement(), bool streamedIn=false ] ) Capturing only streamed in vehicles. local vehicles = getElementsByType ("vehicle", root, true ) A different method, but has to be partly implemented on the resource that creates vehicles. (not recommended unless you know how to to work with the element tree) local vehicleParent = createElement("vehicleParent") local newVehicle newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) setElementDimension(vehicleParent, 100) -- move all current vehicles to a different dimension (fun fact) Getting only these 3 vehicles. local vehicles -- vehicles = getElementsByType ("vehicle", vehicleParent) -- or vehicles = getElementChildren ( vehicleParent, "vehicle" ) -- the difference: This function only captures the direct children of the parent 'vehicleParent'. But in this set-up it doesn't matter. Else you might need an utility function, like this: function filterElementsByDimension (elementList, dimension) local newElementList = {} for 1, #elementList do local element = elementList[i] if getElementDimension(element) == dimension then newElementList[#newElementList + 1] = element end end return newElementList end
    1 point
  7. Each time you press the key that handle the function you need to get your current location getElementPosition() and set a new one increasing one of the float of your current one. Something like this local increaseBy = 3 local x,y,z = getElementPosition(localPlayer) setElementPosition(localPlayer,x,y,z+increaseBy)
    1 point
  8. Yes, just not by default. ---------- The website that originally contained the resource that could do that is gone because the owner crystalMV did quit MTA, but it seems a copy of it is still stored in the website archive: https://web.archive.org/web/20160507103732/http://crystalmv.net84.net/pages/scripts/server_coldata.php
    1 point
  9. You can get your current location and increase any of the floats with the value you want.
    1 point
  10. It is possible, but it would require editing the script that handles /sp
    1 point
  11. amigo se você está usando a função por addCommandHandler vc n pode botar bota o nome do marker no addCommand pois lá em cima naquela if você já disse que se tiver em cima do marker que irá funcionar então faça assim !!!! ml = createMarker(821.386, -1332.981, 13.547, "cylinder",1.5, 255, 255, 255, 100) -- cria um marker chamado ML function teleport(source) if isElementWithinMarker(source, ml) then -- se o player estiver sobre o marker chamado if getPlayerMoney(source) >= 400 then -- se o dinheiro do player for igual ou maior que 400 então: takePlayerMoney(source, 400) -- Remover 400 de Dinheiro player setElementPosition(source, 733.827, -1355.561, 23.586) -- irá levar o jogador para a posição mencionada setElementInterior(source,0) -- irá levar o jogador para o interior 0 setElementDimension ( source, 0 ) -- irá levar o jogador para a dimensão 0 end end end addCommandHandler("entrar", teleport) -- quando o player digitar o comando /entrar ele irá executar a função teleport amigo mais se ele teleporte for para um interior e outra dimensão você terá que acrescentar mais algumas coisas, pois terá que explicar pro script em que interior e dimensão ficará essa cordenada espero ter te ajudado
    1 point
  12. Faltou verificar se hitElement é um jogador. function entrega2 (hitElement, matchingDimension) if (hitElement and getElementType (hitElement) == "player") then local v = getPedOccupiedVehicle (hitElement) if getElementData (v, "Carregado") == true then setElementFrozen (v, true) outputChatBox ("Espere o veículo ser descarregado!", hitElement, 0, 0, 150) setElementData (v, "Carregado", false) destroyElement (finalm2) destroyElement (blip2) setTimer (function (theHitElement, theSource) if isElementFrozen (theHitElement) then setElementFrozen (theHitElement, false) givePlayerMoney (theHitElement, math.random (1500,3500)) removeEventHandler ("onVehicleExit", theSource, remove2) end end, 3500, 1, hitElement, source) removeEventHandler ("onMarkerHit", source, entrega2) end end end
    1 point
  13. function mainFunction() setTimer ( function() outputChatBox ( "Daqui 5 segundos você vai pode dominar novamente!" ) --- Mensagem da sua escolha! end, 5000, 1 ) --- Esta representada em milissegundos Ex.: 5seg = 5000 Mili end mainFunction() Se Te Ajudei da Um Thanks Ai :D
    1 point
  14. made this like 2 years or so ago, i think this was my first gamemode i made or at least started making as it's not finished. I mainly only started making this to learn how to structure gamemodes better. For some reason i was basing it on accounts, idk why. So to make it run all you have to do is start terrortown first then login with any account and then start the map ttt_farm. You can make your own maps, all the spawn points are added through map itself. download: https://github.com/rivor/ttt-mta preview image
    1 point
×
×
  • Create New...