Pedro Silveira Posted December 3, 2017 Posted December 3, 2017 Hello, i'm new in MTA Scripts and i trying to make something like this: function verificar2 () if ( getElementPosition( robmarker1 ) == 3099.97, -3281.69, -0.5 ) then outputChatBox("Esta loja ainda está recuperando-se de um assalto!", l_5_0, 0, 255, 0) else outputChatBox("Digite /roubar para furtar a loja!", l_5_0, 0, 255, 255) end end But this don't work. I use the "verificar2" in this part of code: setTimer(verificar2, 2000, 1, l_7_0) And here the full code for more informations: -------------------- Loja AmmuNation de São Paulo -------------------- local Exitdoorrob1 = createMarker(285.84375, -86.7724609375, 1002.2, "arrow", 1.5, 255, 255, 0, 255) setElementInterior(Exitdoorrob1, 4) setElementDimension(Exitdoorrob1, 1) local Doorentryrob1 = createMarker(1368.890625, -1279.787109375, 14.546875, "arrow", 1.5, 255, 255, 0, 255) createBlipAttachedTo(Doorentryrob1, 17, 2, 0, 255, 0, 0, 0, 7000) local robmarker1 = createMarker(295.5595703125, -80.40859375, 1000.515625, "cylinder", 1.2, 255, 10, 10, 255) setElementInterior(robmarker1, 4) setElementDimension(robmarker1, 1) function verificar ( thePlayer ) if ( getElementInterior( thePlayer ) == 4 ) then givePlayerMoney( thePlayer, 10000 ) else outputChatBox("Você saiu da loja e o dinheiro foi devolvido!", l_5_0, 255, 0, 0) end end function verificar2 () if ( getElementPosition( robmarker1 ) == 3099.97, -3281.69, -0.5 ) then outputChatBox("Esta loja ainda está recuperando-se de um assalto!", l_5_0, 0, 255, 0) else outputChatBox("Digite /roubar para furtar a loja!", l_5_0, 0, 255, 255) end end duty1 = function(l_5_0, l_5_1) if isElementWithinMarker(l_5_0, robmarker1) then setPlayerWantedLevel(l_5_0, 6) triggerClientEvent(root, "playTheSound1", root, l_5_0) outputChatBox("O caixa está colocando o dinheiro na sacola! Aguarde até ele terminar!", l_5_0, 0, 255, 0) outputChatBox("#DF0101[Alarme]: #FF8C00O Meliante " .. getPlayerName(l_5_0) .. " #FF8C00está assaltando a #DF0101Ammu Nation!", root, 255, 255, 255, true) setElementPosition(robmarker1, 3099.97, -3281.69, -0.5) setMarkerSize(Exitdoorrob1, 0) local blip2 = createBlipAttachedTo(Doorentryrob1, 20, 2, 0, 255, 0, 0, 0, 7000) setTimer(triggerClientEvent, 21000, 1, root, "playTheSound1", root, l_5_0) setTimer(triggerClientEvent, 42000, 1, root, "playTheSound1", root, l_5_0) setTimer(triggerClientEvent, 63000, 1, root, "playTheSound1", root, l_5_0) setTimer(setElementPosition, 300000, 1, robmarker1, 295.5595703125, -80.40859375, 1000.515625) setTimer(setMarkerSize, 90000, 1, Exitdoorrob1, 1.5) setTimer(verificar, 90000, 1, l_5_0) setTimer(destroyElement, 300000, 1, blip2) else outputChatBox("", source, 255, 0, 0) end end addCommandHandler("roubar", duty1) Exitdrob1 = function(l_6_0) if source == Exitdoorrob1 and getElementType(l_6_0) == "player" then fadeCamera(l_6_0, false, 1, 0, 0, 0) setTimer(fadeCamera, 1000, 1, l_6_0, true, 1) setTimer(setElementRotation, 1000, 1, l_6_0, 0, 0, 90) setTimer(setElementInterior, 1000, 1, l_6_0, 0, 1366.744140625, -1279.75, 13.546875) setTimer(setElementDimension, 1000, 1, l_6_0, 0) end end addEventHandler("onMarkerHit", getRootElement(), Exitdrob1) Doorerob1 = function(l_7_0) if source == Doorentryrob1 and getElementType(l_7_0) == "player" then fadeCamera(l_7_0, false, 1, 0, 0, 0) setTimer(setElementRotation, 1000, 1, l_7_0, 0, 0, 90) setTimer(fadeCamera, 1000, 1, l_7_0, true, 1) setTimer(setElementInterior, 1000, 1, l_7_0, 4, 285.689453125, -84.826171875, 1001.515625) setTimer(setElementDimension, 1000, 1, l_7_0, 1) setTimer(verificar2, 2000, 1, l_7_0) end end addEventHandler("onMarkerHit", getRootElement(), Doorerob1) Please help me! Thanks for everybody!
Moderators IIYAMA Posted December 4, 2017 Moderators Posted December 4, 2017 local x, y, z = getElementPosition( robmarker1 ) if x == 3099.97 and y == -3281.69 and z == -0.5 then Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now