iTz.Kawl Posted July 14, 2018 Posted July 14, 2018 Preciso de ajuda, estava fazendo um script de serviço porém ao colocar ele para fazer essa função: function sair (source) if (veh[source]) and isElement(veh[source]) then outputChatBox ('#000000[ #FFB700Aviador#000000 ] #868686Você saiu do veículo e perdeu o trabalho!',source,255,255,255,true) destroyElement (veh[source]) Trabalho = false setElementVisibleTo ( entregar, source, false ) setElementVisibleTo ( blip, source, false ) setElementData(source, "Trab", false) end end addEventHandler ("onVehicleExit", getRootElement(), sair) addEventHandler ("onVehicleExplode", getRootElement(), sair) O último EventHandler não funciona, poderiam me ajudar a resolver? Não tem erro no console. Script: marker = createMarker ( -79.430679321289, 90.90128326416, 2.6, "cylinder", 1.5, 255,140,0, 255) entregar = createMarker ( -570.20233154297, 2567.4458007813, 53.910755157471 , "cylinder", 3, 255,140,0, 255) setElementVisibleTo ( entregar, root, false ) blip = createBlipAttachedTo(entregar, 41, 3, 255, 0, 0, 255, 0, 65535, source) setElementVisibleTo ( blip, root, false ) bliptrab = createBlipAttachedTo(marker, 5, 3, 255, 0, 0, 255, 0, 65535) function msg (source) outputChatBox ('#000000[ #FFB700Aviador#000000 ] #868686Para iniciar o trabalho digite: #000000-[ #FFB700/aviador #000000]',source,255,255,255,true) end addEventHandler( "onMarkerHit", marker, msg ) veh = {} function pegartrab (source) if isElementWithinMarker (source, marker) then if veh[source] and isElement(veh[source]) then destroyElement(veh[source]) veh[source] = nil end local x,y,z = getElementPosition(source) veh[source] = createVehicle(593 ,-82.958648681641,104.13409423828,3.4968612194061,0,9,160) warpPedIntoVehicle (source,veh[source]) setElementVisibleTo ( blip, source, true ) setElementVisibleTo ( entregar, source, true ) outputChatBox ('#000000[ #FFB700Aviador#000000 ] #868686Vá para a marcação indicada no mapa!',source,255,255,255,true) else outputChatBox ('#000000[ #FFB700Aviador#000000 ] #FF0000Erro! #868686Você não esta no circulo para pegar o trabalho.',source,255,255,255,true) end end addCommandHandler ( "aviador", pegartrab ) function acabar (source) if veh[source] and isElement(veh[source]) then destroyElement (veh[source]) setElementVisibleTo ( entregar, source, false ) setElementVisibleTo ( blip, source, false ) givePlayerMoney (source, 20000) outputChatBox ('#000000[ #FFB700Aviador#000000 ] #868686Trabalho finalizado com #00ff00Sucesso #FF0000Você ganhou 20k +50exp',source,255,255,255,true) local experience = tonumber(getElementData(source,"experience")) if (experience) then setElementData(source,"experience",experience+50) else setElementData(source,"experience",50) end else end end addEventHandler( "onMarkerHit", entregar, acabar ) function sair (source) if (veh[source]) and isElement(veh[source]) then outputChatBox ('#000000[ #FFB700Aviador#000000 ] #868686Você saiu do veículo e perdeu o trabalho!',source,255,255,255,true) destroyElement (veh[source]) Trabalho = false setElementVisibleTo ( entregar, source, false ) setElementVisibleTo ( blip, source, false ) setElementData(source, "Trab", false) end end addEventHandler ("onVehicleExit", getRootElement(), sair) addEventHandler ("onVehicleExplode", getRootElement(), sair) function deslogar (source) if (veh[source]) and isElement(veh[source]) then destroyElement (veh[source]) Trabalho = false setElementVisibleTo ( entregar, source, false ) setElementVisibleTo ( blip, source, false ) setElementData(source, "Trab", false) end end addEventHandler ("onPlayerQuit", getRootElement(), deslogar)
iTz.Kawl Posted July 14, 2018 Author Posted July 14, 2018 (edited) 11 hours ago, iTz.Kawl said: Edited July 14, 2018 by iTz.Kawl
Moderators Lord Henry Posted July 14, 2018 Moderators Posted July 14, 2018 Por favor, use a ferramenta <> do fórum para postar códigos. Do jeito que está é ilegível. https://prnt.sc/jp4g81 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