Jump to content

erro if getElementData(player, "Pedreiro") == true then e if getElementData(player, "Ferro") == False then


Recommended Posts

function pegarFerroS(thePlayer)
    local x, y, z = getElementPosition(marker_aleatoriosS)
    local random_Pos = math.random(#marker_aleatoriosS)
    if thePlayer then
        player = getPlayerFromName(thePlayer)
        if not isPedInVehicle(player) then 
            if isElementWithinMarker(player, marker_ferro)
            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( source, "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_Lixo[source], source, 4, 0, 0.4, - 0.6, -90, 0, 0 )
                        end, 1000,1)
                    end
                    end
                end
            end
        end
    end
end
addCommandHandler("ferro", pegarFerroS)

Está dando erro nos

if getElementData(player, "Ferro") == false then
   if getElementData(player, "Pedreiro") == true then

Não sei aonde estou errando o erro do debug está falando: 'then' expected near 'if'

Edited by Joaovit13
Link to post

Aproveitando essa postagem aqui é está 

retornando esse erro aqui pra mim: attempt to index field

 

--Marker_Aleatórios 
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,
}
--Marker entregar
marker_EntregarS = {}
--Local Random_Pos
local Random_Pos = math.random ( #marker_aleatoriosS)
--Marker que está retornando o erro: attempt to index field
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)

Obs é a mesma função ali de cima a unica diferença é que eu coloquei as marker_aleatoriosS e a marker_EntregarS

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...