FluxoTotal Posted August 6, 2019 Share Posted August 6, 2019 (edited) E continuando meus estudos . estou muito feliz pq ta dando muito certo meu script ja esta pronto , eu so estou querendo add mais cminhoes com a mesma funçao. me ajudem oque tenho que fazer. eu tentei desse jeito e foi sem sucesso! function inicio () caminhao2 = createVehicle (515, 1212.864, -1278.703, 13.383+1) caminhao1 = createVehicle (515, 1173.368, -1281.613, 13.491+1) caminhao = createVehicle (515, 1194.816, -1297.128, 13.384+1) trailer = createVehicle (584, 1204.033, -1299.422, 13.386+1) addEventHandler ( "onTrailerAttach", trailer, teste ) addEventHandler("onTrailerDetach", trailer, desgrudar) setVehicleDamageProof(trailer, true) blipT = createBlipAttachedTo(trailer,51) setTimer( tempo, 30000, 1 ) outputChatBox("#0000FF----------------------------------------------------------------------------------------------------------------",root,255,255,255,true) outputChatBox("#00FF00Sobrevivente #FFFFFFPrecisamos da sua ajuda para transportar suprimentos que",root,255,255,255,true) outputChatBox("serao vendidos na safezone! Marcamos em seu GPS a localizacao da carga.",root,255,255,255,true) outputChatBox("Mas se apresse! Voce tem apenas 15 minutos. Tome cuidado pois muita gente",root,255,255,255,true) outputChatBox("deseja roubar esses suprimentos. Boa sorte!!",root,255,255,255,true) outputChatBox("#0000FF----------------------------------------------------------------------------------------------------------------",root,255,255,255,true) end addCommandHandler("teste",inicio) function teste () marker = createMarker(1196.796, -1328.896, 12, "cylinder",3,255,255,255,50) blipM = createBlipAttachedTo(marker,53) addEventHandler("onMarkerHit", marker, final) end function final (player) if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh and veh == caminhao then if veh and veh == caminhao1 then if veh and veh == caminhao2 then destroyElement(caminhao) destroyElement(caminhao1) destroyElement(caminhao2) destroyElement(marker) destroyElement(trailer) destroyElement(blipM) destroyElement(blipT) givePlayerMoney(player, 1000) outputChatBox("Parabens! voce conseguiu trazer a carga em segurança!!",player,255,255,255,true) outputChatBox("Voce sera reconpensado com #00FF001000 #FFFFFFreais...",player,255,255,255,true) outputChatBox("#00FF00A Carga de suprimentos foi entregue em segurança para a safezone!",root,255,255,255,true) end end end function desgrudar () destroyElement(marker) end function tempo () destroyElement(caminhao) destroyElement(caminhao1) destroyElement(caminhao2) destroyElement(trailer) destroyElement(blipT) destroyElement(marker) destroyElement(blipM) end desculpem a desordem ainda nao peguei o jeito de organizar! Edited August 6, 2019 by Lord Henry Script convertido de texto para Lua. Link to comment
Other Languages Moderators Lord Henry Posted August 6, 2019 Other Languages Moderators Share Posted August 6, 2019 Utilize o botão de código do fórum para postar scripts ao invés de colar direto no texto. 1 Link to comment
FluxoTotal Posted August 6, 2019 Author Share Posted August 6, 2019 (edited) ok desculpe Edited August 6, 2019 by Lord Henry Código formatado em Lua foi movido para o post inicial do tópico. Link to comment
Other Languages Moderators Lord Henry Posted August 6, 2019 Other Languages Moderators Share Posted August 6, 2019 (edited) Bom, no seu caso eu colocaria todos os caminhões numa table. Depois usaria um loop pela table para verificar o caminhão correto. E já vi que você errou na lógica em alguns lugares. Use o /debugscript 3 para detectar os erros. Edited August 6, 2019 by Lord Henry 1 Link to comment
FluxoTotal Posted August 6, 2019 Author Share Posted August 6, 2019 o poblema e que eu nao estou conseguindo igualar os caminhoes para darem as mesmas funcoes a todos! function final (player) if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh and veh == caminhao then if veh and veh == caminhao1 then if veh and veh == caminhao2 then destroyElement(caminhao) destroyElement(caminhao1) destroyElement(caminhao2) destroyElement(marker) destroyElement(trailer) destroyElement(blipM) destroyElement(blipT) givePlayerMoney(player, 1000) outputChatBox("Parabens! voce conseguiu trazer a carga em segurança!!",player,255,255,255,true) outputChatBox("Voce sera reconpensado com #00FF001000 #FFFFFFreais...",player,255,255,255,true) outputChatBox("#00FF00A Carga de suprimentos foi entregue em segurança para a safezone!",root,255,255,255,true) end end end Link to comment
Other Languages Moderators Lord Henry Posted August 6, 2019 Other Languages Moderators Share Posted August 6, 2019 Vc não está achando algo estranho nessas linhas 4, 5 e 6? Principalmente se comparar às linhas 18, 19 e 20. 1 2 Link to comment
FluxoTotal Posted August 6, 2019 Author Share Posted August 6, 2019 sim esta estranho essa e a parte que eu no sei fazer , eu tentei duplicando as palavras e substituindo os nomes mais nao vai Link to comment
Other Languages Moderators Lord Henry Posted August 6, 2019 Other Languages Moderators Share Posted August 6, 2019 Bom, pra começar, isso: if veh and veh == caminhao then if veh and veh == caminhao1 then if veh and veh == caminhao2 then Deve ser assim: if veh and veh == caminhao then if veh and veh == caminhao1 then if veh and veh == caminhao2 then E isso: end end end Vira isso: end end end end end Link to comment
FluxoTotal Posted August 6, 2019 Author Share Posted August 6, 2019 (edited) function inicio () caminhao2 = createVehicle (515, 1212.864, -1278.703, 13.383+1) caminhao1 = createVehicle (515, 1173.368, -1281.613, 13.491+1) caminhao = createVehicle (515, 1194.816, -1297.128, 13.384+1) trailer = createVehicle (584, 1204.033, -1299.422, 13.386+1) addEventHandler ( "onTrailerAttach", trailer, teste ) addEventHandler("onTrailerDetach", trailer, desgrudar) setVehicleDamageProof(trailer, true) blipT = createBlipAttachedTo(trailer,51) setTimer( tempo, 30000, 1 ) outputChatBox("#0000FF----------------------------------------------------------------------------------------------------------------",root,255,255,255,true) outputChatBox("#00FF00Sobrevivente #FFFFFFPrecisamos da sua ajuda para transportar suprimentos que",root,255,255,255,true) outputChatBox("serao vendidos na safezone! Marcamos em seu GPS a localizacao da carga.",root,255,255,255,true) outputChatBox("Mas se apresse! Voce tem apenas 15 minutos. Tome cuidado pois muita gente",root,255,255,255,true) outputChatBox("deseja roubar esses suprimentos. Boa sorte!!",root,255,255,255,true) outputChatBox("#0000FF----------------------------------------------------------------------------------------------------------------",root,255,255,255,true) end addCommandHandler("teste",inicio) function teste () marker = createMarker(1196.796, -1328.896, 12, "cylinder",3,255,255,255,50) blipM = createBlipAttachedTo(marker,53) addEventHandler("onMarkerHit", marker, final) end function final (player) if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh and veh == caminhao then if veh and veh == caminhao1 then if veh and veh == caminhao2 then destroyElement(caminhao) destroyElement(caminhao1) destroyElement(caminhao2) destroyElement(marker) destroyElement(trailer) destroyElement(blipM) destroyElement(blipT) givePlayerMoney(player, 1000) givePlayerMoney(player, 1000) outputChatBox("Parabens! voce conseguiu trazer a carga em segurança!!",player,255,255,255,true) outputChatBox("Voce sera reconpensado com #00FF001000 #FFFFFFreais...",player,255,255,255,true) outputChatBox("#00FF00A Carga de suprimentos foi entregue em segurança para a safezone!",root,255,255,255,true) end end end end end function desgrudar () destroyElement(marker) end function tempo () destroyElement(caminhao) destroyE pf me ajuda to quebrando a cabeça com isso os caminhoes nao executam a funçao final Edited August 6, 2019 by Lord Henry Corrigida indentação. Link to comment
Other Languages Moderators Lord Henry Posted August 6, 2019 Other Languages Moderators Share Posted August 6, 2019 Você tem uma função em aberto sendo solicitada. A função tempo não faz sentido. 1 Link to comment
FluxoTotal Posted August 6, 2019 Author Share Posted August 6, 2019 function inicio () caminhao2 = createVehicle (515, 1212.864, -1278.703, 13.383+1) caminhao1 = createVehicle (515, 1173.368, -1281.613, 13.491+1) caminhao = createVehicle (515, 1194.816, -1297.128, 13.384+1) trailer = createVehicle (584, 1204.033, -1299.422, 13.386+1) addEventHandler ( "onTrailerAttach", trailer, teste ) addEventHandler("onTrailerDetach", trailer, desgrudar) setVehicleDamageProof(trailer, true) blipT = createBlipAttachedTo(trailer,51) setTimer( tempo, 30000, 1 ) outputChatBox("#0000FF----------------------------------------------------------------------------------------------------------------",root,255,255,255,true) outputChatBox("#00FF00Sobrevivente #FFFFFFPrecisamos da sua ajuda para transportar suprimentos que",root,255,255,255,true) outputChatBox("serao vendidos na safezone! Marcamos em seu GPS a localizacao da carga.",root,255,255,255,true) outputChatBox("Mas se apresse! Voce tem apenas 15 minutos. Tome cuidado pois muita gente",root,255,255,255,true) outputChatBox("deseja roubar esses suprimentos. Boa sorte!!",root,255,255,255,true) outputChatBox("#0000FF----------------------------------------------------------------------------------------------------------------",root,255,255,255,true) end addCommandHandler("teste",inicio) function teste () marker = createMarker(1196.796, -1328.896, 12, "cylinder",3,255,255,255,50) blipM = createBlipAttachedTo(marker,53) addEventHandler("onMarkerHit", marker, final) end function final (player) if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh and veh == caminhao then local veh1 = getPedOccupiedVehicle(player) if veh1 and veh1 == caminhao1 then local veh2 = getPedOccupiedVehicle(player) if veh2 and veh2 == caminhao2 then destroyElement(caminhao) destroyElement(caminhao1) destroyElement(caminhao2) destroyElement(marker) destroyElement(trailer) destroyElement(blipM) destroyElement(blipT) givePlayerMoney(player, 1000) givePlayerMoney(player, 1000) outputChatBox("Parabens! voce conseguiu trazer a carga em segurança!!",player,255,255,255,true) outputChatBox("Voce sera reconpensado com #00FF001000 #FFFFFFreais...",player,255,255,255,true) outputChatBox("#00FF00A Carga de suprimentos foi entregue em segurança para a safezone!",root,255,255,255,true) end end end end end function desgrudar () destroyElement(marker) end function tempo () destroyElement(caminhao) destroyElement(caminhao1) destroyElement(caminhao2) destroyElement(trailer) destroyElement(blipT) destroyElement(marker) destroyElement(blipM) end desculpe copiei erado 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