noonbr Posted February 4, 2020 Share Posted February 4, 2020 Então manos, eu estou fazendo um script de emprego para estudar Lua, etc. Cheguei ao final do script e estou me deparando com um problema: Ao término do emprego era para o jogador que está dentro do veículo ser teleportado para um lugar, porém não está acontecendo. Imagino o que seja mas não consigo resolver talvez por falta de conhecimento ainda, e por isso estou aqui pedindo uma ajuda. SERVER-SIDE function checkPointFinal(thePlayer) if getElementData(thePlayer, "checkpoint3") == true then destroyElement(getPedOccupiedVehicle(thePlayer)) setElementVisibleTo(blip2, thePlayer, false) setElementVisibleTo(blip3, thePlayer, false) setElementVisibleTo(blip4, thePlayer, false) setElementVisibleTo(blip5, thePlayer, false) setElementVisibleTo(job2, thePlayer, false) setElementVisibleTo(job3, thePlayer, false) setElementVisibleTo(job4, thePlayer, false) setElementVisibleTo(job5, thePlayer, false) setElementData(thePlayer, "checkpoint1", false) setElementData(thePlayer, "checkpoint2", false) setElementData(thePlayer, "checkpoint3", false) setElementData(thePlayer, "checkpoint4", false) setElementData(thePlayer, "jobIniciar", false) givePlayerMoney(thePlayer, 500) outputChatBox("Debitados R$500,00.", thePlayer, 0,250,0, true) outputChatBox("Digite /iniciar no marcador para fazer a corrida novamente.", thePlayer, 0,220,0, true) setElementPosition(thePlayer, 1714.3785400391,-1949.0649414063,14.1171875) end end addEventHandler("onMarkerHit", job5, checkPointFinal) Link to comment
main Posted February 4, 2020 Share Posted February 4, 2020 function checkPointFinal(hitElement, d) if isElement(hitElement) and getElementType(hitElement) == "player" and d then -- se existir o elemento e se o tipo do elemento for player e se esta na mesma dimensao do marcador if getElementData(hitElement, "checkpoint3") then destroyElement(getPedOccupiedVehicle(hitElement)) setElementVisibleTo(blip2, hitElement, false) setElementVisibleTo(blip3, hitElement, false) setElementVisibleTo(blip4, hitElement, false) setElementVisibleTo(blip5, hitElement, false) setElementVisibleTo(job2, hitElement, false) setElementVisibleTo(job3, hitElement, false) setElementVisibleTo(job4, hitElement, false) setElementVisibleTo(job5, hitElement, false) setElementData(hitElement, "checkpoint1", false) setElementData(hitElement, "checkpoint2", false) setElementData(hitElement, "checkpoint3", false) setElementData(hitElement, "checkpoint4", false) setElementData(hitElement, "jobIniciar", false) givePlayerMoney(hitElement, 500) outputChatBox("Debitados R$500,00.", hitElement, 0, 250, 0) outputChatBox("Digite /iniciar no marcador para fazer a corrida novamente.", hitElement, 0, 220, 0) setElementPosition(hitElement, 1714.3785400391, -1949.0649414063, 14.1171875) end end end addEventHandler("onMarkerHit", job5, checkPointFinal) Tente isso 1 Link to comment
Angelo Pereira Posted February 4, 2020 Share Posted February 4, 2020 (edited) Caso, a do MainSCR não funcionar, tente assim : function checkPointFinal(hitElement, d) if isElement(hitElement) and getElementType(hitElement) == "player" and d then if isPedInVehicle(hitElement) then --/> Adicionado if getElementData(hitElement, "checkpoint3") then destroyElement(getPedOccupiedVehicle(hitElement)) setElementVisibleTo(blip2, hitElement, false) setElementVisibleTo(blip3, hitElement, false) setElementVisibleTo(blip4, hitElement, false) setElementVisibleTo(blip5, hitElement, false) setElementVisibleTo(job2, hitElement, false) setElementVisibleTo(job3, hitElement, false) setElementVisibleTo(job4, hitElement, false) setElementVisibleTo(job5, hitElement, false) setElementData(hitElement, "checkpoint1", false) setElementData(hitElement, "checkpoint2", false) setElementData(hitElement, "checkpoint3", false) setElementData(hitElement, "checkpoint4", false) setElementData(hitElement, "jobIniciar", false) givePlayerMoney(hitElement, 500) outputChatBox("Debitados R$500,00.", hitElement, 0, 250, 0) outputChatBox("Digite /iniciar no marcador para fazer a corrida novamente.", hitElement, 0, 220, 0) setTimer ( function () --/> Adicionado setElementPosition(hitElement, 1714.3785400391, -1949.0649414063, 14.1171875) end, 200, 1) --/> Adicionado end --/> Adicionado end end end addEventHandler("onMarkerHit", job5, checkPointFinal) Edited February 4, 2020 by Angelo Pereira Link to comment
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