marker_aleatoriosS = {
{1872.08, -1308.8, 18.147},
{1893.097, -1314.732, 23.151},
{1892.831, -1316.274, 28.152},
{1872.101, -1317.594, 33.147},
{1876.034, -1321.604, 38.147},
{1876.088, -1309.743, 43.147},
{1873.865, -1322.412, 48.069},
--Para não pegar repetido
{1872.08, -1308.8, 18.147},
{1893.097, -1314.732, 23.151},
{1892.831, -1316.274, 28.152},
{1872.101, -1317.594, 33.147},
{1876.034, -1321.604, 38.147},
{1876.088, -1309.743, 43.147},
{1873.865, -1322.412, 48.069},
}
Object_ferro = {}
marker_EntregarS = {}
--ID do objeto barra de ferro 2960
function pegarFerroS(player,cmd)
local x, y, z = getElementPosition(marker_ferro)
local Random_Pos = math.random(#marker_aleatoriosS)
if not isPedInVehicle(player) then
if isElementWithinMarker(player, marker_ferro) then
if getElementData(player, "Ferro") == false then
if getElementData(player, "Pedreiro") == true then
setPedAnimation(player, "CARRY", "liftup", 1.0, false)
setTimer(function()
if isElement(Object_ferro[player]) then destroyElement(Object_ferro[player]) end
if isElement(marker_EntregarS[player]) then destroyElement(marker_EntregarS) end
setElementData(player, "Recompensa", 0)
setPedAnimation(player, nil)
setElementData(player, "Ferro", true)
toggleControl(player, "jump", false)
toggleControl(player, "fire", false)
toggleControl(player, "aim_weapon", false)
setPedAnimation( player, "CARRY", "crry_prtial", 4.1, true, true, true )
marker_EntregarS[player] = createMarker ( marker_aleatoriosS[Random_Pos][1], marker_aleatoriosS[Random_Pos][2], marker_aleatoriosS[Random_Pos][3] -2.2, "cylinder", 2.5, 16, 111, 231, 50)
setElementVisibleTo(marker_EntregarS, root, false)
setElementVisibleTo(marker_EntregarS, player, true)
addEventHandler("onMarkerHit", marker_EntregarS[player], fim_Emprego)
Object_ferro[player] = createObject(2960, x, y, z)
exports.bone_attach:attachElementToBone(Object_ferro[player], player, 4, 0, 0.4, - 0.6, -90, 0, 0 )
end, 1000,1)
end
end
end
end
end
addCommandHandler("ferro", pegarFerroS)
Sua maneira de tabela estava incorreta, estava pegando a index de uma tabela como essa.
{1872.08, -1308.8, 18.147,1893.097, -1314.732, 23.151}