zW1Z4RD Posted April 30, 2020 Posted April 30, 2020 Opa, estou fazendo um script de roubo a veiculo, porem sou iniciante nisso. Gostaria que você me ajudasse a colocar um blip que seguisse o veiculo Esse é o codigo do spawn do carro addEvent("cartheft:getcar", true) addEventHandler("cartheft:getcar", getRootElement(), function() local random = math.random(#getCarList) local cords = getCarList[random] table.remove(getCarList, random) local cars = carList[math.random(#carList)] local vehicle = createVehicle(cars[1], cords[2], cords[3], cords[4], 0, 0, cords[5]) setElementData(vehicle, "cartheft:player", source) setElementData(source, "cartheft:vehicle", vehicle) setElementFrozen(vehicle, true) setVehicleLocked(vehicle, true) setVehicleDamageProof(vehicle, true) triggerClientEvent(source, "cartheft:getcar", source, cars[2], cars[3], cars[4], cords[1], cords[2], cords[3]) getCarCreate[vehicle] = cords end ) Porem eu queria que o blip fosse ativado junto com essa função, pois ela é ativada quando o player hackear o carro E por que quando eu tendo mudar esses ChatBox para ir somente pro player, sempre da um erro: [Expected number at argument 2, got gui-button] function chekButtonNumber() if (guiGetText(gui[9]) == guiGetText(gui[13])) and (guiGetText(gui[10]) == guiGetText(gui[14])) and (guiGetText(gui[11]) == guiGetText(gui[15])) and (guiGetText(gui[12]) == guiGetText(gui[16])) then showCursor(false) triggerServerEvent("cartheft:opencar", localPlayer) guiSetVisible(gui[8], false) outputChatBox("Policias atenção o veiculo acabou de ser roubado", 25, 255, 25) outputChatBox("Você abriu o carro.", 25, 255, 25) end end
MRXBBC Posted April 30, 2020 Posted April 30, 2020 5 hours ago, zW1Z4RD said: Opa, estou fazendo um script de roubo a veiculo, porem sou iniciante nisso. Gostaria que você me ajudasse a colocar um blip que seguisse o veiculo Esse é o codigo do spawn do carro addEvent("cartheft:getcar", true) addEventHandler("cartheft:getcar", getRootElement(), function() local random = math.random(#getCarList) local cords = getCarList[random] table.remove(getCarList, random) local cars = carList[math.random(#carList)] local vehicle = createVehicle(cars[1], cords[2], cords[3], cords[4], 0, 0, cords[5]) setElementData(vehicle, "cartheft:player", source) setElementData(source, "cartheft:vehicle", vehicle) setElementFrozen(vehicle, true) setVehicleLocked(vehicle, true) setVehicleDamageProof(vehicle, true) triggerClientEvent(source, "cartheft:getcar", source, cars[2], cars[3], cars[4], cords[1], cords[2], cords[3]) getCarCreate[vehicle] = cords end ) Porem eu queria que o blip fosse ativado junto com essa função, pois ela é ativada quando o player hackear o carro E por que quando eu tendo mudar esses ChatBox para ir somente pro player, sempre da um erro: [Expected number at argument 2, got gui-button] function chekButtonNumber() if (guiGetText(gui[9]) == guiGetText(gui[13])) and (guiGetText(gui[10]) == guiGetText(gui[14])) and (guiGetText(gui[11]) == guiGetText(gui[15])) and (guiGetText(gui[12]) == guiGetText(gui[16])) then showCursor(false) triggerServerEvent("cartheft:opencar", localPlayer) guiSetVisible(gui[8], false) outputChatBox("Policias atenção o veiculo acabou de ser roubado", 25, 255, 25) outputChatBox("Você abriu o carro.", 25, 255, 25) end end só criar um blip com a posição cords addEvent("cartheft:getcar", true) addEventHandler("cartheft:getcar", getRootElement(), function() local random = math.random(#getCarList) local cords = getCarList[random] table.remove(getCarList, random) local cars = carList[math.random(#carList)] local vehicle = createVehicle(cars[1], cords[2], cords[3], cords[4], 0, 0, cords[5]) local x,y,z = getElementPosition( vehicle ) local blipcar = createBlip( x, y, z, 51, 0, 0, 0, 255, source ) setElementData(vehicle, "cartheft:player", source) setElementData(source, "cartheft:vehicle", vehicle) setElementFrozen(vehicle, true) setVehicleLocked(vehicle, true) setVehicleDamageProof(vehicle, true) triggerClientEvent(source, "cartheft:getcar", source, cars[2], cars[3], cars[4], cords[1], cords[2], cords[3]) getCarCreate[vehicle] = cords end ) function chekButtonNumber() if (guiGetText(gui[9]) == guiGetText(gui[13])) and (guiGetText(gui[10]) == guiGetText(gui[14])) and (guiGetText(gui[11]) == guiGetText(gui[15])) and (guiGetText(gui[12]) == guiGetText(gui[16])) then showCursor(false) triggerServerEvent("cartheft:opencar", localPlayer) guiSetVisible(gui[8], false) outputChatBox("Policias atenção o veiculo acabou de ser roubado", 25, 255, 25) outputChatBox("Você abriu o carro.", 25, 255, 25) end end tente isso
Moderators Lord Henry Posted April 30, 2020 Moderators Posted April 30, 2020 Use createBlipAttachedTo para criar o blip anexado no veículo. Sobre o problema de outputChatBox, ele só pode ser mandado ao localPlayer enquanto estiver no script client-side. Se você quer mandar pra outros jogadores, o outputChatBox precisa estar no script server-side. Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
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