Jump to content

ERRO - Habilitação


Recommended Posts

Pessoal, estou com esse erro, quando vou comprar a habilitação, o mesmo não permite, dizendo que está com erro "attempt to compare number with boolean" Alguém sabe como o que está errado?

Sem-t-tulo.png

 

já tentei de tudo... Se alguém souber o erro, estou deixando o código em baixo! 

 

MUITO OBRIGADO!

Código ?

Spoiler
Quote

function reset ( source )
setElementData ( source, "Habilitacoes:Motos", false )
setElementData ( source, "Habilitacoes:Carros", false )
setElementData ( source, "Habilitacoes:Caminhoes", false )
setElementData ( source, "Habilitacoes:Onibus", false )
setElementData ( source, "Habilitacoes:Carretas", false )
setElementData ( source, "Habilitacoes:Barcos", false )
setElementData ( source, "Habilitacoes:Helicopteros", false )
setElementData ( source, "Habilitacoes:Avioes", false )
end
addCommandHandler ( "rs", reset )

function reset2 ( source )
setElementData ( source, "Habilitacoes:Motos", true )
setElementData ( source, "Habilitacoes:Carros", true )
setElementData ( source, "Habilitacoes:Caminhoes", true )
setElementData ( source, "Habilitacoes:Onibus", true )
setElementData ( source, "Habilitacoes:Carretas", true )
setElementData ( source, "Habilitacoes:Barcos", true )
setElementData ( source, "Habilitacoes:Helicopteros", true )
setElementData ( source, "Habilitacoes:Avioes", true )
end
addCommandHandler ( "rs2", reset2 )

--------------------------------------------------------------------------------

-- Config Auto-Escola Geral

Tamanho, R, G, B, Alpha = 1.2, 22, 86, 231, 150

MarkerHab = createMarker( -2033.04480, -117.46468, 1035.17188 -1, "cylinder", Tamanho, 255, 0, 0, Alpha )
setElementInterior ( MarkerHab, 3 )
setElementDimension ( MarkerHab, 10 )

SaidaAutoEscola = createMarker ( -2026.86194, -104.12791, 1035.17188 -1, "cylinder", Tamanho, R, G, B, Alpha )
setElementInterior ( SaidaAutoEscola, 3 )
setElementDimension ( SaidaAutoEscola, 10 )

EntradaSF = createMarker ( -2026.62073, -101.46782, 35.16406 -1, "cylinder", Tamanho, R, G, B, Alpha )
local EntradaSFBlip = createBlipAttachedTo ( EntradaSF, 36 )
setBlipVisibleDistance ( EntradaSFBlip, 150)

EntradaLV = createMarker ( 2634.10547, 1716.65076, 11.02344 -1, "cylinder", Tamanho, R, G, B, Alpha )
local EntradaLVBlip = createBlipAttachedTo ( EntradaLV, 36 )
setBlipVisibleDistance ( EntradaLVBlip, 150)

EntradaLS = createMarker ( 1699.13550, -1667.85620, 20.19406 -1, "cylinder", Tamanho, R, G, B, Alpha )
local EntradaLSBlip = createBlipAttachedTo ( EntradaLS, 36 )
setBlipVisibleDistance ( EntradaLSBlip, 150)

function emarker(marker,md) 
    if (md) then
        if marker == MarkerHab then
            triggerClientEvent (source, "AirNew:AbrirAutoEscola", root )
        end
        if marker == SaidaAutoEscola then
            setTimer ( setElementInterior, 400, 1, source, 0 )
            setTimer ( setElementDimension, 400, 1, source, 0 )
            
            if getElementData ( source, "AirNew:AutoEscola" ) == "SF" then
            setTimer ( setElementPosition, 400, 1, source, -2026.62073, -101.46782 +2, 35.16406 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 0 )
            elseif getElementData ( source, "AirNew:AutoEscola" ) == "LV" then
            setTimer ( setElementPosition, 400, 1, source, 2634.10547 -2, 1716.65076, 11.02344 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 0 )
            elseif getElementData ( source, "AirNew:AutoEscola" ) == "LS" then
            setTimer ( setElementPosition, 400, 1, source, 1699.13550 -2, -1667.85620, 20.19406 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 90 )
            end
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
        if marker == EntradaSF then
            setElementData ( source, "AirNew:AutoEscola", "SF" )
            setTimer ( setElementInterior, 400, 1, source, 3 )
            setTimer ( setElementDimension, 400, 1, source, 10 )
            setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
        if marker == EntradaLV then
            setElementData ( source, "AirNew:AutoEscola", "LV" )
            setTimer ( setElementInterior, 400, 1, source, 3 )
            setTimer ( setElementDimension, 400, 1, source, 10 )
            setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
        if marker == EntradaLS then
            setElementData ( source, "AirNew:AutoEscola", "LS" )
            setTimer ( setElementInterior, 400, 1, source, 3 )
            setTimer ( setElementDimension, 400, 1, source, 10 )
            setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarker)

function lmarker(marker,md)
    if (md) then
        if marker == MarkerHab then
            triggerClientEvent (source, "AirNew:FecharAutoEscola", root )
        end
    end
end
addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)

MsgMultas = "Pague Suas Multas no Detran (Letra D no Mapa) Para Poder Tirar Suas Habilitações!"

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Moto

MotoRX, MotoRY, MotoRZ       = -2396.43237, -594.70099, 132.64844 -- Coordenadas de Respawn da Moto
MotoRotA, MotoRotB, MotoRotC = 0, 0, 124.86428833008 -- Rotação do Veiculo ao Spawnar
MotoID                       = 522 -- ID da Moto
HabValorMoto                 = 800 -- Valor da Habilitação Categoria "Motos"
MotosDanoParaReprovar        = 950 -- 95%

MsgMoto01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgMoto02 = "Você Não Tem Dinheiro Suficiente!"
MsgMoto03 = "Você Ja Possui Essa Habilitação!"
MsgMoto04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgMoto05 = "Carteira de Habilitação Categoria 'Motos' Concedida!"
MsgMoto06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgMoto07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

MotoX01, MotoY01, MotoZ01 = -2422.07007, -605.07965, 132.56250
MotoX02, MotoY02, MotoZ02 = -2445.08643, -561.66852, 127.07077
MotoX03, MotoY03, MotoZ03 = -2483.30347, -478.62625, 97.87623
MotoX04, MotoY04, MotoZ04 = -2560.02051, -488.40961, 78.45337
MotoX05, MotoY05, MotoZ05 = -2625.70630, -488.14209, 69.72830
MotoX06, MotoY06, MotoZ06 = -2534.92261, -466.62216, 70.20143
MotoX07, MotoY07, MotoZ07 = -2439.25806, -422.37332, 85.08891
MotoX08, MotoY08, MotoZ08 = -2375.37891, -438.73767, 81.99551
MotoX09, MotoY09, MotoZ09 = -2317.64746, -440.15088, 79.54469
MotoX10, MotoY10, MotoZ10 = -2403.41187, -369.33237, 74.28725
MotoX11, MotoY11, MotoZ11 = -2597.68823, -368.77106, 44.60019
MotoX12, MotoY12, MotoZ12 = -2680.39307, -440.12732, 30.35506
MotoX13, MotoY13, MotoZ13 = -2716.07153, -526.10675, 9.80222
MotoX14, MotoY14, MotoZ14 = -2812.60352, -461.69827, 7.03906
MotoX15, MotoY15, MotoZ15 = -2803.00708, -331.57635, 7.03906
MotoX16, MotoY16, MotoZ16 = -2785.26929, -311.93359, 7.03906

MarkerMoto01 = createMarker ( MotoX01, MotoY01, MotoZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto01 = createBlipAttachedTo ( MarkerMoto01, 0 )
setElementVisibleTo ( MarkerMoto01, root, false )
setElementVisibleTo ( BlipMoto01, root, false )

MarkerMoto02 = createMarker ( MotoX02, MotoY02, MotoZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto02 = createBlipAttachedTo ( MarkerMoto02, 0 )
setElementVisibleTo ( MarkerMoto02, root, false )
setElementVisibleTo ( BlipMoto02, root, false )

MarkerMoto03 = createMarker ( MotoX03, MotoY03, MotoZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto03 = createBlipAttachedTo ( MarkerMoto03, 0 )
setElementVisibleTo ( MarkerMoto03, root, false )
setElementVisibleTo ( BlipMoto03, root, false )

MarkerMoto04 = createMarker ( MotoX04, MotoY04, MotoZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto04 = createBlipAttachedTo ( MarkerMoto04, 0 )
setElementVisibleTo ( MarkerMoto04, root, false )
setElementVisibleTo ( BlipMoto04, root, false )

MarkerMoto05 = createMarker ( MotoX05, MotoY05, MotoZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto05 = createBlipAttachedTo ( MarkerMoto05, 0 )
setElementVisibleTo ( MarkerMoto05, root, false )
setElementVisibleTo ( BlipMoto05, root, false )

MarkerMoto06 = createMarker ( MotoX06, MotoY06, MotoZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto06 = createBlipAttachedTo ( MarkerMoto06, 0 )
setElementVisibleTo ( MarkerMoto06, root, false )
setElementVisibleTo ( BlipMoto06, root, false )

MarkerMoto07 = createMarker ( MotoX07, MotoY07, MotoZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto07 = createBlipAttachedTo ( MarkerMoto07, 0 )
setElementVisibleTo ( MarkerMoto07, root, false )
setElementVisibleTo ( BlipMoto07, root, false )

MarkerMoto08 = createMarker ( MotoX08, MotoY08, MotoZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto08 = createBlipAttachedTo ( MarkerMoto08, 0 )
setElementVisibleTo ( MarkerMoto08, root, false )
setElementVisibleTo ( BlipMoto08, root, false )

MarkerMoto09 = createMarker ( MotoX09, MotoY09, MotoZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto09 = createBlipAttachedTo ( MarkerMoto09, 0 )
setElementVisibleTo ( MarkerMoto09, root, false )
setElementVisibleTo ( BlipMoto09, root, false )

MarkerMoto10 = createMarker ( MotoX10, MotoY10, MotoZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto10 = createBlipAttachedTo ( MarkerMoto10, 0 )
setElementVisibleTo ( MarkerMoto10, root, false )
setElementVisibleTo ( BlipMoto10, root, false )

MarkerMoto11 = createMarker ( MotoX11, MotoY11, MotoZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto11 = createBlipAttachedTo ( MarkerMoto11, 0 )
setElementVisibleTo ( MarkerMoto11, root, false )
setElementVisibleTo ( BlipMoto11, root, false )

MarkerMoto12 = createMarker ( MotoX12, MotoY12, MotoZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto12 = createBlipAttachedTo ( MarkerMoto12, 0 )
setElementVisibleTo ( MarkerMoto12, root, false )
setElementVisibleTo ( BlipMoto12, root, false )

MarkerMoto13 = createMarker ( MotoX13, MotoY13, MotoZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto13 = createBlipAttachedTo ( MarkerMoto13, 0 )
setElementVisibleTo ( MarkerMoto13, root, false )
setElementVisibleTo ( BlipMoto13, root, false )

MarkerMoto14 = createMarker ( MotoX14, MotoY14, MotoZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto14 = createBlipAttachedTo ( MarkerMoto14, 0 )
setElementVisibleTo ( MarkerMoto14, root, false )
setElementVisibleTo ( BlipMoto14, root, false )

MarkerMoto15 = createMarker ( MotoX15, MotoY15, MotoZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto15 = createBlipAttachedTo ( MarkerMoto15, 0 )
setElementVisibleTo ( MarkerMoto15, root, false )
setElementVisibleTo ( BlipMoto15, root, false )

MarkerMoto16 = createMarker ( MotoX16, MotoY16, MotoZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto16 = createBlipAttachedTo ( MarkerMoto16, 0 )
setElementVisibleTo ( MarkerMoto16, root, false )
setElementVisibleTo ( BlipMoto16, root, false )

AutoEscolaMoto = {}

function MotosHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Motos" ) == true then
if getPlayerMoney(source) >= HabValorMoto then
takePlayerMoney(source, HabValorMoto)
if AutoEscolaMoto[source] and isElement( AutoEscolaMoto[source] ) then destroyElement ( AutoEscolaMoto[source] )
AutoEscolaMoto[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaMoto[source] = createVehicle( MotoID, MotoRX, MotoRY, MotoRZ )
setElementRotation ( AutoEscolaMoto[source], MotoRotA, MotoRotB, MotoRotC )
setVehicleLocked ( AutoEscolaMoto[source], true )
warpPedIntoVehicle ( source, AutoEscolaMoto[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartMoto00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerMoto01, source, true )
setElementVisibleTo ( BlipMoto01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgMoto01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgMoto02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgMoto03, "warning")
end
end
addEvent("Hab:Moto", true)
addEventHandler ( "Hab:Moto", root, MotosHab)

function emarkerMotos(marker,md) 
    if (md) then
      if AutoEscolaMoto[source] and isElement( AutoEscolaMoto[source] ) then
        if marker == MarkerMoto01 then
        if getElementData( source, "Carteira:StartMoto00", true ) then
        setElementVisibleTo ( MarkerMoto01, source, false )
        setElementVisibleTo ( BlipMoto01, source, false )
        setElementVisibleTo ( MarkerMoto02, source, true )
        setElementVisibleTo ( BlipMoto02, source, true )
        setElementData ( source, "Carteira:StartMoto01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto02 then
        if getElementData( source, "Carteira:StartMoto01", true ) then
        setElementVisibleTo ( MarkerMoto02, source, false )
        setElementVisibleTo ( BlipMoto02, source, false )
        setElementVisibleTo ( MarkerMoto03, source, true )
        setElementVisibleTo ( BlipMoto03, source, true )
        setElementData ( source, "Carteira:StartMoto02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto03 then
        if getElementData( source, "Carteira:StartMoto02", true ) then
        setElementVisibleTo ( MarkerMoto03, source, false )
        setElementVisibleTo ( BlipMoto03, source, false )
        setElementVisibleTo ( MarkerMoto04, source, true )
        setElementVisibleTo ( BlipMoto04, source, true )
        setElementData ( source, "Carteira:StartMoto03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto04 then
        if getElementData( source, "Carteira:StartMoto03", true ) then
        setElementVisibleTo ( MarkerMoto04, source, false )
        setElementVisibleTo ( BlipMoto04, source, false )
        setElementVisibleTo ( MarkerMoto05, source, true )
        setElementVisibleTo ( BlipMoto05, source, true )
        setElementData ( source, "Carteira:StartMoto04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto05 then
        if getElementData( source, "Carteira:StartMoto04", true ) then
        setElementVisibleTo ( MarkerMoto05, source, false )
        setElementVisibleTo ( BlipMoto05, source, false )
        setElementVisibleTo ( MarkerMoto06, source, true )
        setElementVisibleTo ( BlipMoto06, source, true )
        setElementData ( source, "Carteira:StartMoto05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto06 then
        if getElementData( source, "Carteira:StartMoto05", true ) then
        setElementVisibleTo ( MarkerMoto06, source, false )
        setElementVisibleTo ( BlipMoto06, source, false )
        setElementVisibleTo ( MarkerMoto07, source, true )
        setElementVisibleTo ( BlipMoto07, source, true )
        setElementData ( source, "Carteira:StartMoto06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto07 then
        if getElementData( source, "Carteira:StartMoto06", true ) then
        setElementVisibleTo ( MarkerMoto07, source, false )
        setElementVisibleTo ( BlipMoto07, source, false )
        setElementVisibleTo ( MarkerMoto08, source, true )
        setElementVisibleTo ( BlipMoto08, source, true )
        setElementData ( source, "Carteira:StartMoto07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto08 then
        if getElementData( source, "Carteira:StartMoto07", true ) then
        setElementVisibleTo ( MarkerMoto08, source, false )
        setElementVisibleTo ( BlipMoto08, source, false )
        setElementVisibleTo ( MarkerMoto09, source, true )
        setElementVisibleTo ( BlipMoto09, source, true )
        setElementData ( source, "Carteira:StartMoto08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto09 then
        if getElementData( source, "Carteira:StartMoto08", true ) then
        setElementVisibleTo ( MarkerMoto09, source, false )
        setElementVisibleTo ( BlipMoto09, source, false )
        setElementVisibleTo ( MarkerMoto10, source, true )
        setElementVisibleTo ( BlipMoto10, source, true )
        setElementData ( source, "Carteira:StartMoto09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto10 then
        if getElementData( source, "Carteira:StartMoto09", true ) then
        setElementVisibleTo ( MarkerMoto10, source, false )
        setElementVisibleTo ( BlipMoto10, source, false )
        setElementVisibleTo ( MarkerMoto11, source, true )
        setElementVisibleTo ( BlipMoto11, source, true )
        setElementData ( source, "Carteira:StartMoto10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto11 then
        if getElementData( source, "Carteira:StartMoto10", true ) then
        setElementVisibleTo ( MarkerMoto11, source, false )
        setElementVisibleTo ( BlipMoto11, source, false )
        setElementVisibleTo ( MarkerMoto12, source, true )
        setElementVisibleTo ( BlipMoto12, source, true )
        setElementData ( source, "Carteira:StartMoto11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto12 then
        if getElementData( source, "Carteira:StartMoto11", true ) then
        setElementVisibleTo ( MarkerMoto12, source, false )
        setElementVisibleTo ( BlipMoto12, source, false )
        setElementVisibleTo ( MarkerMoto13, source, true )
        setElementVisibleTo ( BlipMoto13, source, true )
        setElementData ( source, "Carteira:StartMoto12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto13 then
        if getElementData( source, "Carteira:StartMoto12", true ) then
        setElementVisibleTo ( MarkerMoto13, source, false )
        setElementVisibleTo ( BlipMoto13, source, false )
        setElementVisibleTo ( MarkerMoto14, source, true )
        setElementVisibleTo ( BlipMoto14, source, true )
        setElementData ( source, "Carteira:StartMoto13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto14 then
        if getElementData( source, "Carteira:StartMoto13", true ) then
        setElementVisibleTo ( MarkerMoto14, source, false )
        setElementVisibleTo ( BlipMoto14, source, false )
        setElementVisibleTo ( MarkerMoto15, source, true )
        setElementVisibleTo ( BlipMoto15, source, true )
        setElementData ( source, "Carteira:StartMoto14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto15 then
        if getElementData( source, "Carteira:StartMoto14", true ) then
        setElementVisibleTo ( MarkerMoto15, source, false )
        setElementVisibleTo ( BlipMoto15, source, false )
        setElementVisibleTo ( MarkerMoto16, source, true )
        setElementVisibleTo ( BlipMoto16, source, true )
        setElementData ( source, "Carteira:StartMoto15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto16 then
        if getElementData( source, "Carteira:StartMoto15", true ) then
        AutoEscolaMotoVida = getElementHealth ( AutoEscolaMoto[source] )
        if AutoEscolaMotoVida <= MotosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgMoto04, "error")
        else
        setElementData( source, "Habilitacoes:Motos", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgMoto05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto15", false )
        setElementVisibleTo ( MarkerMoto16, source, false )
        setElementVisibleTo ( BlipMoto16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaMoto[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerMotos)

function SairDoVeiculoAutoEscolaMoto (source)
if ( AutoEscolaMoto[source] ) and isElement( AutoEscolaMoto[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaMoto[source] )
setElementData ( source, "Carteira:StartMoto00", false )
setElementData ( source, "Carteira:StartMoto01", false )
setElementData ( source, "Carteira:StartMoto02", false )
setElementData ( source, "Carteira:StartMoto03", false )
setElementData ( source, "Carteira:StartMoto04", false )
setElementData ( source, "Carteira:StartMoto05", false )
setElementData ( source, "Carteira:StartMoto06", false )
setElementData ( source, "Carteira:StartMoto07", false )
setElementData ( source, "Carteira:StartMoto08", false )
setElementData ( source, "Carteira:StartMoto09", false )
setElementData ( source, "Carteira:StartMoto10", false )
setElementData ( source, "Carteira:StartMoto11", false )
setElementData ( source, "Carteira:StartMoto12", false )
setElementData ( source, "Carteira:StartMoto13", false )
setElementData ( source, "Carteira:StartMoto14", false )
setElementData ( source, "Carteira:StartMoto15", false )
setElementVisibleTo ( MarkerMoto01, source, false )
setElementVisibleTo ( BlipMoto01, source, false )
setElementVisibleTo ( MarkerMoto02, source, false )
setElementVisibleTo ( BlipMoto02, source, false )
setElementVisibleTo ( MarkerMoto03, source, false )
setElementVisibleTo ( BlipMoto03, source, false )
setElementVisibleTo ( MarkerMoto04, source, false )
setElementVisibleTo ( BlipMoto04, source, false )
setElementVisibleTo ( MarkerMoto05, source, false )
setElementVisibleTo ( BlipMoto05, source, false )
setElementVisibleTo ( MarkerMoto06, source, false )
setElementVisibleTo ( BlipMoto06, source, false )
setElementVisibleTo ( MarkerMoto07, source, false )
setElementVisibleTo ( BlipMoto07, source, false )
setElementVisibleTo ( MarkerMoto08, source, false )
setElementVisibleTo ( BlipMoto08, source, false )
setElementVisibleTo ( MarkerMoto09, source, false )
setElementVisibleTo ( BlipMoto09, source, false )
setElementVisibleTo ( MarkerMoto10, source, false )
setElementVisibleTo ( BlipMoto10, source, false )
setElementVisibleTo ( MarkerMoto11, source, false )
setElementVisibleTo ( BlipMoto11, source, false )
setElementVisibleTo ( MarkerMoto12, source, false )
setElementVisibleTo ( BlipMoto12, source, false )
setElementVisibleTo ( MarkerMoto13, source, false )
setElementVisibleTo ( BlipMoto13, source, false )
setElementVisibleTo ( MarkerMoto14, source, false )
setElementVisibleTo ( BlipMoto14, source, false )
setElementVisibleTo ( MarkerMoto15, source, false )
setElementVisibleTo ( BlipMoto15, source, false )
setElementVisibleTo ( MarkerMoto16, source, false )
setElementVisibleTo ( BlipMoto16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgMoto06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaMoto )

function MorrerAutoEscolaMoto ()
if ( AutoEscolaMoto[source] ) and isElement( AutoEscolaMoto[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaMoto[source] )
setElementData ( source, "Carteira:StartMoto00", false )
setElementData ( source, "Carteira:StartMoto01", false )
setElementData ( source, "Carteira:StartMoto02", false )
setElementData ( source, "Carteira:StartMoto03", false )
setElementData ( source, "Carteira:StartMoto04", false )
setElementData ( source, "Carteira:StartMoto05", false )
setElementData ( source, "Carteira:StartMoto06", false )
setElementData ( source, "Carteira:StartMoto07", false )
setElementData ( source, "Carteira:StartMoto08", false )
setElementData ( source, "Carteira:StartMoto09", false )
setElementData ( source, "Carteira:StartMoto10", false )
setElementData ( source, "Carteira:StartMoto11", false )
setElementData ( source, "Carteira:StartMoto12", false )
setElementData ( source, "Carteira:StartMoto13", false )
setElementData ( source, "Carteira:StartMoto14", false )
setElementData ( source, "Carteira:StartMoto15", false )
setElementVisibleTo ( MarkerMoto01, source, false )
setElementVisibleTo ( BlipMoto01, source, false )
setElementVisibleTo ( MarkerMoto02, source, false )
setElementVisibleTo ( BlipMoto02, source, false )
setElementVisibleTo ( MarkerMoto03, source, false )
setElementVisibleTo ( BlipMoto03, source, false )
setElementVisibleTo ( MarkerMoto04, source, false )
setElementVisibleTo ( BlipMoto04, source, false )
setElementVisibleTo ( MarkerMoto05, source, false )
setElementVisibleTo ( BlipMoto05, source, false )
setElementVisibleTo ( MarkerMoto06, source, false )
setElementVisibleTo ( BlipMoto06, source, false )
setElementVisibleTo ( MarkerMoto07, source, false )
setElementVisibleTo ( BlipMoto07, source, false )
setElementVisibleTo ( MarkerMoto08, source, false )
setElementVisibleTo ( BlipMoto08, source, false )
setElementVisibleTo ( MarkerMoto09, source, false )
setElementVisibleTo ( BlipMoto09, source, false )
setElementVisibleTo ( MarkerMoto10, source, false )
setElementVisibleTo ( BlipMoto10, source, false )
setElementVisibleTo ( MarkerMoto11, source, false )
setElementVisibleTo ( BlipMoto11, source, false )
setElementVisibleTo ( MarkerMoto12, source, false )
setElementVisibleTo ( BlipMoto12, source, false )
setElementVisibleTo ( MarkerMoto13, source, false )
setElementVisibleTo ( BlipMoto13, source, false )
setElementVisibleTo ( MarkerMoto14, source, false )
setElementVisibleTo ( BlipMoto14, source, false )
setElementVisibleTo ( MarkerMoto15, source, false )
setElementVisibleTo ( BlipMoto15, source, false )
setElementVisibleTo ( MarkerMoto16, source, false )
setElementVisibleTo ( BlipMoto16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgMoto07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaMoto )

function SairDoServidorAutoEscolaMoto ( quitType )    
if isElement( AutoEscolaMoto[source] ) then
destroyElement ( AutoEscolaMoto[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaMoto )

-- ( Final ) Percurso de Moto

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Carro

CarroRX, CarroRY, CarroRZ       = -270.44916, 1547.39783, 75.35938 -- Coordenadas de Respawn do Carro
CarroRotA, CarroRotB, CarroRotC = 0, 0, 135.25268554688 -- Rotação do Veiculo ao Spawnar
CarroID                         = 516 -- ID do Carro
HabValorCarro                   = 1000 -- Valor da Habilitação Categoria "Carros"
CarrosDanoParaReprovar          = 950 -- 95%

MsgCarro01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCarro02 = "Você Não Tem Dinheiro Suficiente!"
MsgCarro03 = "Você Ja Possui Essa Habilitação!"
MsgCarro04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCarro05 = "Carteira de Habilitação Categoria 'Carros' Concedida!"
MsgCarro06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCarro07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CarroX01, CarroY01, CarroZ01 = -304.31372, 1497.35303, 75.67019
CarroX02, CarroY02, CarroZ02 = -297.91571, 1412.75647, 72.31325
CarroX03, CarroY03, CarroZ03 = -358.71982, 1398.42810, 58.37130
CarroX04, CarroY04, CarroZ04 = -383.39719, 1397.47485, 42.07113
CarroX05, CarroY05, CarroZ05 = -453.04425, 1579.76025, 36.17015
CarroX06, CarroY06, CarroZ06 = -403.00198, 1714.00647, 40.57639
CarroX07, CarroY07, CarroZ07 = -388.58905, 1880.69397, 55.31573
CarroX08, CarroY08, CarroZ08 = -429.19666, 1818.11926, 67.87206
CarroX09, CarroY09, CarroZ09 = -468.87231, 1869.95264, 82.43024
CarroX10, CarroY10, CarroZ10 = -397.42804, 2034.05908, 65.20287
CarroX11, CarroY11, CarroZ11 = -458.04187, 2028.86401, 60.53470
CarroX12, CarroY12, CarroZ12 = -541.70868, 2008.56213, 60.21884
CarroX13, CarroY13, CarroZ13 = -652.17749, 2064.89575, 60.21832
CarroX14, CarroY14, CarroZ14 = -757.40155, 2064.42749, 60.22342
CarroX15, CarroY15, CarroZ15 = -851.88013, 2019.84998, 60.22160
CarroX16, CarroY16, CarroZ16 = -912.48688, 2008.76563, 60.94514

MarkerCarro01 = createMarker ( CarroX01, CarroY01, CarroZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro01 = createBlipAttachedTo ( MarkerCarro01, 0 )
setElementVisibleTo ( MarkerCarro01, root, false )
setElementVisibleTo ( BlipCarro01, root, false )

MarkerCarro02 = createMarker ( CarroX02, CarroY02, CarroZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro02 = createBlipAttachedTo ( MarkerCarro02, 0 )
setElementVisibleTo ( MarkerCarro02, root, false )
setElementVisibleTo ( BlipCarro02, root, false )

MarkerCarro03 = createMarker ( CarroX03, CarroY03, CarroZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro03 = createBlipAttachedTo ( MarkerCarro03, 0 )
setElementVisibleTo ( MarkerCarro03, root, false )
setElementVisibleTo ( BlipCarro03, root, false )

MarkerCarro04 = createMarker ( CarroX04, CarroY04, CarroZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro04 = createBlipAttachedTo ( MarkerCarro04, 0 )
setElementVisibleTo ( MarkerCarro04, root, false )
setElementVisibleTo ( BlipCarro04, root, false )

MarkerCarro05 = createMarker ( CarroX05, CarroY05, CarroZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro05 = createBlipAttachedTo ( MarkerCarro05, 0 )
setElementVisibleTo ( MarkerCarro05, root, false )
setElementVisibleTo ( BlipCarro05, root, false )

MarkerCarro06 = createMarker ( CarroX06, CarroY06, CarroZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro06 = createBlipAttachedTo ( MarkerCarro06, 0 )
setElementVisibleTo ( MarkerCarro06, root, false )
setElementVisibleTo ( BlipCarro06, root, false )

MarkerCarro07 = createMarker ( CarroX07, CarroY07, CarroZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro07 = createBlipAttachedTo ( MarkerCarro07, 0 )
setElementVisibleTo ( MarkerCarro07, root, false )
setElementVisibleTo ( BlipCarro07, root, false )

MarkerCarro08 = createMarker ( CarroX08, CarroY08, CarroZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro08 = createBlipAttachedTo ( MarkerCarro08, 0 )
setElementVisibleTo ( MarkerCarro08, root, false )
setElementVisibleTo ( BlipCarro08, root, false )

MarkerCarro09 = createMarker ( CarroX09, CarroY09, CarroZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro09 = createBlipAttachedTo ( MarkerCarro09, 0 )
setElementVisibleTo ( MarkerCarro09, root, false )
setElementVisibleTo ( BlipCarro09, root, false )

MarkerCarro10 = createMarker ( CarroX10, CarroY10, CarroZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro10 = createBlipAttachedTo ( MarkerCarro10, 0 )
setElementVisibleTo ( MarkerCarro10, root, false )
setElementVisibleTo ( BlipCarro10, root, false )

MarkerCarro11 = createMarker ( CarroX11, CarroY11, CarroZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro11 = createBlipAttachedTo ( MarkerCarro11, 0 )
setElementVisibleTo ( MarkerCarro11, root, false )
setElementVisibleTo ( BlipCarro11, root, false )

MarkerCarro12 = createMarker ( CarroX12, CarroY12, CarroZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro12 = createBlipAttachedTo ( MarkerCarro12, 0 )
setElementVisibleTo ( MarkerCarro12, root, false )
setElementVisibleTo ( BlipCarro12, root, false )

MarkerCarro13 = createMarker ( CarroX13, CarroY13, CarroZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro13 = createBlipAttachedTo ( MarkerCarro13, 0 )
setElementVisibleTo ( MarkerCarro13, root, false )
setElementVisibleTo ( BlipCarro13, root, false )

MarkerCarro14 = createMarker ( CarroX14, CarroY14, CarroZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro14 = createBlipAttachedTo ( MarkerCarro14, 0 )
setElementVisibleTo ( MarkerCarro14, root, false )
setElementVisibleTo ( BlipCarro14, root, false )

MarkerCarro15 = createMarker ( CarroX15, CarroY15, CarroZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro15 = createBlipAttachedTo ( MarkerCarro15, 0 )
setElementVisibleTo ( MarkerCarro15, root, false )
setElementVisibleTo ( BlipCarro15, root, false )

MarkerCarro16 = createMarker ( CarroX16, CarroY16, CarroZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro16 = createBlipAttachedTo ( MarkerCarro16, 0 )
setElementVisibleTo ( MarkerCarro16, root, false )
setElementVisibleTo ( BlipCarro16, root, false )

AutoEscolaCarro = {}

function CarrosHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Carros" ) == true then
if getPlayerMoney(source) >= HabValorCarro then
takePlayerMoney(source, HabValorCarro)
if AutoEscolaCarro[source] and isElement( AutoEscolaCarro[source] ) then destroyElement ( AutoEscolaCarro[source] )
AutoEscolaCarro[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCarro[source] = createVehicle( CarroID, CarroRX, CarroRY, CarroRZ )
setElementRotation ( AutoEscolaCarro[source], CarroRotA, CarroRotB, CarroRotC )
setVehicleLocked ( AutoEscolaCarro[source], true )
warpPedIntoVehicle ( source, AutoEscolaCarro[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCarro00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCarro01, source, true )
setElementVisibleTo ( BlipCarro01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarro02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarro03, "warning")
end
end
addEvent("Hab:Carro", true)
addEventHandler ( "Hab:Carro", root, CarrosHab)

function emarkerCarros(marker,md) 
    if (md) then
      if AutoEscolaCarro[source] and isElement( AutoEscolaCarro[source] ) then
        if marker == MarkerCarro01 then
        if getElementData( source, "Carteira:StartCarro00", true ) then
        setElementVisibleTo ( MarkerCarro01, source, false )
        setElementVisibleTo ( BlipCarro01, source, false )
        setElementVisibleTo ( MarkerCarro02, source, true )
        setElementVisibleTo ( BlipCarro02, source, true )
        setElementData ( source, "Carteira:StartCarro01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro02 then
        if getElementData( source, "Carteira:StartCarro01", true ) then
        setElementVisibleTo ( MarkerCarro02, source, false )
        setElementVisibleTo ( BlipCarro02, source, false )
        setElementVisibleTo ( MarkerCarro03, source, true )
        setElementVisibleTo ( BlipCarro03, source, true )
        setElementData ( source, "Carteira:StartCarro02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro03 then
        if getElementData( source, "Carteira:StartCarro02", true ) then
        setElementVisibleTo ( MarkerCarro03, source, false )
        setElementVisibleTo ( BlipCarro03, source, false )
        setElementVisibleTo ( MarkerCarro04, source, true )
        setElementVisibleTo ( BlipCarro04, source, true )
        setElementData ( source, "Carteira:StartCarro03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro04 then
        if getElementData( source, "Carteira:StartCarro03", true ) then
        setElementVisibleTo ( MarkerCarro04, source, false )
        setElementVisibleTo ( BlipCarro04, source, false )
        setElementVisibleTo ( MarkerCarro05, source, true )
        setElementVisibleTo ( BlipCarro05, source, true )
        setElementData ( source, "Carteira:StartCarro04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro05 then
        if getElementData( source, "Carteira:StartCarro04", true ) then
        setElementVisibleTo ( MarkerCarro05, source, false )
        setElementVisibleTo ( BlipCarro05, source, false )
        setElementVisibleTo ( MarkerCarro06, source, true )
        setElementVisibleTo ( BlipCarro06, source, true )
        setElementData ( source, "Carteira:StartCarro05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro06 then
        if getElementData( source, "Carteira:StartCarro05", true ) then
        setElementVisibleTo ( MarkerCarro06, source, false )
        setElementVisibleTo ( BlipCarro06, source, false )
        setElementVisibleTo ( MarkerCarro07, source, true )
        setElementVisibleTo ( BlipCarro07, source, true )
        setElementData ( source, "Carteira:StartCarro06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro07 then
        if getElementData( source, "Carteira:StartCarro06", true ) then
        setElementVisibleTo ( MarkerCarro07, source, false )
        setElementVisibleTo ( BlipCarro07, source, false )
        setElementVisibleTo ( MarkerCarro08, source, true )
        setElementVisibleTo ( BlipCarro08, source, true )
        setElementData ( source, "Carteira:StartCarro07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro08 then
        if getElementData( source, "Carteira:StartCarro07", true ) then
        setElementVisibleTo ( MarkerCarro08, source, false )
        setElementVisibleTo ( BlipCarro08, source, false )
        setElementVisibleTo ( MarkerCarro09, source, true )
        setElementVisibleTo ( BlipCarro09, source, true )
        setElementData ( source, "Carteira:StartCarro08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro09 then
        if getElementData( source, "Carteira:StartCarro08", true ) then
        setElementVisibleTo ( MarkerCarro09, source, false )
        setElementVisibleTo ( BlipCarro09, source, false )
        setElementVisibleTo ( MarkerCarro10, source, true )
        setElementVisibleTo ( BlipCarro10, source, true )
        setElementData ( source, "Carteira:StartCarro09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro10 then
        if getElementData( source, "Carteira:StartCarro09", true ) then
        setElementVisibleTo ( MarkerCarro10, source, false )
        setElementVisibleTo ( BlipCarro10, source, false )
        setElementVisibleTo ( MarkerCarro11, source, true )
        setElementVisibleTo ( BlipCarro11, source, true )
        setElementData ( source, "Carteira:StartCarro10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro11 then
        if getElementData( source, "Carteira:StartCarro10", true ) then
        setElementVisibleTo ( MarkerCarro11, source, false )
        setElementVisibleTo ( BlipCarro11, source, false )
        setElementVisibleTo ( MarkerCarro12, source, true )
        setElementVisibleTo ( BlipCarro12, source, true )
        setElementData ( source, "Carteira:StartCarro11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro12 then
        if getElementData( source, "Carteira:StartCarro11", true ) then
        setElementVisibleTo ( MarkerCarro12, source, false )
        setElementVisibleTo ( BlipCarro12, source, false )
        setElementVisibleTo ( MarkerCarro13, source, true )
        setElementVisibleTo ( BlipCarro13, source, true )
        setElementData ( source, "Carteira:StartCarro12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro13 then
        if getElementData( source, "Carteira:StartCarro12", true ) then
        setElementVisibleTo ( MarkerCarro13, source, false )
        setElementVisibleTo ( BlipCarro13, source, false )
        setElementVisibleTo ( MarkerCarro14, source, true )
        setElementVisibleTo ( BlipCarro14, source, true )
        setElementData ( source, "Carteira:StartCarro13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro14 then
        if getElementData( source, "Carteira:StartCarro13", true ) then
        setElementVisibleTo ( MarkerCarro14, source, false )
        setElementVisibleTo ( BlipCarro14, source, false )
        setElementVisibleTo ( MarkerCarro15, source, true )
        setElementVisibleTo ( BlipCarro15, source, true )
        setElementData ( source, "Carteira:StartCarro14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro15 then
        if getElementData( source, "Carteira:StartCarro14", true ) then
        setElementVisibleTo ( MarkerCarro15, source, false )
        setElementVisibleTo ( BlipCarro15, source, false )
        setElementVisibleTo ( MarkerCarro16, source, true )
        setElementVisibleTo ( BlipCarro16, source, true )
        setElementData ( source, "Carteira:StartCarro15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro16 then
        if getElementData( source, "Carteira:StartCarro15", true ) then
        AutoEscolaCarroVida = getElementHealth ( AutoEscolaCarro[source] )
        if AutoEscolaCarroVida <= CarrosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgCarro04, "error")
        else
        setElementData( source, "Habilitacoes:Carros", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgCarro05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro15", false )
        setElementVisibleTo ( MarkerCarro16, source, false )
        setElementVisibleTo ( BlipCarro16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaCarro[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCarros)

function SairDoVeiculoAutoEscolaCarro (source)
if ( AutoEscolaCarro[source] ) and isElement( AutoEscolaCarro[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarro[source] )
setElementData ( source, "Carteira:StartCarro00", false )
setElementData ( source, "Carteira:StartCarro01", false )
setElementData ( source, "Carteira:StartCarro02", false )
setElementData ( source, "Carteira:StartCarro03", false )
setElementData ( source, "Carteira:StartCarro04", false )
setElementData ( source, "Carteira:StartCarro05", false )
setElementData ( source, "Carteira:StartCarro06", false )
setElementData ( source, "Carteira:StartCarro07", false )
setElementData ( source, "Carteira:StartCarro08", false )
setElementData ( source, "Carteira:StartCarro09", false )
setElementData ( source, "Carteira:StartCarro10", false )
setElementData ( source, "Carteira:StartCarro11", false )
setElementData ( source, "Carteira:StartCarro12", false )
setElementData ( source, "Carteira:StartCarro13", false )
setElementData ( source, "Carteira:StartCarro14", false )
setElementData ( source, "Carteira:StartCarro15", false )
setElementVisibleTo ( MarkerCarro01, source, false )
setElementVisibleTo ( BlipCarro01, source, false )
setElementVisibleTo ( MarkerCarro02, source, false )
setElementVisibleTo ( BlipCarro02, source, false )
setElementVisibleTo ( MarkerCarro03, source, false )
setElementVisibleTo ( BlipCarro03, source, false )
setElementVisibleTo ( MarkerCarro04, source, false )
setElementVisibleTo ( BlipCarro04, source, false )
setElementVisibleTo ( MarkerCarro05, source, false )
setElementVisibleTo ( BlipCarro05, source, false )
setElementVisibleTo ( MarkerCarro06, source, false )
setElementVisibleTo ( BlipCarro06, source, false )
setElementVisibleTo ( MarkerCarro07, source, false )
setElementVisibleTo ( BlipCarro07, source, false )
setElementVisibleTo ( MarkerCarro08, source, false )
setElementVisibleTo ( BlipCarro08, source, false )
setElementVisibleTo ( MarkerCarro09, source, false )
setElementVisibleTo ( BlipCarro09, source, false )
setElementVisibleTo ( MarkerCarro10, source, false )
setElementVisibleTo ( BlipCarro10, source, false )
setElementVisibleTo ( MarkerCarro11, source, false )
setElementVisibleTo ( BlipCarro11, source, false )
setElementVisibleTo ( MarkerCarro12, source, false )
setElementVisibleTo ( BlipCarro12, source, false )
setElementVisibleTo ( MarkerCarro13, source, false )
setElementVisibleTo ( BlipCarro13, source, false )
setElementVisibleTo ( MarkerCarro14, source, false )
setElementVisibleTo ( BlipCarro14, source, false )
setElementVisibleTo ( MarkerCarro15, source, false )
setElementVisibleTo ( BlipCarro15, source, false )
setElementVisibleTo ( MarkerCarro16, source, false )
setElementVisibleTo ( BlipCarro16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCarro )

function MorrerAutoEscolaCarro ()
if ( AutoEscolaCarro[source] ) and isElement( AutoEscolaCarro[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarro[source] )
setElementData ( source, "Carteira:StartCarro00", false )
setElementData ( source, "Carteira:StartCarro01", false )
setElementData ( source, "Carteira:StartCarro02", false )
setElementData ( source, "Carteira:StartCarro03", false )
setElementData ( source, "Carteira:StartCarro04", false )
setElementData ( source, "Carteira:StartCarro05", false )
setElementData ( source, "Carteira:StartCarro06", false )
setElementData ( source, "Carteira:StartCarro07", false )
setElementData ( source, "Carteira:StartCarro08", false )
setElementData ( source, "Carteira:StartCarro09", false )
setElementData ( source, "Carteira:StartCarro10", false )
setElementData ( source, "Carteira:StartCarro11", false )
setElementData ( source, "Carteira:StartCarro12", false )
setElementData ( source, "Carteira:StartCarro13", false )
setElementData ( source, "Carteira:StartCarro14", false )
setElementData ( source, "Carteira:StartCarro15", false )
setElementVisibleTo ( MarkerCarro01, source, false )
setElementVisibleTo ( BlipCarro01, source, false )
setElementVisibleTo ( MarkerCarro02, source, false )
setElementVisibleTo ( BlipCarro02, source, false )
setElementVisibleTo ( MarkerCarro03, source, false )
setElementVisibleTo ( BlipCarro03, source, false )
setElementVisibleTo ( MarkerCarro04, source, false )
setElementVisibleTo ( BlipCarro04, source, false )
setElementVisibleTo ( MarkerCarro05, source, false )
setElementVisibleTo ( BlipCarro05, source, false )
setElementVisibleTo ( MarkerCarro06, source, false )
setElementVisibleTo ( BlipCarro06, source, false )
setElementVisibleTo ( MarkerCarro07, source, false )
setElementVisibleTo ( BlipCarro07, source, false )
setElementVisibleTo ( MarkerCarro08, source, false )
setElementVisibleTo ( BlipCarro08, source, false )
setElementVisibleTo ( MarkerCarro09, source, false )
setElementVisibleTo ( BlipCarro09, source, false )
setElementVisibleTo ( MarkerCarro10, source, false )
setElementVisibleTo ( BlipCarro10, source, false )
setElementVisibleTo ( MarkerCarro11, source, false )
setElementVisibleTo ( BlipCarro11, source, false )
setElementVisibleTo ( MarkerCarro12, source, false )
setElementVisibleTo ( BlipCarro12, source, false )
setElementVisibleTo ( MarkerCarro13, source, false )
setElementVisibleTo ( BlipCarro13, source, false )
setElementVisibleTo ( MarkerCarro14, source, false )
setElementVisibleTo ( BlipCarro14, source, false )
setElementVisibleTo ( MarkerCarro15, source, false )
setElementVisibleTo ( BlipCarro15, source, false )
setElementVisibleTo ( MarkerCarro16, source, false )
setElementVisibleTo ( BlipCarro16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCarro )

function SairDoServidorAutoEscolaCarro ( quitType )    
if isElement( AutoEscolaCarro[source] ) then
destroyElement ( AutoEscolaCarro[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCarro )

-- ( Final ) Percurso de Carro

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Caminhoes

CaminhoesRX, CaminhoesRY, CaminhoesRZ       = -186.86996, -282.80127, 2 -- Coordenadas de Respawn do Caminhão
CaminhoesRotA, CaminhoesRotB, CaminhoesRotC = 0, 0, 89.390258789062 -- Rotação do Veiculo ao Spawnar
CaminhoesID                                 = 578 -- ID do Caminhão
HabValorCaminhoes                           = 1200 -- Valor da Habilitação Categoria "Caminhoes"
CaminhoesDanoParaReprovar                   = 950 -- 95%

MsgCaminhoes01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCaminhoes02 = "Você Não Tem Dinheiro Suficiente!"
MsgCaminhoes03 = "Você Ja Possui Essa Habilitação!"
MsgCaminhoes04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCaminhoes05 = "Carteira de Habilitação Categoria 'Caminhões' Concedida!"
MsgCaminhoes06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCaminhoes07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CaminhoesX01, CaminhoesY01, CaminhoesZ01 = -363.84027, -259.21094, 18.09703
CaminhoesX02, CaminhoesY02, CaminhoesZ02 = -622.80951, -239.56918, 63.33517
CaminhoesX03, CaminhoesY03, CaminhoesZ03 = -834.09595, -244.60388, 39.88686
CaminhoesX04, CaminhoesY04, CaminhoesZ04 = -922.18018, -161.59911, 51.42817
CaminhoesX05, CaminhoesY05, CaminhoesZ05 = -729.85437, -81.97001, 68.00546
CaminhoesX06, CaminhoesY06, CaminhoesZ06 = -704.71832, 14.58052, 63.10910
CaminhoesX07, CaminhoesY07, CaminhoesZ07 = -883.24341, -35.44294, 33.93914
CaminhoesX08, CaminhoesY08, CaminhoesZ08 = -701.52087, 117.37077, 17.28315
CaminhoesX09, CaminhoesY09, CaminhoesZ09 = -612.81458, 272.79623, 2.11294
CaminhoesX10, CaminhoesY10, CaminhoesZ10 = -454.35080, 279.44788, 2.12201
CaminhoesX11, CaminhoesY11, CaminhoesZ11 = -282.21484, 256.32724, 5.90919
CaminhoesX12, CaminhoesY12, CaminhoesZ12 = -52.85775, 186.78911, 2.11299
CaminhoesX13, CaminhoesY13, CaminhoesZ13 = 148.15988, 70.31498, 2.10743
CaminhoesX14, CaminhoesY14, CaminhoesZ14 = 230.43140, -11.07954, 1.54030
CaminhoesX15, CaminhoesY15, CaminhoesZ15 = 280.68811, -74.20872, 1.46440
CaminhoesX16, CaminhoesY16, CaminhoesZ16 = 319.41028, -53.83272, 1.60561

MarkerCaminhoes01 = createMarker ( CaminhoesX01, CaminhoesY01, CaminhoesZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes01 = createBlipAttachedTo ( MarkerCaminhoes01, 0 )
setElementVisibleTo ( MarkerCaminhoes01, root, false )
setElementVisibleTo ( BlipCaminhoes01, root, false )

MarkerCaminhoes02 = createMarker ( CaminhoesX02, CaminhoesY02, CaminhoesZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes02 = createBlipAttachedTo ( MarkerCaminhoes02, 0 )
setElementVisibleTo ( MarkerCaminhoes02, root, false )
setElementVisibleTo ( BlipCaminhoes02, root, false )

MarkerCaminhoes03 = createMarker ( CaminhoesX03, CaminhoesY03, CaminhoesZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes03 = createBlipAttachedTo ( MarkerCaminhoes03, 0 )
setElementVisibleTo ( MarkerCaminhoes03, root, false )
setElementVisibleTo ( BlipCaminhoes03, root, false )

MarkerCaminhoes04 = createMarker ( CaminhoesX04, CaminhoesY04, CaminhoesZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes04 = createBlipAttachedTo ( MarkerCaminhoes04, 0 )
setElementVisibleTo ( MarkerCaminhoes04, root, false )
setElementVisibleTo ( BlipCaminhoes04, root, false )

MarkerCaminhoes05 = createMarker ( CaminhoesX05, CaminhoesY05, CaminhoesZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes05 = createBlipAttachedTo ( MarkerCaminhoes05, 0 )
setElementVisibleTo ( MarkerCaminhoes05, root, false )
setElementVisibleTo ( BlipCaminhoes05, root, false )

MarkerCaminhoes06 = createMarker ( CaminhoesX06, CaminhoesY06, CaminhoesZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes06 = createBlipAttachedTo ( MarkerCaminhoes06, 0 )
setElementVisibleTo ( MarkerCaminhoes06, root, false )
setElementVisibleTo ( BlipCaminhoes06, root, false )

MarkerCaminhoes07 = createMarker ( CaminhoesX07, CaminhoesY07, CaminhoesZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes07 = createBlipAttachedTo ( MarkerCaminhoes07, 0 )
setElementVisibleTo ( MarkerCaminhoes07, root, false )
setElementVisibleTo ( BlipCaminhoes07, root, false )

MarkerCaminhoes08 = createMarker ( CaminhoesX08, CaminhoesY08, CaminhoesZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes08 = createBlipAttachedTo ( MarkerCaminhoes08, 0 )
setElementVisibleTo ( MarkerCaminhoes08, root, false )
setElementVisibleTo ( BlipCaminhoes08, root, false )

MarkerCaminhoes09 = createMarker ( CaminhoesX09, CaminhoesY09, CaminhoesZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes09 = createBlipAttachedTo ( MarkerCaminhoes09, 0 )
setElementVisibleTo ( MarkerCaminhoes09, root, false )
setElementVisibleTo ( BlipCaminhoes09, root, false )

MarkerCaminhoes10 = createMarker ( CaminhoesX10, CaminhoesY10, CaminhoesZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes10 = createBlipAttachedTo ( MarkerCaminhoes10, 0 )
setElementVisibleTo ( MarkerCaminhoes10, root, false )
setElementVisibleTo ( BlipCaminhoes10, root, false )

MarkerCaminhoes11 = createMarker ( CaminhoesX11, CaminhoesY11, CaminhoesZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes11 = createBlipAttachedTo ( MarkerCaminhoes11, 0 )
setElementVisibleTo ( MarkerCaminhoes11, root, false )
setElementVisibleTo ( BlipCaminhoes11, root, false )

MarkerCaminhoes12 = createMarker ( CaminhoesX12, CaminhoesY12, CaminhoesZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes12 = createBlipAttachedTo ( MarkerCaminhoes12, 0 )
setElementVisibleTo ( MarkerCaminhoes12, root, false )
setElementVisibleTo ( BlipCaminhoes12, root, false )

MarkerCaminhoes13 = createMarker ( CaminhoesX13, CaminhoesY13, CaminhoesZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes13 = createBlipAttachedTo ( MarkerCaminhoes13, 0 )
setElementVisibleTo ( MarkerCaminhoes13, root, false )
setElementVisibleTo ( BlipCaminhoes13, root, false )

MarkerCaminhoes14 = createMarker ( CaminhoesX14, CaminhoesY14, CaminhoesZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes14 = createBlipAttachedTo ( MarkerCaminhoes14, 0 )
setElementVisibleTo ( MarkerCaminhoes14, root, false )
setElementVisibleTo ( BlipCaminhoes14, root, false )

MarkerCaminhoes15 = createMarker ( CaminhoesX15, CaminhoesY15, CaminhoesZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes15 = createBlipAttachedTo ( MarkerCaminhoes15, 0 )
setElementVisibleTo ( MarkerCaminhoes15, root, false )
setElementVisibleTo ( BlipCaminhoes15, root, false )

MarkerCaminhoes16 = createMarker ( CaminhoesX16, CaminhoesY16, CaminhoesZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes16 = createBlipAttachedTo ( MarkerCaminhoes16, 0 )
setElementVisibleTo ( MarkerCaminhoes16, root, false )
setElementVisibleTo ( BlipCaminhoes16, root, false )

AutoEscolaCaminhoes = {}

function CaminhoesHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Caminhoes" ) == true then
if getPlayerMoney(source) >= HabValorCaminhoes then
takePlayerMoney(source, HabValorCaminhoes)
if AutoEscolaCaminhoes[source] and isElement( AutoEscolaCaminhoes[source] ) then destroyElement ( AutoEscolaCaminhoes[source] )
AutoEscolaCaminhoes[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCaminhoes[source] = createVehicle( CaminhoesID, CaminhoesRX, CaminhoesRY, CaminhoesRZ )
setElementRotation ( AutoEscolaCaminhoes[source], CaminhoesRotA, CaminhoesRotB, CaminhoesRotC )
setVehicleLocked ( AutoEscolaCaminhoes[source], true )
warpPedIntoVehicle ( source, AutoEscolaCaminhoes[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCaminhoes00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCaminhoes01, source, true )
setElementVisibleTo ( BlipCaminhoes01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes03, "warning")
end
end
addEvent("Hab:Caminhao", true)
addEventHandler ( "Hab:Caminhao", root, CaminhoesHab)

function emarkerCaminhoes(marker,md) 
    if (md) then
      if AutoEscolaCaminhoes[source] and isElement( AutoEscolaCaminhoes[source] ) then
        if marker == MarkerCaminhoes01 then
        if getElementData( source, "Carteira:StartCaminhoes00", true ) then
        setElementVisibleTo ( MarkerCaminhoes01, source, false )
        setElementVisibleTo ( BlipCaminhoes01, source, false )
        setElementVisibleTo ( MarkerCaminhoes02, source, true )
        setElementVisibleTo ( BlipCaminhoes02, source, true )
        setElementData ( source, "Carteira:StartCaminhoes01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes02 then
        if getElementData( source, "Carteira:StartCaminhoes01", true ) then
        setElementVisibleTo ( MarkerCaminhoes02, source, false )
        setElementVisibleTo ( BlipCaminhoes02, source, false )
        setElementVisibleTo ( MarkerCaminhoes03, source, true )
        setElementVisibleTo ( BlipCaminhoes03, source, true )
        setElementData ( source, "Carteira:StartCaminhoes02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes03 then
        if getElementData( source, "Carteira:StartCaminhoes02", true ) then
        setElementVisibleTo ( MarkerCaminhoes03, source, false )
        setElementVisibleTo ( BlipCaminhoes03, source, false )
        setElementVisibleTo ( MarkerCaminhoes04, source, true )
        setElementVisibleTo ( BlipCaminhoes04, source, true )
        setElementData ( source, "Carteira:StartCaminhoes03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes04 then
        if getElementData( source, "Carteira:StartCaminhoes03", true ) then
        setElementVisibleTo ( MarkerCaminhoes04, source, false )
        setElementVisibleTo ( BlipCaminhoes04, source, false )
        setElementVisibleTo ( MarkerCaminhoes05, source, true )
        setElementVisibleTo ( BlipCaminhoes05, source, true )
        setElementData ( source, "Carteira:StartCaminhoes04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes05 then
        if getElementData( source, "Carteira:StartCaminhoes04", true ) then
        setElementVisibleTo ( MarkerCaminhoes05, source, false )
        setElementVisibleTo ( BlipCaminhoes05, source, false )
        setElementVisibleTo ( MarkerCaminhoes06, source, true )
        setElementVisibleTo ( BlipCaminhoes06, source, true )
        setElementData ( source, "Carteira:StartCaminhoes05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes06 then
        if getElementData( source, "Carteira:StartCaminhoes05", true ) then
        setElementVisibleTo ( MarkerCaminhoes06, source, false )
        setElementVisibleTo ( BlipCaminhoes06, source, false )
        setElementVisibleTo ( MarkerCaminhoes07, source, true )
        setElementVisibleTo ( BlipCaminhoes07, source, true )
        setElementData ( source, "Carteira:StartCaminhoes06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes07 then
        if getElementData( source, "Carteira:StartCaminhoes06", true ) then
        setElementVisibleTo ( MarkerCaminhoes07, source, false )
        setElementVisibleTo ( BlipCaminhoes07, source, false )
        setElementVisibleTo ( MarkerCaminhoes08, source, true )
        setElementVisibleTo ( BlipCaminhoes08, source, true )
        setElementData ( source, "Carteira:StartCaminhoes07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes08 then
        if getElementData( source, "Carteira:StartCaminhoes07", true ) then
        setElementVisibleTo ( MarkerCaminhoes08, source, false )
        setElementVisibleTo ( BlipCaminhoes08, source, false )
        setElementVisibleTo ( MarkerCaminhoes09, source, true )
        setElementVisibleTo ( BlipCaminhoes09, source, true )
        setElementData ( source, "Carteira:StartCaminhoes08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes09 then
        if getElementData( source, "Carteira:StartCaminhoes08", true ) then
        setElementVisibleTo ( MarkerCaminhoes09, source, false )
        setElementVisibleTo ( BlipCaminhoes09, source, false )
        setElementVisibleTo ( MarkerCaminhoes10, source, true )
        setElementVisibleTo ( BlipCaminhoes10, source, true )
        setElementData ( source, "Carteira:StartCaminhoes09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes10 then
        if getElementData( source, "Carteira:StartCaminhoes09", true ) then
        setElementVisibleTo ( MarkerCaminhoes10, source, false )
        setElementVisibleTo ( BlipCaminhoes10, source, false )
        setElementVisibleTo ( MarkerCaminhoes11, source, true )
        setElementVisibleTo ( BlipCaminhoes11, source, true )
        setElementData ( source, "Carteira:StartCaminhoes10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes11 then
        if getElementData( source, "Carteira:StartCaminhoes10", true ) then
        setElementVisibleTo ( MarkerCaminhoes11, source, false )
        setElementVisibleTo ( BlipCaminhoes11, source, false )
        setElementVisibleTo ( MarkerCaminhoes12, source, true )
        setElementVisibleTo ( BlipCaminhoes12, source, true )
        setElementData ( source, "Carteira:StartCaminhoes11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes12 then
        if getElementData( source, "Carteira:StartCaminhoes11", true ) then
        setElementVisibleTo ( MarkerCaminhoes12, source, false )
        setElementVisibleTo ( BlipCaminhoes12, source, false )
        setElementVisibleTo ( MarkerCaminhoes13, source, true )
        setElementVisibleTo ( BlipCaminhoes13, source, true )
        setElementData ( source, "Carteira:StartCaminhoes12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes13 then
        if getElementData( source, "Carteira:StartCaminhoes12", true ) then
        setElementVisibleTo ( MarkerCaminhoes13, source, false )
        setElementVisibleTo ( BlipCaminhoes13, source, false )
        setElementVisibleTo ( MarkerCaminhoes14, source, true )
        setElementVisibleTo ( BlipCaminhoes14, source, true )
        setElementData ( source, "Carteira:StartCaminhoes13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes14 then
        if getElementData( source, "Carteira:StartCaminhoes13", true ) then
        setElementVisibleTo ( MarkerCaminhoes14, source, false )
        setElementVisibleTo ( BlipCaminhoes14, source, false )
        setElementVisibleTo ( MarkerCaminhoes15, source, true )
        setElementVisibleTo ( BlipCaminhoes15, source, true )
        setElementData ( source, "Carteira:StartCaminhoes14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes15 then
        if getElementData( source, "Carteira:StartCaminhoes14", true ) then
        setElementVisibleTo ( MarkerCaminhoes15, source, false )
        setElementVisibleTo ( BlipCaminhoes15, source, false )
        setElementVisibleTo ( MarkerCaminhoes16, source, true )
        setElementVisibleTo ( BlipCaminhoes16, source, true )
        setElementData ( source, "Carteira:StartCaminhoes15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes16 then
        if getElementData( source, "Carteira:StartCaminhoes15", true ) then
        AutoEscolaCaminhoesVida = getElementHealth ( AutoEscolaCaminhoes[source] )
        if AutoEscolaCaminhoesVida <= CaminhoesDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes04, "error")
        else
        setElementData( source, "Habilitacoes:Caminhoes", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes15", false )
        setElementVisibleTo ( MarkerCaminhoes16, source, false )
        setElementVisibleTo ( BlipCaminhoes16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaCaminhoes[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCaminhoes)

function SairDoVeiculoAutoEscolaCaminhoes (source)
if ( AutoEscolaCaminhoes[source] ) and isElement( AutoEscolaCaminhoes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCaminhoes[source] )
setElementData ( source, "Carteira:StartCaminhoes00", false )
setElementData ( source, "Carteira:StartCaminhoes01", false )
setElementData ( source, "Carteira:StartCaminhoes02", false )
setElementData ( source, "Carteira:StartCaminhoes03", false )
setElementData ( source, "Carteira:StartCaminhoes04", false )
setElementData ( source, "Carteira:StartCaminhoes05", false )
setElementData ( source, "Carteira:StartCaminhoes06", false )
setElementData ( source, "Carteira:StartCaminhoes07", false )
setElementData ( source, "Carteira:StartCaminhoes08", false )
setElementData ( source, "Carteira:StartCaminhoes09", false )
setElementData ( source, "Carteira:StartCaminhoes10", false )
setElementData ( source, "Carteira:StartCaminhoes11", false )
setElementData ( source, "Carteira:StartCaminhoes12", false )
setElementData ( source, "Carteira:StartCaminhoes13", false )
setElementData ( source, "Carteira:StartCaminhoes14", false )
setElementData ( source, "Carteira:StartCaminhoes15", false )
setElementVisibleTo ( MarkerCaminhoes01, source, false )
setElementVisibleTo ( BlipCaminhoes01, source, false )
setElementVisibleTo ( MarkerCaminhoes02, source, false )
setElementVisibleTo ( BlipCaminhoes02, source, false )
setElementVisibleTo ( MarkerCaminhoes03, source, false )
setElementVisibleTo ( BlipCaminhoes03, source, false )
setElementVisibleTo ( MarkerCaminhoes04, source, false )
setElementVisibleTo ( BlipCaminhoes04, source, false )
setElementVisibleTo ( MarkerCaminhoes05, source, false )
setElementVisibleTo ( BlipCaminhoes05, source, false )
setElementVisibleTo ( MarkerCaminhoes06, source, false )
setElementVisibleTo ( BlipCaminhoes06, source, false )
setElementVisibleTo ( MarkerCaminhoes07, source, false )
setElementVisibleTo ( BlipCaminhoes07, source, false )
setElementVisibleTo ( MarkerCaminhoes08, source, false )
setElementVisibleTo ( BlipCaminhoes08, source, false )
setElementVisibleTo ( MarkerCaminhoes09, source, false )
setElementVisibleTo ( BlipCaminhoes09, source, false )
setElementVisibleTo ( MarkerCaminhoes10, source, false )
setElementVisibleTo ( BlipCaminhoes10, source, false )
setElementVisibleTo ( MarkerCaminhoes11, source, false )
setElementVisibleTo ( BlipCaminhoes11, source, false )
setElementVisibleTo ( MarkerCaminhoes12, source, false )
setElementVisibleTo ( BlipCaminhoes12, source, false )
setElementVisibleTo ( MarkerCaminhoes13, source, false )
setElementVisibleTo ( BlipCaminhoes13, source, false )
setElementVisibleTo ( MarkerCaminhoes14, source, false )
setElementVisibleTo ( BlipCaminhoes14, source, false )
setElementVisibleTo ( MarkerCaminhoes15, source, false )
setElementVisibleTo ( BlipCaminhoes15, source, false )
setElementVisibleTo ( MarkerCaminhoes16, source, false )
setElementVisibleTo ( BlipCaminhoes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCaminhoes )

function MorrerAutoEscolaCaminhoes ()
if ( AutoEscolaCaminhoes[source] ) and isElement( AutoEscolaCaminhoes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCaminhoes[source] )
setElementData ( source, "Carteira:StartCaminhoes00", false )
setElementData ( source, "Carteira:StartCaminhoes01", false )
setElementData ( source, "Carteira:StartCaminhoes02", false )
setElementData ( source, "Carteira:StartCaminhoes03", false )
setElementData ( source, "Carteira:StartCaminhoes04", false )
setElementData ( source, "Carteira:StartCaminhoes05", false )
setElementData ( source, "Carteira:StartCaminhoes06", false )
setElementData ( source, "Carteira:StartCaminhoes07", false )
setElementData ( source, "Carteira:StartCaminhoes08", false )
setElementData ( source, "Carteira:StartCaminhoes09", false )
setElementData ( source, "Carteira:StartCaminhoes10", false )
setElementData ( source, "Carteira:StartCaminhoes11", false )
setElementData ( source, "Carteira:StartCaminhoes12", false )
setElementData ( source, "Carteira:StartCaminhoes13", false )
setElementData ( source, "Carteira:StartCaminhoes14", false )
setElementData ( source, "Carteira:StartCaminhoes15", false )
setElementVisibleTo ( MarkerCaminhoes01, source, false )
setElementVisibleTo ( BlipCaminhoes01, source, false )
setElementVisibleTo ( MarkerCaminhoes02, source, false )
setElementVisibleTo ( BlipCaminhoes02, source, false )
setElementVisibleTo ( MarkerCaminhoes03, source, false )
setElementVisibleTo ( BlipCaminhoes03, source, false )
setElementVisibleTo ( MarkerCaminhoes04, source, false )
setElementVisibleTo ( BlipCaminhoes04, source, false )
setElementVisibleTo ( MarkerCaminhoes05, source, false )
setElementVisibleTo ( BlipCaminhoes05, source, false )
setElementVisibleTo ( MarkerCaminhoes06, source, false )
setElementVisibleTo ( BlipCaminhoes06, source, false )
setElementVisibleTo ( MarkerCaminhoes07, source, false )
setElementVisibleTo ( BlipCaminhoes07, source, false )
setElementVisibleTo ( MarkerCaminhoes08, source, false )
setElementVisibleTo ( BlipCaminhoes08, source, false )
setElementVisibleTo ( MarkerCaminhoes09, source, false )
setElementVisibleTo ( BlipCaminhoes09, source, false )
setElementVisibleTo ( MarkerCaminhoes10, source, false )
setElementVisibleTo ( BlipCaminhoes10, source, false )
setElementVisibleTo ( MarkerCaminhoes11, source, false )
setElementVisibleTo ( BlipCaminhoes11, source, false )
setElementVisibleTo ( MarkerCaminhoes12, source, false )
setElementVisibleTo ( BlipCaminhoes12, source, false )
setElementVisibleTo ( MarkerCaminhoes13, source, false )
setElementVisibleTo ( BlipCaminhoes13, source, false )
setElementVisibleTo ( MarkerCaminhoes14, source, false )
setElementVisibleTo ( BlipCaminhoes14, source, false )
setElementVisibleTo ( MarkerCaminhoes15, source, false )
setElementVisibleTo ( BlipCaminhoes15, source, false )
setElementVisibleTo ( MarkerCaminhoes16, source, false )
setElementVisibleTo ( BlipCaminhoes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCaminhoes )

function SairDoServidorAutoEscolaCaminhoes ( quitType )    
if isElement( AutoEscolaCaminhoes[source] ) then
destroyElement ( AutoEscolaCaminhoes[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCaminhoes )

-- ( Final ) Percurso de Caminhoes

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Onibus

OnibusRX, OnibusRY, OnibusRZ       = 2131.74976, 2728.53027, 10.82031 -- Coordenadas de Respawn do Onibus
OnibusRotA, OnibusRotB, OnibusRotC = 0, 0, 0 -- Rotação do Veiculo ao Spawnar
OnibusID                           = 437 -- ID do Onibus
HabValorOnibus                     = 1400 -- Valor da Habilitação Categoria "Onibus"
OnibusDanoParaReprovar             = 950 -- 95%

MsgOnibus01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgOnibus02 = "Você Não Tem Dinheiro Suficiente!"
MsgOnibus03 = "Você Ja Possui Essa Habilitação!"
MsgOnibus04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgOnibus05 = "Carteira de Habilitação Categoria 'Ônibus' Concedida!"
MsgOnibus06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgOnibus07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

OnibusX01, OnibusY01, OnibusZ01 = 2127.71118, 2755.46826, 10.85947
OnibusX02, OnibusY02, OnibusZ02 = 2091.51147, 2774.08960, 10.70245
OnibusX03, OnibusY03, OnibusZ03 = 2085.05054, 2660.39233, 10.70181
OnibusX04, OnibusY04, OnibusZ04 = 2025.16162, 2602.87573, 11.88449
OnibusX05, OnibusY05, OnibusZ05 = 2025.23767, 2518.30054, 12.31421
OnibusX06, OnibusY06, OnibusZ06 = 2025.44836, 2420.84473, 10.72500
OnibusX07, OnibusY07, OnibusZ07 = 2043.32520, 2334.30859, 10.71358
OnibusX08, OnibusY08, OnibusZ08 = 2121.86963, 2249.28174, 10.70663
OnibusX09, OnibusY09, OnibusZ09 = 2125.64185, 2072.61621, 10.70400
OnibusX10, OnibusY10, OnibusZ10 = 2125.50269, 1963.75562, 10.71333
OnibusX11, OnibusY11, OnibusZ11 = 2119.42822, 1850.72949, 10.70842
OnibusX12, OnibusY12, OnibusZ12 = 2059.43579, 1730.45862, 10.69846
OnibusX13, OnibusY13, OnibusZ13 = 2045.76147, 1581.07239, 10.70090
OnibusX14, OnibusY14, OnibusZ14 = 2104.10229, 1531.17041, 10.70718
OnibusX15, OnibusY15, OnibusZ15 = 2215.26343, 1530.97510, 10.72500
OnibusX16, OnibusY16, OnibusZ16 = 2307.06714, 1516.97119, 10.84756

MarkerOnibus01 = createMarker ( OnibusX01, OnibusY01, OnibusZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus01 = createBlipAttachedTo ( MarkerOnibus01, 0 )
setElementVisibleTo ( MarkerOnibus01, root, false )
setElementVisibleTo ( BlipOnibus01, root, false )

MarkerOnibus02 = createMarker ( OnibusX02, OnibusY02, OnibusZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus02 = createBlipAttachedTo ( MarkerOnibus02, 0 )
setElementVisibleTo ( MarkerOnibus02, root, false )
setElementVisibleTo ( BlipOnibus02, root, false )

MarkerOnibus03 = createMarker ( OnibusX03, OnibusY03, OnibusZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus03 = createBlipAttachedTo ( MarkerOnibus03, 0 )
setElementVisibleTo ( MarkerOnibus03, root, false )
setElementVisibleTo ( BlipOnibus03, root, false )

MarkerOnibus04 = createMarker ( OnibusX04, OnibusY04, OnibusZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus04 = createBlipAttachedTo ( MarkerOnibus04, 0 )
setElementVisibleTo ( MarkerOnibus04, root, false )
setElementVisibleTo ( BlipOnibus04, root, false )

MarkerOnibus05 = createMarker ( OnibusX05, OnibusY05, OnibusZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus05 = createBlipAttachedTo ( MarkerOnibus05, 0 )
setElementVisibleTo ( MarkerOnibus05, root, false )
setElementVisibleTo ( BlipOnibus05, root, false )

MarkerOnibus06 = createMarker ( OnibusX06, OnibusY06, OnibusZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus06 = createBlipAttachedTo ( MarkerOnibus06, 0 )
setElementVisibleTo ( MarkerOnibus06, root, false )
setElementVisibleTo ( BlipOnibus06, root, false )

MarkerOnibus07 = createMarker ( OnibusX07, OnibusY07, OnibusZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus07 = createBlipAttachedTo ( MarkerOnibus07, 0 )
setElementVisibleTo ( MarkerOnibus07, root, false )
setElementVisibleTo ( BlipOnibus07, root, false )

MarkerOnibus08 = createMarker ( OnibusX08, OnibusY08, OnibusZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus08 = createBlipAttachedTo ( MarkerOnibus08, 0 )
setElementVisibleTo ( MarkerOnibus08, root, false )
setElementVisibleTo ( BlipOnibus08, root, false )

MarkerOnibus09 = createMarker ( OnibusX09, OnibusY09, OnibusZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus09 = createBlipAttachedTo ( MarkerOnibus09, 0 )
setElementVisibleTo ( MarkerOnibus09, root, false )
setElementVisibleTo ( BlipOnibus09, root, false )

MarkerOnibus10 = createMarker ( OnibusX10, OnibusY10, OnibusZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus10 = createBlipAttachedTo ( MarkerOnibus10, 0 )
setElementVisibleTo ( MarkerOnibus10, root, false )
setElementVisibleTo ( BlipOnibus10, root, false )

MarkerOnibus11 = createMarker ( OnibusX11, OnibusY11, OnibusZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus11 = createBlipAttachedTo ( MarkerOnibus11, 0 )
setElementVisibleTo ( MarkerOnibus11, root, false )
setElementVisibleTo ( BlipOnibus11, root, false )

MarkerOnibus12 = createMarker ( OnibusX12, OnibusY12, OnibusZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus12 = createBlipAttachedTo ( MarkerOnibus12, 0 )
setElementVisibleTo ( MarkerOnibus12, root, false )
setElementVisibleTo ( BlipOnibus12, root, false )

MarkerOnibus13 = createMarker ( OnibusX13, OnibusY13, OnibusZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus13 = createBlipAttachedTo ( MarkerOnibus13, 0 )
setElementVisibleTo ( MarkerOnibus13, root, false )
setElementVisibleTo ( BlipOnibus13, root, false )

MarkerOnibus14 = createMarker ( OnibusX14, OnibusY14, OnibusZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus14 = createBlipAttachedTo ( MarkerOnibus14, 0 )
setElementVisibleTo ( MarkerOnibus14, root, false )
setElementVisibleTo ( BlipOnibus14, root, false )

MarkerOnibus15 = createMarker ( OnibusX15, OnibusY15, OnibusZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus15 = createBlipAttachedTo ( MarkerOnibus15, 0 )
setElementVisibleTo ( MarkerOnibus15, root, false )
setElementVisibleTo ( BlipOnibus15, root, false )

MarkerOnibus16 = createMarker ( OnibusX16, OnibusY16, OnibusZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus16 = createBlipAttachedTo ( MarkerOnibus16, 0 )
setElementVisibleTo ( MarkerOnibus16, root, false )
setElementVisibleTo ( BlipOnibus16, root, false )

AutoEscolaOnibus = {}

function OnibusHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Onibus" ) == true then
if getPlayerMoney(source) >= HabValorOnibus then
takePlayerMoney(source, HabValorOnibus)
if AutoEscolaOnibus[source] and isElement( AutoEscolaOnibus[source] ) then destroyElement ( AutoEscolaOnibus[source] )
AutoEscolaOnibus[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaOnibus[source] = createVehicle( OnibusID, OnibusRX, OnibusRY, OnibusRZ )
setElementRotation ( AutoEscolaOnibus[source], OnibusRotA, OnibusRotB, OnibusRotC )
setVehicleLocked ( AutoEscolaOnibus[source], true )
warpPedIntoVehicle ( source, AutoEscolaOnibus[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartOnibus00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerOnibus01, source, true )
setElementVisibleTo ( BlipOnibus01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus03, "warning")
end
end
addEvent("Hab:Onibus", true)
addEventHandler ( "Hab:Onibus", root, OnibusHab)

function emarkerOnibus(marker,md) 
    if (md) then
      if AutoEscolaOnibus[source] and isElement( AutoEscolaOnibus[source] ) then
        if marker == MarkerOnibus01 then
        if getElementData( source, "Carteira:StartOnibus00", true ) then
        setElementVisibleTo ( MarkerOnibus01, source, false )
        setElementVisibleTo ( BlipOnibus01, source, false )
        setElementVisibleTo ( MarkerOnibus02, source, true )
        setElementVisibleTo ( BlipOnibus02, source, true )
        setElementData ( source, "Carteira:StartOnibus01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus02 then
        if getElementData( source, "Carteira:StartOnibus01", true ) then
        setElementVisibleTo ( MarkerOnibus02, source, false )
        setElementVisibleTo ( BlipOnibus02, source, false )
        setElementVisibleTo ( MarkerOnibus03, source, true )
        setElementVisibleTo ( BlipOnibus03, source, true )
        setElementData ( source, "Carteira:StartOnibus02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus03 then
        if getElementData( source, "Carteira:StartOnibus02", true ) then
        setElementVisibleTo ( MarkerOnibus03, source, false )
        setElementVisibleTo ( BlipOnibus03, source, false )
        setElementVisibleTo ( MarkerOnibus04, source, true )
        setElementVisibleTo ( BlipOnibus04, source, true )
        setElementData ( source, "Carteira:StartOnibus03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus04 then
        if getElementData( source, "Carteira:StartOnibus03", true ) then
        setElementVisibleTo ( MarkerOnibus04, source, false )
        setElementVisibleTo ( BlipOnibus04, source, false )
        setElementVisibleTo ( MarkerOnibus05, source, true )
        setElementVisibleTo ( BlipOnibus05, source, true )
        setElementData ( source, "Carteira:StartOnibus04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus05 then
        if getElementData( source, "Carteira:StartOnibus04", true ) then
        setElementVisibleTo ( MarkerOnibus05, source, false )
        setElementVisibleTo ( BlipOnibus05, source, false )
        setElementVisibleTo ( MarkerOnibus06, source, true )
        setElementVisibleTo ( BlipOnibus06, source, true )
        setElementData ( source, "Carteira:StartOnibus05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus06 then
        if getElementData( source, "Carteira:StartOnibus05", true ) then
        setElementVisibleTo ( MarkerOnibus06, source, false )
        setElementVisibleTo ( BlipOnibus06, source, false )
        setElementVisibleTo ( MarkerOnibus07, source, true )
        setElementVisibleTo ( BlipOnibus07, source, true )
        setElementData ( source, "Carteira:StartOnibus06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus07 then
        if getElementData( source, "Carteira:StartOnibus06", true ) then
        setElementVisibleTo ( MarkerOnibus07, source, false )
        setElementVisibleTo ( BlipOnibus07, source, false )
        setElementVisibleTo ( MarkerOnibus08, source, true )
        setElementVisibleTo ( BlipOnibus08, source, true )
        setElementData ( source, "Carteira:StartOnibus07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus08 then
        if getElementData( source, "Carteira:StartOnibus07", true ) then
        setElementVisibleTo ( MarkerOnibus08, source, false )
        setElementVisibleTo ( BlipOnibus08, source, false )
        setElementVisibleTo ( MarkerOnibus09, source, true )
        setElementVisibleTo ( BlipOnibus09, source, true )
        setElementData ( source, "Carteira:StartOnibus08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus09 then
        if getElementData( source, "Carteira:StartOnibus08", true ) then
        setElementVisibleTo ( MarkerOnibus09, source, false )
        setElementVisibleTo ( BlipOnibus09, source, false )
        setElementVisibleTo ( MarkerOnibus10, source, true )
        setElementVisibleTo ( BlipOnibus10, source, true )
        setElementData ( source, "Carteira:StartOnibus09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus10 then
        if getElementData( source, "Carteira:StartOnibus09", true ) then
        setElementVisibleTo ( MarkerOnibus10, source, false )
        setElementVisibleTo ( BlipOnibus10, source, false )
        setElementVisibleTo ( MarkerOnibus11, source, true )
        setElementVisibleTo ( BlipOnibus11, source, true )
        setElementData ( source, "Carteira:StartOnibus10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus11 then
        if getElementData( source, "Carteira:StartOnibus10", true ) then
        setElementVisibleTo ( MarkerOnibus11, source, false )
        setElementVisibleTo ( BlipOnibus11, source, false )
        setElementVisibleTo ( MarkerOnibus12, source, true )
        setElementVisibleTo ( BlipOnibus12, source, true )
        setElementData ( source, "Carteira:StartOnibus11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus12 then
        if getElementData( source, "Carteira:StartOnibus11", true ) then
        setElementVisibleTo ( MarkerOnibus12, source, false )
        setElementVisibleTo ( BlipOnibus12, source, false )
        setElementVisibleTo ( MarkerOnibus13, source, true )
        setElementVisibleTo ( BlipOnibus13, source, true )
        setElementData ( source, "Carteira:StartOnibus12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus13 then
        if getElementData( source, "Carteira:StartOnibus12", true ) then
        setElementVisibleTo ( MarkerOnibus13, source, false )
        setElementVisibleTo ( BlipOnibus13, source, false )
        setElementVisibleTo ( MarkerOnibus14, source, true )
        setElementVisibleTo ( BlipOnibus14, source, true )
        setElementData ( source, "Carteira:StartOnibus13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus14 then
        if getElementData( source, "Carteira:StartOnibus13", true ) then
        setElementVisibleTo ( MarkerOnibus14, source, false )
        setElementVisibleTo ( BlipOnibus14, source, false )
        setElementVisibleTo ( MarkerOnibus15, source, true )
        setElementVisibleTo ( BlipOnibus15, source, true )
        setElementData ( source, "Carteira:StartOnibus14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus15 then
        if getElementData( source, "Carteira:StartOnibus14", true ) then
        setElementVisibleTo ( MarkerOnibus15, source, false )
        setElementVisibleTo ( BlipOnibus15, source, false )
        setElementVisibleTo ( MarkerOnibus16, source, true )
        setElementVisibleTo ( BlipOnibus16, source, true )
        setElementData ( source, "Carteira:StartOnibus15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus16 then
        if getElementData( source, "Carteira:StartOnibus15", true ) then
        AutoEscolaOnibusVida = getElementHealth ( AutoEscolaOnibus[source] )
        if AutoEscolaOnibusVida <= OnibusDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgOnibus04, "error")
        else
        setElementData( source, "Habilitacoes:Onibus", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgOnibus05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus15", false )
        setElementVisibleTo ( MarkerOnibus16, source, false )
        setElementVisibleTo ( BlipOnibus16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaOnibus[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerOnibus)

function SairDoVeiculoAutoEscolaOnibus (source)
if ( AutoEscolaOnibus[source] ) and isElement( AutoEscolaOnibus[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaOnibus[source] )
setElementData ( source, "Carteira:StartOnibus00", false )
setElementData ( source, "Carteira:StartOnibus01", false )
setElementData ( source, "Carteira:StartOnibus02", false )
setElementData ( source, "Carteira:StartOnibus03", false )
setElementData ( source, "Carteira:StartOnibus04", false )
setElementData ( source, "Carteira:StartOnibus05", false )
setElementData ( source, "Carteira:StartOnibus06", false )
setElementData ( source, "Carteira:StartOnibus07", false )
setElementData ( source, "Carteira:StartOnibus08", false )
setElementData ( source, "Carteira:StartOnibus09", false )
setElementData ( source, "Carteira:StartOnibus10", false )
setElementData ( source, "Carteira:StartOnibus11", false )
setElementData ( source, "Carteira:StartOnibus12", false )
setElementData ( source, "Carteira:StartOnibus13", false )
setElementData ( source, "Carteira:StartOnibus14", false )
setElementData ( source, "Carteira:StartOnibus15", false )
setElementVisibleTo ( MarkerOnibus01, source, false )
setElementVisibleTo ( BlipOnibus01, source, false )
setElementVisibleTo ( MarkerOnibus02, source, false )
setElementVisibleTo ( BlipOnibus02, source, false )
setElementVisibleTo ( MarkerOnibus03, source, false )
setElementVisibleTo ( BlipOnibus03, source, false )
setElementVisibleTo ( MarkerOnibus04, source, false )
setElementVisibleTo ( BlipOnibus04, source, false )
setElementVisibleTo ( MarkerOnibus05, source, false )
setElementVisibleTo ( BlipOnibus05, source, false )
setElementVisibleTo ( MarkerOnibus06, source, false )
setElementVisibleTo ( BlipOnibus06, source, false )
setElementVisibleTo ( MarkerOnibus07, source, false )
setElementVisibleTo ( BlipOnibus07, source, false )
setElementVisibleTo ( MarkerOnibus08, source, false )
setElementVisibleTo ( BlipOnibus08, source, false )
setElementVisibleTo ( MarkerOnibus09, source, false )
setElementVisibleTo ( BlipOnibus09, source, false )
setElementVisibleTo ( MarkerOnibus10, source, false )
setElementVisibleTo ( BlipOnibus10, source, false )
setElementVisibleTo ( MarkerOnibus11, source, false )
setElementVisibleTo ( BlipOnibus11, source, false )
setElementVisibleTo ( MarkerOnibus12, source, false )
setElementVisibleTo ( BlipOnibus12, source, false )
setElementVisibleTo ( MarkerOnibus13, source, false )
setElementVisibleTo ( BlipOnibus13, source, false )
setElementVisibleTo ( MarkerOnibus14, source, false )
setElementVisibleTo ( BlipOnibus14, source, false )
setElementVisibleTo ( MarkerOnibus15, source, false )
setElementVisibleTo ( BlipOnibus15, source, false )
setElementVisibleTo ( MarkerOnibus16, source, false )
setElementVisibleTo ( BlipOnibus16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaOnibus )

function MorrerAutoEscolaOnibus ()
if ( AutoEscolaOnibus[source] ) and isElement( AutoEscolaOnibus[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaOnibus[source] )
setElementData ( source, "Carteira:StartOnibus00", false )
setElementData ( source, "Carteira:StartOnibus01", false )
setElementData ( source, "Carteira:StartOnibus02", false )
setElementData ( source, "Carteira:StartOnibus03", false )
setElementData ( source, "Carteira:StartOnibus04", false )
setElementData ( source, "Carteira:StartOnibus05", false )
setElementData ( source, "Carteira:StartOnibus06", false )
setElementData ( source, "Carteira:StartOnibus07", false )
setElementData ( source, "Carteira:StartOnibus08", false )
setElementData ( source, "Carteira:StartOnibus09", false )
setElementData ( source, "Carteira:StartOnibus10", false )
setElementData ( source, "Carteira:StartOnibus11", false )
setElementData ( source, "Carteira:StartOnibus12", false )
setElementData ( source, "Carteira:StartOnibus13", false )
setElementData ( source, "Carteira:StartOnibus14", false )
setElementData ( source, "Carteira:StartOnibus15", false )
setElementVisibleTo ( MarkerOnibus01, source, false )
setElementVisibleTo ( BlipOnibus01, source, false )
setElementVisibleTo ( MarkerOnibus02, source, false )
setElementVisibleTo ( BlipOnibus02, source, false )
setElementVisibleTo ( MarkerOnibus03, source, false )
setElementVisibleTo ( BlipOnibus03, source, false )
setElementVisibleTo ( MarkerOnibus04, source, false )
setElementVisibleTo ( BlipOnibus04, source, false )
setElementVisibleTo ( MarkerOnibus05, source, false )
setElementVisibleTo ( BlipOnibus05, source, false )
setElementVisibleTo ( MarkerOnibus06, source, false )
setElementVisibleTo ( BlipOnibus06, source, false )
setElementVisibleTo ( MarkerOnibus07, source, false )
setElementVisibleTo ( BlipOnibus07, source, false )
setElementVisibleTo ( MarkerOnibus08, source, false )
setElementVisibleTo ( BlipOnibus08, source, false )
setElementVisibleTo ( MarkerOnibus09, source, false )
setElementVisibleTo ( BlipOnibus09, source, false )
setElementVisibleTo ( MarkerOnibus10, source, false )
setElementVisibleTo ( BlipOnibus10, source, false )
setElementVisibleTo ( MarkerOnibus11, source, false )
setElementVisibleTo ( BlipOnibus11, source, false )
setElementVisibleTo ( MarkerOnibus12, source, false )
setElementVisibleTo ( BlipOnibus12, source, false )
setElementVisibleTo ( MarkerOnibus13, source, false )
setElementVisibleTo ( BlipOnibus13, source, false )
setElementVisibleTo ( MarkerOnibus14, source, false )
setElementVisibleTo ( BlipOnibus14, source, false )
setElementVisibleTo ( MarkerOnibus15, source, false )
setElementVisibleTo ( BlipOnibus15, source, false )
setElementVisibleTo ( MarkerOnibus16, source, false )
setElementVisibleTo ( BlipOnibus16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaOnibus )

function SairDoServidorAutoEscolaOnibus ( quitType )    
if isElement( AutoEscolaOnibus[source] ) then
destroyElement ( AutoEscolaOnibus[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaOnibus )

-- ( Final ) Percurso de Onibus

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Carretas

CarretasRX, CarretasRY, CarretasRZ       = -1291.52820, 2710.38794, 51 -- Coordenadas de Respawn do Carreta
CarretasRotA, CarretasRotB, CarretasRotC = 0, 0, 182.73559570312 -- Rotação do Veiculo ao Spawnar
CarretasID                               = 403 -- ID do Carreta
HabValorCarretas                         = 1600 -- Valor da Habilitação Categoria "Carretas"
CarretasDanoParaReprovar                 = 950 -- 95%

MsgCarretas01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCarretas02 = "Você Não Tem Dinheiro Suficiente!"
MsgCarretas03 = "Você Ja Possui Essa Habilitação!"
MsgCarretas04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCarretas05 = "Carteira de Habilitação Categoria 'Carretas' Concedida!"
MsgCarretas06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCarretas07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CarretasX01, CarretasY01, CarretasZ01 = -1292.75232, 2661.98853, 49.58909
CarretasX02, CarretasY02, CarretasZ02 = -1371.68579, 2678.74536, 52.65607
CarretasX03, CarretasY03, CarretasZ03 = -1480.98108, 2733.20776, 65.90062
CarretasX04, CarretasY04, CarretasZ04 = -1643.80920, 2726.40698, 58.57969
CarretasX05, CarretasY05, CarretasZ05 = -1747.70764, 2729.60181, 59.95318
CarretasX06, CarretasY06, CarretasZ06 = -1849.49866, 2617.99048, 50.53489
CarretasX07, CarretasY07, CarretasZ07 = -1910.04419, 2512.77075, 44.94999
CarretasX08, CarretasY08, CarretasZ08 = -2002.78674, 2440.17944, 35.19661
CarretasX09, CarretasY09, CarretasZ09 = -1986.44226, 2352.16357, 28.50075
CarretasX10, CarretasY10, CarretasZ10 = -1960.02039, 2224.11255, 11.43757
CarretasX11, CarretasY11, CarretasZ11 = -1860.70874, 2192.22119, 5.79754
CarretasX12, CarretasY12, CarretasZ12 = -1821.54529, 2123.84326, 8.04688
CarretasX13, CarretasY13, CarretasZ13 = -1801.09155, 1990.08398, 13.05490
CarretasX14, CarretasY14, CarretasZ14 = -1736.97876, 1820.46912, 23.67095
CarretasX15, CarretasY15, CarretasZ15 = -1574.65247, 1835.91235, 26.51335
CarretasX16, CarretasY16, CarretasZ16 = -1486.08936, 1877.73352, 32.66355

MarkerCarretas01 = createMarker ( CarretasX01, CarretasY01, CarretasZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas01 = createBlipAttachedTo ( MarkerCarretas01, 0 )
setElementVisibleTo ( MarkerCarretas01, root, false )
setElementVisibleTo ( BlipCarretas01, root, false )

MarkerCarretas02 = createMarker ( CarretasX02, CarretasY02, CarretasZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas02 = createBlipAttachedTo ( MarkerCarretas02, 0 )
setElementVisibleTo ( MarkerCarretas02, root, false )
setElementVisibleTo ( BlipCarretas02, root, false )

MarkerCarretas03 = createMarker ( CarretasX03, CarretasY03, CarretasZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas03 = createBlipAttachedTo ( MarkerCarretas03, 0 )
setElementVisibleTo ( MarkerCarretas03, root, false )
setElementVisibleTo ( BlipCarretas03, root, false )

MarkerCarretas04 = createMarker ( CarretasX04, CarretasY04, CarretasZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas04 = createBlipAttachedTo ( MarkerCarretas04, 0 )
setElementVisibleTo ( MarkerCarretas04, root, false )
setElementVisibleTo ( BlipCarretas04, root, false )

MarkerCarretas05 = createMarker ( CarretasX05, CarretasY05, CarretasZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas05 = createBlipAttachedTo ( MarkerCarretas05, 0 )
setElementVisibleTo ( MarkerCarretas05, root, false )
setElementVisibleTo ( BlipCarretas05, root, false )

MarkerCarretas06 = createMarker ( CarretasX06, CarretasY06, CarretasZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas06 = createBlipAttachedTo ( MarkerCarretas06, 0 )
setElementVisibleTo ( MarkerCarretas06, root, false )
setElementVisibleTo ( BlipCarretas06, root, false )

MarkerCarretas07 = createMarker ( CarretasX07, CarretasY07, CarretasZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas07 = createBlipAttachedTo ( MarkerCarretas07, 0 )
setElementVisibleTo ( MarkerCarretas07, root, false )
setElementVisibleTo ( BlipCarretas07, root, false )

MarkerCarretas08 = createMarker ( CarretasX08, CarretasY08, CarretasZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas08 = createBlipAttachedTo ( MarkerCarretas08, 0 )
setElementVisibleTo ( MarkerCarretas08, root, false )
setElementVisibleTo ( BlipCarretas08, root, false )

MarkerCarretas09 = createMarker ( CarretasX09, CarretasY09, CarretasZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas09 = createBlipAttachedTo ( MarkerCarretas09, 0 )
setElementVisibleTo ( MarkerCarretas09, root, false )
setElementVisibleTo ( BlipCarretas09, root, false )

MarkerCarretas10 = createMarker ( CarretasX10, CarretasY10, CarretasZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas10 = createBlipAttachedTo ( MarkerCarretas10, 0 )
setElementVisibleTo ( MarkerCarretas10, root, false )
setElementVisibleTo ( BlipCarretas10, root, false )

MarkerCarretas11 = createMarker ( CarretasX11, CarretasY11, CarretasZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas11 = createBlipAttachedTo ( MarkerCarretas11, 0 )
setElementVisibleTo ( MarkerCarretas11, root, false )
setElementVisibleTo ( BlipCarretas11, root, false )

MarkerCarretas12 = createMarker ( CarretasX12, CarretasY12, CarretasZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas12 = createBlipAttachedTo ( MarkerCarretas12, 0 )
setElementVisibleTo ( MarkerCarretas12, root, false )
setElementVisibleTo ( BlipCarretas12, root, false )

MarkerCarretas13 = createMarker ( CarretasX13, CarretasY13, CarretasZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas13 = createBlipAttachedTo ( MarkerCarretas13, 0 )
setElementVisibleTo ( MarkerCarretas13, root, false )
setElementVisibleTo ( BlipCarretas13, root, false )

MarkerCarretas14 = createMarker ( CarretasX14, CarretasY14, CarretasZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas14 = createBlipAttachedTo ( MarkerCarretas14, 0 )
setElementVisibleTo ( MarkerCarretas14, root, false )
setElementVisibleTo ( BlipCarretas14, root, false )

MarkerCarretas15 = createMarker ( CarretasX15, CarretasY15, CarretasZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas15 = createBlipAttachedTo ( MarkerCarretas15, 0 )
setElementVisibleTo ( MarkerCarretas15, root, false )
setElementVisibleTo ( BlipCarretas15, root, false )

MarkerCarretas16 = createMarker ( CarretasX16, CarretasY16, CarretasZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas16 = createBlipAttachedTo ( MarkerCarretas16, 0 )
setElementVisibleTo ( MarkerCarretas16, root, false )
setElementVisibleTo ( BlipCarretas16, root, false )

AutoEscolaCarretas = {}

function CarretasHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Carretas" ) == true then
if getPlayerMoney(source) >= HabValorCarretas then
takePlayerMoney(source, HabValorCarretas)
if AutoEscolaCarretas[source] and isElement( AutoEscolaCarretas[source] ) then destroyElement ( AutoEscolaCarretas[source] )
AutoEscolaCarretas[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCarretas[source] = createVehicle( CarretasID, CarretasRX, CarretasRY, CarretasRZ )
setElementRotation ( AutoEscolaCarretas[source], CarretasRotA, CarretasRotB, CarretasRotC )
setVehicleLocked ( AutoEscolaCarretas[source], true )
warpPedIntoVehicle ( source, AutoEscolaCarretas[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCarretas00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCarretas01, source, true )
setElementVisibleTo ( BlipCarretas01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas03, "warning")
end
end
addEvent("Hab:Carreta", true)
addEventHandler ( "Hab:Carreta", root, CarretasHab)

function emarkerCarretas(marker,md) 
    if (md) then
      if AutoEscolaCarretas[source] and isElement( AutoEscolaCarretas[source] ) then
        if marker == MarkerCarretas01 then
        if getElementData( source, "Carteira:StartCarretas00", true ) then
        setElementVisibleTo ( MarkerCarretas01, source, false )
        setElementVisibleTo ( BlipCarretas01, source, false )
        setElementVisibleTo ( MarkerCarretas02, source, true )
        setElementVisibleTo ( BlipCarretas02, source, true )
        setElementData ( source, "Carteira:StartCarretas01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas02 then
        if getElementData( source, "Carteira:StartCarretas01", true ) then
        setElementVisibleTo ( MarkerCarretas02, source, false )
        setElementVisibleTo ( BlipCarretas02, source, false )
        setElementVisibleTo ( MarkerCarretas03, source, true )
        setElementVisibleTo ( BlipCarretas03, source, true )
        setElementData ( source, "Carteira:StartCarretas02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas03 then
        if getElementData( source, "Carteira:StartCarretas02", true ) then
        setElementVisibleTo ( MarkerCarretas03, source, false )
        setElementVisibleTo ( BlipCarretas03, source, false )
        setElementVisibleTo ( MarkerCarretas04, source, true )
        setElementVisibleTo ( BlipCarretas04, source, true )
        setElementData ( source, "Carteira:StartCarretas03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas04 then
        if getElementData( source, "Carteira:StartCarretas03", true ) then
        setElementVisibleTo ( MarkerCarretas04, source, false )
        setElementVisibleTo ( BlipCarretas04, source, false )
        setElementVisibleTo ( MarkerCarretas05, source, true )
        setElementVisibleTo ( BlipCarretas05, source, true )
        setElementData ( source, "Carteira:StartCarretas04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas05 then
        if getElementData( source, "Carteira:StartCarretas04", true ) then
        setElementVisibleTo ( MarkerCarretas05, source, false )
        setElementVisibleTo ( BlipCarretas05, source, false )
        setElementVisibleTo ( MarkerCarretas06, source, true )
        setElementVisibleTo ( BlipCarretas06, source, true )
        setElementData ( source, "Carteira:StartCarretas05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas06 then
        if getElementData( source, "Carteira:StartCarretas05", true ) then
        setElementVisibleTo ( MarkerCarretas06, source, false )
        setElementVisibleTo ( BlipCarretas06, source, false )
        setElementVisibleTo ( MarkerCarretas07, source, true )
        setElementVisibleTo ( BlipCarretas07, source, true )
        setElementData ( source, "Carteira:StartCarretas06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas07 then
        if getElementData( source, "Carteira:StartCarretas06", true ) then
        setElementVisibleTo ( MarkerCarretas07, source, false )
        setElementVisibleTo ( BlipCarretas07, source, false )
        setElementVisibleTo ( MarkerCarretas08, source, true )
        setElementVisibleTo ( BlipCarretas08, source, true )
        setElementData ( source, "Carteira:StartCarretas07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas08 then
        if getElementData( source, "Carteira:StartCarretas07", true ) then
        setElementVisibleTo ( MarkerCarretas08, source, false )
        setElementVisibleTo ( BlipCarretas08, source, false )
        setElementVisibleTo ( MarkerCarretas09, source, true )
        setElementVisibleTo ( BlipCarretas09, source, true )
        setElementData ( source, "Carteira:StartCarretas08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas09 then
        if getElementData( source, "Carteira:StartCarretas08", true ) then
        setElementVisibleTo ( MarkerCarretas09, source, false )
        setElementVisibleTo ( BlipCarretas09, source, false )
        setElementVisibleTo ( MarkerCarretas10, source, true )
        setElementVisibleTo ( BlipCarretas10, source, true )
        setElementData ( source, "Carteira:StartCarretas09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas10 then
        if getElementData( source, "Carteira:StartCarretas09", true ) then
        setElementVisibleTo ( MarkerCarretas10, source, false )
        setElementVisibleTo ( BlipCarretas10, source, false )
        setElementVisibleTo ( MarkerCarretas11, source, true )
        setElementVisibleTo ( BlipCarretas11, source, true )
        setElementData ( source, "Carteira:StartCarretas10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas11 then
        if getElementData( source, "Carteira:StartCarretas10", true ) then
        setElementVisibleTo ( MarkerCarretas11, source, false )
        setElementVisibleTo ( BlipCarretas11, source, false )
        setElementVisibleTo ( MarkerCarretas12, source, true )
        setElementVisibleTo ( BlipCarretas12, source, true )
        setElementData ( source, "Carteira:StartCarretas11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas12 then
        if getElementData( source, "Carteira:StartCarretas11", true ) then
        setElementVisibleTo ( MarkerCarretas12, source, false )
        setElementVisibleTo ( BlipCarretas12, source, false )
        setElementVisibleTo ( MarkerCarretas13, source, true )
        setElementVisibleTo ( BlipCarretas13, source, true )
        setElementData ( source, "Carteira:StartCarretas12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas13 then
        if getElementData( source, "Carteira:StartCarretas12", true ) then
        setElementVisibleTo ( MarkerCarretas13, source, false )
        setElementVisibleTo ( BlipCarretas13, source, false )
        setElementVisibleTo ( MarkerCarretas14, source, true )
        setElementVisibleTo ( BlipCarretas14, source, true )
        setElementData ( source, "Carteira:StartCarretas13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas14 then
        if getElementData( source, "Carteira:StartCarretas13", true ) then
        setElementVisibleTo ( MarkerCarretas14, source, false )
        setElementVisibleTo ( BlipCarretas14, source, false )
        setElementVisibleTo ( MarkerCarretas15, source, true )
        setElementVisibleTo ( BlipCarretas15, source, true )
        setElementData ( source, "Carteira:StartCarretas14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas15 then
        if getElementData( source, "Carteira:StartCarretas14", true ) then
        setElementVisibleTo ( MarkerCarretas15, source, false )
        setElementVisibleTo ( BlipCarretas15, source, false )
        setElementVisibleTo ( MarkerCarretas16, source, true )
        setElementVisibleTo ( BlipCarretas16, source, true )
        setElementData ( source, "Carteira:StartCarretas15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas16 then
        if getElementData( source, "Carteira:StartCarretas15", true ) then
        AutoEscolaCarretasVida = getElementHealth ( AutoEscolaCarretas[source] )
        if AutoEscolaCarretasVida <= CarretasDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgCarretas04, "error")
        else
        setElementData( source, "Habilitacoes:Carretas", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgCarretas05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas15", false )
        setElementVisibleTo ( MarkerCarretas16, source, false )
        setElementVisibleTo ( BlipCarretas16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaCarretas[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCarretas)

function SairDoVeiculoAutoEscolaCarretas (source)
if ( AutoEscolaCarretas[source] ) and isElement( AutoEscolaCarretas[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarretas[source] )
setElementData ( source, "Carteira:StartCarretas00", false )
setElementData ( source, "Carteira:StartCarretas01", false )
setElementData ( source, "Carteira:StartCarretas02", false )
setElementData ( source, "Carteira:StartCarretas03", false )
setElementData ( source, "Carteira:StartCarretas04", false )
setElementData ( source, "Carteira:StartCarretas05", false )
setElementData ( source, "Carteira:StartCarretas06", false )
setElementData ( source, "Carteira:StartCarretas07", false )
setElementData ( source, "Carteira:StartCarretas08", false )
setElementData ( source, "Carteira:StartCarretas09", false )
setElementData ( source, "Carteira:StartCarretas10", false )
setElementData ( source, "Carteira:StartCarretas11", false )
setElementData ( source, "Carteira:StartCarretas12", false )
setElementData ( source, "Carteira:StartCarretas13", false )
setElementData ( source, "Carteira:StartCarretas14", false )
setElementData ( source, "Carteira:StartCarretas15", false )
setElementVisibleTo ( MarkerCarretas01, source, false )
setElementVisibleTo ( BlipCarretas01, source, false )
setElementVisibleTo ( MarkerCarretas02, source, false )
setElementVisibleTo ( BlipCarretas02, source, false )
setElementVisibleTo ( MarkerCarretas03, source, false )
setElementVisibleTo ( BlipCarretas03, source, false )
setElementVisibleTo ( MarkerCarretas04, source, false )
setElementVisibleTo ( BlipCarretas04, source, false )
setElementVisibleTo ( MarkerCarretas05, source, false )
setElementVisibleTo ( BlipCarretas05, source, false )
setElementVisibleTo ( MarkerCarretas06, source, false )
setElementVisibleTo ( BlipCarretas06, source, false )
setElementVisibleTo ( MarkerCarretas07, source, false )
setElementVisibleTo ( BlipCarretas07, source, false )
setElementVisibleTo ( MarkerCarretas08, source, false )
setElementVisibleTo ( BlipCarretas08, source, false )
setElementVisibleTo ( MarkerCarretas09, source, false )
setElementVisibleTo ( BlipCarretas09, source, false )
setElementVisibleTo ( MarkerCarretas10, source, false )
setElementVisibleTo ( BlipCarretas10, source, false )
setElementVisibleTo ( MarkerCarretas11, source, false )
setElementVisibleTo ( BlipCarretas11, source, false )
setElementVisibleTo ( MarkerCarretas12, source, false )
setElementVisibleTo ( BlipCarretas12, source, false )
setElementVisibleTo ( MarkerCarretas13, source, false )
setElementVisibleTo ( BlipCarretas13, source, false )
setElementVisibleTo ( MarkerCarretas14, source, false )
setElementVisibleTo ( BlipCarretas14, source, false )
setElementVisibleTo ( MarkerCarretas15, source, false )
setElementVisibleTo ( BlipCarretas15, source, false )
setElementVisibleTo ( MarkerCarretas16, source, false )
setElementVisibleTo ( BlipCarretas16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCarretas )

function MorrerAutoEscolaCarretas ()
if ( AutoEscolaCarretas[source] ) and isElement( AutoEscolaCarretas[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarretas[source] )
setElementData ( source, "Carteira:StartCarretas00", false )
setElementData ( source, "Carteira:StartCarretas01", false )
setElementData ( source, "Carteira:StartCarretas02", false )
setElementData ( source, "Carteira:StartCarretas03", false )
setElementData ( source, "Carteira:StartCarretas04", false )
setElementData ( source, "Carteira:StartCarretas05", false )
setElementData ( source, "Carteira:StartCarretas06", false )
setElementData ( source, "Carteira:StartCarretas07", false )
setElementData ( source, "Carteira:StartCarretas08", false )
setElementData ( source, "Carteira:StartCarretas09", false )
setElementData ( source, "Carteira:StartCarretas10", false )
setElementData ( source, "Carteira:StartCarretas11", false )
setElementData ( source, "Carteira:StartCarretas12", false )
setElementData ( source, "Carteira:StartCarretas13", false )
setElementData ( source, "Carteira:StartCarretas14", false )
setElementData ( source, "Carteira:StartCarretas15", false )
setElementVisibleTo ( MarkerCarretas01, source, false )
setElementVisibleTo ( BlipCarretas01, source, false )
setElementVisibleTo ( MarkerCarretas02, source, false )
setElementVisibleTo ( BlipCarretas02, source, false )
setElementVisibleTo ( MarkerCarretas03, source, false )
setElementVisibleTo ( BlipCarretas03, source, false )
setElementVisibleTo ( MarkerCarretas04, source, false )
setElementVisibleTo ( BlipCarretas04, source, false )
setElementVisibleTo ( MarkerCarretas05, source, false )
setElementVisibleTo ( BlipCarretas05, source, false )
setElementVisibleTo ( MarkerCarretas06, source, false )
setElementVisibleTo ( BlipCarretas06, source, false )
setElementVisibleTo ( MarkerCarretas07, source, false )
setElementVisibleTo ( BlipCarretas07, source, false )
setElementVisibleTo ( MarkerCarretas08, source, false )
setElementVisibleTo ( BlipCarretas08, source, false )
setElementVisibleTo ( MarkerCarretas09, source, false )
setElementVisibleTo ( BlipCarretas09, source, false )
setElementVisibleTo ( MarkerCarretas10, source, false )
setElementVisibleTo ( BlipCarretas10, source, false )
setElementVisibleTo ( MarkerCarretas11, source, false )
setElementVisibleTo ( BlipCarretas11, source, false )
setElementVisibleTo ( MarkerCarretas12, source, false )
setElementVisibleTo ( BlipCarretas12, source, false )
setElementVisibleTo ( MarkerCarretas13, source, false )
setElementVisibleTo ( BlipCarretas13, source, false )
setElementVisibleTo ( MarkerCarretas14, source, false )
setElementVisibleTo ( BlipCarretas14, source, false )
setElementVisibleTo ( MarkerCarretas15, source, false )
setElementVisibleTo ( BlipCarretas15, source, false )
setElementVisibleTo ( MarkerCarretas16, source, false )
setElementVisibleTo ( BlipCarretas16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCarretas )

function SairDoServidorAutoEscolaCarretas ( quitType )    
if isElement( AutoEscolaCarretas[source] ) then
destroyElement ( AutoEscolaCarretas[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCarretas )

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Barcos

BarcosRX, BarcosRY, BarcosRZ           = 2094.08521, -102.32258, 0.51715 -- Coordenadas de Respawn do Barco
BarcosRotA, BarcosRotB, BarcosRotC     = 0, 0, 125.45202636719 -- Rotação do Veiculo ao Spawnar
BarcosID                               = 446 -- ID do Barco
HabValorBarcos                         = 3000 -- Valor da Habilitação Categoria "Barcos"
BarcosDanoParaReprovar                 = 950 -- 95%

MsgBarcos01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgBarcos02 = "Você Não Tem Dinheiro Suficiente!"
MsgBarcos03 = "Você Ja Possui Essa Habilitação!"
MsgBarcos04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgBarcos05 = "Carteira de Habilitação Categoria 'Barcos' Concedida!"
MsgBarcos06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgBarcos07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

BarcosX01, BarcosY01, BarcosZ01 = 1969.37048, -76.51154, 0.61060
BarcosX02, BarcosY02, BarcosZ02 = 1778.74304, -25.28976, 1.06329
BarcosX03, BarcosY03, BarcosZ03 = 1604.60706, -42.24431, 0.20777
BarcosX04, BarcosY04, BarcosZ04 = 1564.81091, -188.31783, 1.03013
BarcosX05, BarcosY05, BarcosZ05 = 1351.16663, -255.22849, 0.64836
BarcosX06, BarcosY06, BarcosZ06 = 1224.50562, -147.91315, 0.70902
BarcosX07, BarcosY07, BarcosZ07 = 1078.58972, -103.00694, 0.49749
BarcosX08, BarcosY08, BarcosZ08 = 872.80511, -122.47253, 0.59834
BarcosX09, BarcosY09, BarcosZ09 = 752.33319, -192.47580, 0.66709
BarcosX10, BarcosY10, BarcosZ10 = 565.60455, -235.80785, 0.71552
BarcosX11, BarcosY11, BarcosZ11 = 389.19714, -285.92471, 0.58013
BarcosX12, BarcosY12, BarcosZ12 = 271.44901, -375.78848, 0.61753
BarcosX13, BarcosY13, BarcosZ13 = 109.00140, -434.07193, 0.24948
BarcosX14, BarcosY14, BarcosZ14 = -87.17338, -609.55768, -0.14524
BarcosX15, BarcosY15, BarcosZ15 = -217.76225, -535.85645, 0.12518
BarcosX16, BarcosY16, BarcosZ16 = -331.42117, -468.58258, 0.62195

MarkerBarcos01 = createMarker ( BarcosX01, BarcosY01, BarcosZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos01 = createBlipAttachedTo ( MarkerBarcos01, 0 )
setElementVisibleTo ( MarkerBarcos01, root, false )
setElementVisibleTo ( BlipBarcos01, root, false )

MarkerBarcos02 = createMarker ( BarcosX02, BarcosY02, BarcosZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos02 = createBlipAttachedTo ( MarkerBarcos02, 0 )
setElementVisibleTo ( MarkerBarcos02, root, false )
setElementVisibleTo ( BlipBarcos02, root, false )

MarkerBarcos03 = createMarker ( BarcosX03, BarcosY03, BarcosZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos03 = createBlipAttachedTo ( MarkerBarcos03, 0 )
setElementVisibleTo ( MarkerBarcos03, root, false )
setElementVisibleTo ( BlipBarcos03, root, false )

MarkerBarcos04 = createMarker ( BarcosX04, BarcosY04, BarcosZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos04 = createBlipAttachedTo ( MarkerBarcos04, 0 )
setElementVisibleTo ( MarkerBarcos04, root, false )
setElementVisibleTo ( BlipBarcos04, root, false )

MarkerBarcos05 = createMarker ( BarcosX05, BarcosY05, BarcosZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos05 = createBlipAttachedTo ( MarkerBarcos05, 0 )
setElementVisibleTo ( MarkerBarcos05, root, false )
setElementVisibleTo ( BlipBarcos05, root, false )

MarkerBarcos06 = createMarker ( BarcosX06, BarcosY06, BarcosZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos06 = createBlipAttachedTo ( MarkerBarcos06, 0 )
setElementVisibleTo ( MarkerBarcos06, root, false )
setElementVisibleTo ( BlipBarcos06, root, false )

MarkerBarcos07 = createMarker ( BarcosX07, BarcosY07, BarcosZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos07 = createBlipAttachedTo ( MarkerBarcos07, 0 )
setElementVisibleTo ( MarkerBarcos07, root, false )
setElementVisibleTo ( BlipBarcos07, root, false )

MarkerBarcos08 = createMarker ( BarcosX08, BarcosY08, BarcosZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos08 = createBlipAttachedTo ( MarkerBarcos08, 0 )
setElementVisibleTo ( MarkerBarcos08, root, false )
setElementVisibleTo ( BlipBarcos08, root, false )

MarkerBarcos09 = createMarker ( BarcosX09, BarcosY09, BarcosZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos09 = createBlipAttachedTo ( MarkerBarcos09, 0 )
setElementVisibleTo ( MarkerBarcos09, root, false )
setElementVisibleTo ( BlipBarcos09, root, false )

MarkerBarcos10 = createMarker ( BarcosX10, BarcosY10, BarcosZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos10 = createBlipAttachedTo ( MarkerBarcos10, 0 )
setElementVisibleTo ( MarkerBarcos10, root, false )
setElementVisibleTo ( BlipBarcos10, root, false )

MarkerBarcos11 = createMarker ( BarcosX11, BarcosY11, BarcosZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos11 = createBlipAttachedTo ( MarkerBarcos11, 0 )
setElementVisibleTo ( MarkerBarcos11, root, false )
setElementVisibleTo ( BlipBarcos11, root, false )

MarkerBarcos12 = createMarker ( BarcosX12, BarcosY12, BarcosZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos12 = createBlipAttachedTo ( MarkerBarcos12, 0 )
setElementVisibleTo ( MarkerBarcos12, root, false )
setElementVisibleTo ( BlipBarcos12, root, false )

MarkerBarcos13 = createMarker ( BarcosX13, BarcosY13, BarcosZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos13 = createBlipAttachedTo ( MarkerBarcos13, 0 )
setElementVisibleTo ( MarkerBarcos13, root, false )
setElementVisibleTo ( BlipBarcos13, root, false )

MarkerBarcos14 = createMarker ( BarcosX14, BarcosY14, BarcosZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos14 = createBlipAttachedTo ( MarkerBarcos14, 0 )
setElementVisibleTo ( MarkerBarcos14, root, false )
setElementVisibleTo ( BlipBarcos14, root, false )

MarkerBarcos15 = createMarker ( BarcosX15, BarcosY15, BarcosZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos15 = createBlipAttachedTo ( MarkerBarcos15, 0 )
setElementVisibleTo ( MarkerBarcos15, root, false )
setElementVisibleTo ( BlipBarcos15, root, false )

MarkerBarcos16 = createMarker ( BarcosX16, BarcosY16, BarcosZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos16 = createBlipAttachedTo ( MarkerBarcos16, 0 )
setElementVisibleTo ( MarkerBarcos16, root, false )
setElementVisibleTo ( BlipBarcos16, root, false )

AutoEscolaBarcos = {}

function BarcosHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Barcos" ) == true then
if getPlayerMoney(source) >= HabValorBarcos then
takePlayerMoney(source, HabValorBarcos)
if AutoEscolaBarcos[source] and isElement( AutoEscolaBarcos[source] ) then destroyElement ( AutoEscolaBarcos[source] )
AutoEscolaBarcos[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaBarcos[source] = createVehicle( BarcosID, BarcosRX, BarcosRY, BarcosRZ )
setElementRotation ( AutoEscolaBarcos[source], BarcosRotA, BarcosRotB, BarcosRotC )
setVehicleLocked ( AutoEscolaBarcos[source], true )
warpPedIntoVehicle ( source, AutoEscolaBarcos[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartBarcos00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerBarcos01, source, true )
setElementVisibleTo ( BlipBarcos01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos03, "warning")
end
end
addEvent("Hab:Barco", true)
addEventHandler ( "Hab:Barco", root, BarcosHab)

function emarkerBarcos(marker,md) 
    if (md) then
      if AutoEscolaBarcos[source] and isElement( AutoEscolaBarcos[source] ) then
        if marker == MarkerBarcos01 then
        if getElementData( source, "Carteira:StartBarcos00", true ) then
        setElementVisibleTo ( MarkerBarcos01, source, false )
        setElementVisibleTo ( BlipBarcos01, source, false )
        setElementVisibleTo ( MarkerBarcos02, source, true )
        setElementVisibleTo ( BlipBarcos02, source, true )
        setElementData ( source, "Carteira:StartBarcos01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos02 then
        if getElementData( source, "Carteira:StartBarcos01", true ) then
        setElementVisibleTo ( MarkerBarcos02, source, false )
        setElementVisibleTo ( BlipBarcos02, source, false )
        setElementVisibleTo ( MarkerBarcos03, source, true )
        setElementVisibleTo ( BlipBarcos03, source, true )
        setElementData ( source, "Carteira:StartBarcos02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos03 then
        if getElementData( source, "Carteira:StartBarcos02", true ) then
        setElementVisibleTo ( MarkerBarcos03, source, false )
        setElementVisibleTo ( BlipBarcos03, source, false )
        setElementVisibleTo ( MarkerBarcos04, source, true )
        setElementVisibleTo ( BlipBarcos04, source, true )
        setElementData ( source, "Carteira:StartBarcos03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos04 then
        if getElementData( source, "Carteira:StartBarcos03", true ) then
        setElementVisibleTo ( MarkerBarcos04, source, false )
        setElementVisibleTo ( BlipBarcos04, source, false )
        setElementVisibleTo ( MarkerBarcos05, source, true )
        setElementVisibleTo ( BlipBarcos05, source, true )
        setElementData ( source, "Carteira:StartBarcos04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos05 then
        if getElementData( source, "Carteira:StartBarcos04", true ) then
        setElementVisibleTo ( MarkerBarcos05, source, false )
        setElementVisibleTo ( BlipBarcos05, source, false )
        setElementVisibleTo ( MarkerBarcos06, source, true )
        setElementVisibleTo ( BlipBarcos06, source, true )
        setElementData ( source, "Carteira:StartBarcos05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos06 then
        if getElementData( source, "Carteira:StartBarcos05", true ) then
        setElementVisibleTo ( MarkerBarcos06, source, false )
        setElementVisibleTo ( BlipBarcos06, source, false )
        setElementVisibleTo ( MarkerBarcos07, source, true )
        setElementVisibleTo ( BlipBarcos07, source, true )
        setElementData ( source, "Carteira:StartBarcos06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos07 then
        if getElementData( source, "Carteira:StartBarcos06", true ) then
        setElementVisibleTo ( MarkerBarcos07, source, false )
        setElementVisibleTo ( BlipBarcos07, source, false )
        setElementVisibleTo ( MarkerBarcos08, source, true )
        setElementVisibleTo ( BlipBarcos08, source, true )
        setElementData ( source, "Carteira:StartBarcos07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos08 then
        if getElementData( source, "Carteira:StartBarcos07", true ) then
        setElementVisibleTo ( MarkerBarcos08, source, false )
        setElementVisibleTo ( BlipBarcos08, source, false )
        setElementVisibleTo ( MarkerBarcos09, source, true )
        setElementVisibleTo ( BlipBarcos09, source, true )
        setElementData ( source, "Carteira:StartBarcos08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos09 then
        if getElementData( source, "Carteira:StartBarcos08", true ) then
        setElementVisibleTo ( MarkerBarcos09, source, false )
        setElementVisibleTo ( BlipBarcos09, source, false )
        setElementVisibleTo ( MarkerBarcos10, source, true )
        setElementVisibleTo ( BlipBarcos10, source, true )
        setElementData ( source, "Carteira:StartBarcos09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos10 then
        if getElementData( source, "Carteira:StartBarcos09", true ) then
        setElementVisibleTo ( MarkerBarcos10, source, false )
        setElementVisibleTo ( BlipBarcos10, source, false )
        setElementVisibleTo ( MarkerBarcos11, source, true )
        setElementVisibleTo ( BlipBarcos11, source, true )
        setElementData ( source, "Carteira:StartBarcos10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos11 then
        if getElementData( source, "Carteira:StartBarcos10", true ) then
        setElementVisibleTo ( MarkerBarcos11, source, false )
        setElementVisibleTo ( BlipBarcos11, source, false )
        setElementVisibleTo ( MarkerBarcos12, source, true )
        setElementVisibleTo ( BlipBarcos12, source, true )
        setElementData ( source, "Carteira:StartBarcos11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos12 then
        if getElementData( source, "Carteira:StartBarcos11", true ) then
        setElementVisibleTo ( MarkerBarcos12, source, false )
        setElementVisibleTo ( BlipBarcos12, source, false )
        setElementVisibleTo ( MarkerBarcos13, source, true )
        setElementVisibleTo ( BlipBarcos13, source, true )
        setElementData ( source, "Carteira:StartBarcos12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos13 then
        if getElementData( source, "Carteira:StartBarcos12", true ) then
        setElementVisibleTo ( MarkerBarcos13, source, false )
        setElementVisibleTo ( BlipBarcos13, source, false )
        setElementVisibleTo ( MarkerBarcos14, source, true )
        setElementVisibleTo ( BlipBarcos14, source, true )
        setElementData ( source, "Carteira:StartBarcos13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos14 then
        if getElementData( source, "Carteira:StartBarcos13", true ) then
        setElementVisibleTo ( MarkerBarcos14, source, false )
        setElementVisibleTo ( BlipBarcos14, source, false )
        setElementVisibleTo ( MarkerBarcos15, source, true )
        setElementVisibleTo ( BlipBarcos15, source, true )
        setElementData ( source, "Carteira:StartBarcos14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos15 then
        if getElementData( source, "Carteira:StartBarcos14", true ) then
        setElementVisibleTo ( MarkerBarcos15, source, false )
        setElementVisibleTo ( BlipBarcos15, source, false )
        setElementVisibleTo ( MarkerBarcos16, source, true )
        setElementVisibleTo ( BlipBarcos16, source, true )
        setElementData ( source, "Carteira:StartBarcos15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos16 then
        if getElementData( source, "Carteira:StartBarcos15", true ) then
        AutoEscolaBarcosVida = getElementHealth ( AutoEscolaBarcos[source] )
        if AutoEscolaBarcosVida <= BarcosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgBarcos04, "error")
        else
        setElementData( source, "Habilitacoes:Barcos", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgBarcos05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos15", false )
        setElementVisibleTo ( MarkerBarcos16, source, false )
        setElementVisibleTo ( BlipBarcos16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaBarcos[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerBarcos)

function SairDoVeiculoAutoEscolaBarcos (source)
if ( AutoEscolaBarcos[source] ) and isElement( AutoEscolaBarcos[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaBarcos[source] )
setElementData ( source, "Carteira:StartBarcos00", false )
setElementData ( source, "Carteira:StartBarcos01", false )
setElementData ( source, "Carteira:StartBarcos02", false )
setElementData ( source, "Carteira:StartBarcos03", false )
setElementData ( source, "Carteira:StartBarcos04", false )
setElementData ( source, "Carteira:StartBarcos05", false )
setElementData ( source, "Carteira:StartBarcos06", false )
setElementData ( source, "Carteira:StartBarcos07", false )
setElementData ( source, "Carteira:StartBarcos08", false )
setElementData ( source, "Carteira:StartBarcos09", false )
setElementData ( source, "Carteira:StartBarcos10", false )
setElementData ( source, "Carteira:StartBarcos11", false )
setElementData ( source, "Carteira:StartBarcos12", false )
setElementData ( source, "Carteira:StartBarcos13", false )
setElementData ( source, "Carteira:StartBarcos14", false )
setElementData ( source, "Carteira:StartBarcos15", false )
setElementVisibleTo ( MarkerBarcos01, source, false )
setElementVisibleTo ( BlipBarcos01, source, false )
setElementVisibleTo ( MarkerBarcos02, source, false )
setElementVisibleTo ( BlipBarcos02, source, false )
setElementVisibleTo ( MarkerBarcos03, source, false )
setElementVisibleTo ( BlipBarcos03, source, false )
setElementVisibleTo ( MarkerBarcos04, source, false )
setElementVisibleTo ( BlipBarcos04, source, false )
setElementVisibleTo ( MarkerBarcos05, source, false )
setElementVisibleTo ( BlipBarcos05, source, false )
setElementVisibleTo ( MarkerBarcos06, source, false )
setElementVisibleTo ( BlipBarcos06, source, false )
setElementVisibleTo ( MarkerBarcos07, source, false )
setElementVisibleTo ( BlipBarcos07, source, false )
setElementVisibleTo ( MarkerBarcos08, source, false )
setElementVisibleTo ( BlipBarcos08, source, false )
setElementVisibleTo ( MarkerBarcos09, source, false )
setElementVisibleTo ( BlipBarcos09, source, false )
setElementVisibleTo ( MarkerBarcos10, source, false )
setElementVisibleTo ( BlipBarcos10, source, false )
setElementVisibleTo ( MarkerBarcos11, source, false )
setElementVisibleTo ( BlipBarcos11, source, false )
setElementVisibleTo ( MarkerBarcos12, source, false )
setElementVisibleTo ( BlipBarcos12, source, false )
setElementVisibleTo ( MarkerBarcos13, source, false )
setElementVisibleTo ( BlipBarcos13, source, false )
setElementVisibleTo ( MarkerBarcos14, source, false )
setElementVisibleTo ( BlipBarcos14, source, false )
setElementVisibleTo ( MarkerBarcos15, source, false )
setElementVisibleTo ( BlipBarcos15, source, false )
setElementVisibleTo ( MarkerBarcos16, source, false )
setElementVisibleTo ( BlipBarcos16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaBarcos )

function MorrerAutoEscolaBarcos ()
if ( AutoEscolaBarcos[source] ) and isElement( AutoEscolaBarcos[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaBarcos[source] )
setElementData ( source, "Carteira:StartBarcos00", false )
setElementData ( source, "Carteira:StartBarcos01", false )
setElementData ( source, "Carteira:StartBarcos02", false )
setElementData ( source, "Carteira:StartBarcos03", false )
setElementData ( source, "Carteira:StartBarcos04", false )
setElementData ( source, "Carteira:StartBarcos05", false )
setElementData ( source, "Carteira:StartBarcos06", false )
setElementData ( source, "Carteira:StartBarcos07", false )
setElementData ( source, "Carteira:StartBarcos08", false )
setElementData ( source, "Carteira:StartBarcos09", false )
setElementData ( source, "Carteira:StartBarcos10", false )
setElementData ( source, "Carteira:StartBarcos11", false )
setElementData ( source, "Carteira:StartBarcos12", false )
setElementData ( source, "Carteira:StartBarcos13", false )
setElementData ( source, "Carteira:StartBarcos14", false )
setElementData ( source, "Carteira:StartBarcos15", false )
setElementVisibleTo ( MarkerBarcos01, source, false )
setElementVisibleTo ( BlipBarcos01, source, false )
setElementVisibleTo ( MarkerBarcos02, source, false )
setElementVisibleTo ( BlipBarcos02, source, false )
setElementVisibleTo ( MarkerBarcos03, source, false )
setElementVisibleTo ( BlipBarcos03, source, false )
setElementVisibleTo ( MarkerBarcos04, source, false )
setElementVisibleTo ( BlipBarcos04, source, false )
setElementVisibleTo ( MarkerBarcos05, source, false )
setElementVisibleTo ( BlipBarcos05, source, false )
setElementVisibleTo ( MarkerBarcos06, source, false )
setElementVisibleTo ( BlipBarcos06, source, false )
setElementVisibleTo ( MarkerBarcos07, source, false )
setElementVisibleTo ( BlipBarcos07, source, false )
setElementVisibleTo ( MarkerBarcos08, source, false )
setElementVisibleTo ( BlipBarcos08, source, false )
setElementVisibleTo ( MarkerBarcos09, source, false )
setElementVisibleTo ( BlipBarcos09, source, false )
setElementVisibleTo ( MarkerBarcos10, source, false )
setElementVisibleTo ( BlipBarcos10, source, false )
setElementVisibleTo ( MarkerBarcos11, source, false )
setElementVisibleTo ( BlipBarcos11, source, false )
setElementVisibleTo ( MarkerBarcos12, source, false )
setElementVisibleTo ( BlipBarcos12, source, false )
setElementVisibleTo ( MarkerBarcos13, source, false )
setElementVisibleTo ( BlipBarcos13, source, false )
setElementVisibleTo ( MarkerBarcos14, source, false )
setElementVisibleTo ( BlipBarcos14, source, false )
setElementVisibleTo ( MarkerBarcos15, source, false )
setElementVisibleTo ( BlipBarcos15, source, false )
setElementVisibleTo ( MarkerBarcos16, source, false )
setElementVisibleTo ( BlipBarcos16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaBarcos )

function SairDoServidorAutoEscolaBarcos ( quitType )    
if isElement( AutoEscolaBarcos[source] ) then
destroyElement ( AutoEscolaBarcos[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaBarcos )

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Helicopteros

HelicopterosRX, HelicopterosRY, HelicopterosRZ           = 190.13397, -302.89218, 1.57813 -- Coordenadas de Respawn do Helicoptero
HelicopterosRotA, HelicopterosRotB, HelicopterosRotC     = 0, 0, 0 -- Rotação do Veiculo ao Spawnar
HelicopterosID                               = 469 -- ID do Helicoptero
HabValorHelicopteros                         = 10000 -- Valor da Habilitação Categoria "Helicopteros"
HelicopterosDanoParaReprovar                 = 950 -- 95%

MsgHelicopteros01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgHelicopteros02 = "Você Não Tem Dinheiro Suficiente!"
MsgHelicopteros03 = "Você Ja Possui Essa Habilitação!"
MsgHelicopteros04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgHelicopteros05 = "Carteira de Habilitação Categoria 'Helicopteros' Concedida!"
MsgHelicopteros06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgHelicopteros07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

HelicopterosX01, HelicopterosY01, HelicopterosZ01 = 192.54529, -255.43195, 19.71858
HelicopterosX02, HelicopterosY02, HelicopterosZ02 = 289.75629, -62.69717, 38.09697
HelicopterosX03, HelicopterosY03, HelicopterosZ03 = 387.02344, 109.72382, 49.56145
HelicopterosX04, HelicopterosY04, HelicopterosZ04 = 523.74475, 401.76590, 59.54094
HelicopterosX05, HelicopterosY05, HelicopterosZ05 = 648.68756, 623.60193, 53.53587
HelicopterosX06, HelicopterosY06, HelicopterosZ06 = 821.34821, 797.55927, 57.30814
HelicopterosX07, HelicopterosY07, HelicopterosZ07 = 923.19025, 960.18860, 59.13763
HelicopterosX08, HelicopterosY08, HelicopterosZ08 = 1101.84985, 1189.58154, 66.81283
HelicopterosX09, HelicopterosY09, HelicopterosZ09 = 1265.18176, 1356.48291, 64.21224
HelicopterosX10, HelicopterosY10, HelicopterosZ10 = 1423.97729, 1519.96594, 74.06803
HelicopterosX11, HelicopterosY11, HelicopterosZ11 = 1599.68640, 1664.47388, 70.88983
HelicopterosX12, HelicopterosY12, HelicopterosZ12 = 1755.91052, 1766.84497, 103.27734
HelicopterosX13, HelicopterosY13, HelicopterosZ13 = 1905.53833, 1863.55908, 143.65627
HelicopterosX14, HelicopterosY14, HelicopterosZ14 = 2048.65479, 1947.74756, 106.53687
HelicopterosX15, HelicopterosY15, HelicopterosZ15 = 2107.26782, 2225.87476, 99.85953
HelicopterosX16, HelicopterosY16, HelicopterosZ16 = 2092.58252, 2415.30615, 74.52721

MarkerHelicopteros01 = createMarker ( HelicopterosX01, HelicopterosY01, HelicopterosZ01 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros01 = createBlipAttachedTo ( MarkerHelicopteros01, 0 )
setElementVisibleTo ( MarkerHelicopteros01, root, false )
setElementVisibleTo ( BlipHelicopteros01, root, false )

MarkerHelicopteros02 = createMarker ( HelicopterosX02, HelicopterosY02, HelicopterosZ02 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros02 = createBlipAttachedTo ( MarkerHelicopteros02, 0 )
setElementVisibleTo ( MarkerHelicopteros02, root, false )
setElementVisibleTo ( BlipHelicopteros02, root, false )

MarkerHelicopteros03 = createMarker ( HelicopterosX03, HelicopterosY03, HelicopterosZ03 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros03 = createBlipAttachedTo ( MarkerHelicopteros03, 0 )
setElementVisibleTo ( MarkerHelicopteros03, root, false )
setElementVisibleTo ( BlipHelicopteros03, root, false )

MarkerHelicopteros04 = createMarker ( HelicopterosX04, HelicopterosY04, HelicopterosZ04 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros04 = createBlipAttachedTo ( MarkerHelicopteros04, 0 )
setElementVisibleTo ( MarkerHelicopteros04, root, false )
setElementVisibleTo ( BlipHelicopteros04, root, false )

MarkerHelicopteros05 = createMarker ( HelicopterosX05, HelicopterosY05, HelicopterosZ05 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros05 = createBlipAttachedTo ( MarkerHelicopteros05, 0 )
setElementVisibleTo ( MarkerHelicopteros05, root, false )
setElementVisibleTo ( BlipHelicopteros05, root, false )

MarkerHelicopteros06 = createMarker ( HelicopterosX06, HelicopterosY06, HelicopterosZ06 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros06 = createBlipAttachedTo ( MarkerHelicopteros06, 0 )
setElementVisibleTo ( MarkerHelicopteros06, root, false )
setElementVisibleTo ( BlipHelicopteros06, root, false )

MarkerHelicopteros07 = createMarker ( HelicopterosX07, HelicopterosY07, HelicopterosZ07 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros07 = createBlipAttachedTo ( MarkerHelicopteros07, 0 )
setElementVisibleTo ( MarkerHelicopteros07, root, false )
setElementVisibleTo ( BlipHelicopteros07, root, false )

MarkerHelicopteros08 = createMarker ( HelicopterosX08, HelicopterosY08, HelicopterosZ08 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros08 = createBlipAttachedTo ( MarkerHelicopteros08, 0 )
setElementVisibleTo ( MarkerHelicopteros08, root, false )
setElementVisibleTo ( BlipHelicopteros08, root, false )

MarkerHelicopteros09 = createMarker ( HelicopterosX09, HelicopterosY09, HelicopterosZ09 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros09 = createBlipAttachedTo ( MarkerHelicopteros09, 0 )
setElementVisibleTo ( MarkerHelicopteros09, root, false )
setElementVisibleTo ( BlipHelicopteros09, root, false )

MarkerHelicopteros10 = createMarker ( HelicopterosX10, HelicopterosY10, HelicopterosZ10 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros10 = createBlipAttachedTo ( MarkerHelicopteros10, 0 )
setElementVisibleTo ( MarkerHelicopteros10, root, false )
setElementVisibleTo ( BlipHelicopteros10, root, false )

MarkerHelicopteros11 = createMarker ( HelicopterosX11, HelicopterosY11, HelicopterosZ11 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros11 = createBlipAttachedTo ( MarkerHelicopteros11, 0 )
setElementVisibleTo ( MarkerHelicopteros11, root, false )
setElementVisibleTo ( BlipHelicopteros11, root, false )

MarkerHelicopteros12 = createMarker ( HelicopterosX12, HelicopterosY12, HelicopterosZ12 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros12 = createBlipAttachedTo ( MarkerHelicopteros12, 0 )
setElementVisibleTo ( MarkerHelicopteros12, root, false )
setElementVisibleTo ( BlipHelicopteros12, root, false )

MarkerHelicopteros13 = createMarker ( HelicopterosX13, HelicopterosY13, HelicopterosZ13 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros13 = createBlipAttachedTo ( MarkerHelicopteros13, 0 )
setElementVisibleTo ( MarkerHelicopteros13, root, false )
setElementVisibleTo ( BlipHelicopteros13, root, false )

MarkerHelicopteros14 = createMarker ( HelicopterosX14, HelicopterosY14, HelicopterosZ14 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros14 = createBlipAttachedTo ( MarkerHelicopteros14, 0 )
setElementVisibleTo ( MarkerHelicopteros14, root, false )
setElementVisibleTo ( BlipHelicopteros14, root, false )

MarkerHelicopteros15 = createMarker ( HelicopterosX15, HelicopterosY15, HelicopterosZ15 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros15 = createBlipAttachedTo ( MarkerHelicopteros15, 0 )
setElementVisibleTo ( MarkerHelicopteros15, root, false )
setElementVisibleTo ( BlipHelicopteros15, root, false )

MarkerHelicopteros16 = createMarker ( HelicopterosX16, HelicopterosY16, HelicopterosZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipHelicopteros16 = createBlipAttachedTo ( MarkerHelicopteros16, 0 )
setElementVisibleTo ( MarkerHelicopteros16, root, false )
setElementVisibleTo ( BlipHelicopteros16, root, false )

AutoEscolaHelicopteros = {}

function HelicopterosHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Helicopteros" ) == true then
if getPlayerMoney(source) >= HabValorHelicopteros then
takePlayerMoney(source, HabValorHelicopteros)
if AutoEscolaHelicopteros[source] and isElement( AutoEscolaHelicopteros[source] ) then destroyElement ( AutoEscolaHelicopteros[source] )
AutoEscolaHelicopteros[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaHelicopteros[source] = createVehicle( HelicopterosID, HelicopterosRX, HelicopterosRY, HelicopterosRZ )
setElementRotation ( AutoEscolaHelicopteros[source], HelicopterosRotA, HelicopterosRotB, HelicopterosRotC )
setVehicleLocked ( AutoEscolaHelicopteros[source], true )
warpPedIntoVehicle ( source, AutoEscolaHelicopteros[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartHelicopteros00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerHelicopteros01, source, true )
setElementVisibleTo ( BlipHelicopteros01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros03, "warning")
end
end
addEvent("Hab:Helicoptero", true)
addEventHandler ( "Hab:Helicoptero", root, HelicopterosHab)

function emarkerHelicopteros(marker,md) 
    if (md) then
      if AutoEscolaHelicopteros[source] and isElement( AutoEscolaHelicopteros[source] ) then
        if marker == MarkerHelicopteros01 then
        if getElementData( source, "Carteira:StartHelicopteros00", true ) then
        setElementVisibleTo ( MarkerHelicopteros01, source, false )
        setElementVisibleTo ( BlipHelicopteros01, source, false )
        setElementVisibleTo ( MarkerHelicopteros02, source, true )
        setElementVisibleTo ( BlipHelicopteros02, source, true )
        setElementData ( source, "Carteira:StartHelicopteros01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros02 then
        if getElementData( source, "Carteira:StartHelicopteros01", true ) then
        setElementVisibleTo ( MarkerHelicopteros02, source, false )
        setElementVisibleTo ( BlipHelicopteros02, source, false )
        setElementVisibleTo ( MarkerHelicopteros03, source, true )
        setElementVisibleTo ( BlipHelicopteros03, source, true )
        setElementData ( source, "Carteira:StartHelicopteros02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros03 then
        if getElementData( source, "Carteira:StartHelicopteros02", true ) then
        setElementVisibleTo ( MarkerHelicopteros03, source, false )
        setElementVisibleTo ( BlipHelicopteros03, source, false )
        setElementVisibleTo ( MarkerHelicopteros04, source, true )
        setElementVisibleTo ( BlipHelicopteros04, source, true )
        setElementData ( source, "Carteira:StartHelicopteros03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros04 then
        if getElementData( source, "Carteira:StartHelicopteros03", true ) then
        setElementVisibleTo ( MarkerHelicopteros04, source, false )
        setElementVisibleTo ( BlipHelicopteros04, source, false )
        setElementVisibleTo ( MarkerHelicopteros05, source, true )
        setElementVisibleTo ( BlipHelicopteros05, source, true )
        setElementData ( source, "Carteira:StartHelicopteros04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros05 then
        if getElementData( source, "Carteira:StartHelicopteros04", true ) then
        setElementVisibleTo ( MarkerHelicopteros05, source, false )
        setElementVisibleTo ( BlipHelicopteros05, source, false )
        setElementVisibleTo ( MarkerHelicopteros06, source, true )
        setElementVisibleTo ( BlipHelicopteros06, source, true )
        setElementData ( source, "Carteira:StartHelicopteros05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros06 then
        if getElementData( source, "Carteira:StartHelicopteros05", true ) then
        setElementVisibleTo ( MarkerHelicopteros06, source, false )
        setElementVisibleTo ( BlipHelicopteros06, source, false )
        setElementVisibleTo ( MarkerHelicopteros07, source, true )
        setElementVisibleTo ( BlipHelicopteros07, source, true )
        setElementData ( source, "Carteira:StartHelicopteros06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros07 then
        if getElementData( source, "Carteira:StartHelicopteros06", true ) then
        setElementVisibleTo ( MarkerHelicopteros07, source, false )
        setElementVisibleTo ( BlipHelicopteros07, source, false )
        setElementVisibleTo ( MarkerHelicopteros08, source, true )
        setElementVisibleTo ( BlipHelicopteros08, source, true )
        setElementData ( source, "Carteira:StartHelicopteros07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros08 then
        if getElementData( source, "Carteira:StartHelicopteros07", true ) then
        setElementVisibleTo ( MarkerHelicopteros08, source, false )
        setElementVisibleTo ( BlipHelicopteros08, source, false )
        setElementVisibleTo ( MarkerHelicopteros09, source, true )
        setElementVisibleTo ( BlipHelicopteros09, source, true )
        setElementData ( source, "Carteira:StartHelicopteros08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros09 then
        if getElementData( source, "Carteira:StartHelicopteros08", true ) then
        setElementVisibleTo ( MarkerHelicopteros09, source, false )
        setElementVisibleTo ( BlipHelicopteros09, source, false )
        setElementVisibleTo ( MarkerHelicopteros10, source, true )
        setElementVisibleTo ( BlipHelicopteros10, source, true )
        setElementData ( source, "Carteira:StartHelicopteros09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros10 then
        if getElementData( source, "Carteira:StartHelicopteros09", true ) then
        setElementVisibleTo ( MarkerHelicopteros10, source, false )
        setElementVisibleTo ( BlipHelicopteros10, source, false )
        setElementVisibleTo ( MarkerHelicopteros11, source, true )
        setElementVisibleTo ( BlipHelicopteros11, source, true )
        setElementData ( source, "Carteira:StartHelicopteros10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros11 then
        if getElementData( source, "Carteira:StartHelicopteros10", true ) then
        setElementVisibleTo ( MarkerHelicopteros11, source, false )
        setElementVisibleTo ( BlipHelicopteros11, source, false )
        setElementVisibleTo ( MarkerHelicopteros12, source, true )
        setElementVisibleTo ( BlipHelicopteros12, source, true )
        setElementData ( source, "Carteira:StartHelicopteros11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros12 then
        if getElementData( source, "Carteira:StartHelicopteros11", true ) then
        setElementVisibleTo ( MarkerHelicopteros12, source, false )
        setElementVisibleTo ( BlipHelicopteros12, source, false )
        setElementVisibleTo ( MarkerHelicopteros13, source, true )
        setElementVisibleTo ( BlipHelicopteros13, source, true )
        setElementData ( source, "Carteira:StartHelicopteros12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros13 then
        if getElementData( source, "Carteira:StartHelicopteros12", true ) then
        setElementVisibleTo ( MarkerHelicopteros13, source, false )
        setElementVisibleTo ( BlipHelicopteros13, source, false )
        setElementVisibleTo ( MarkerHelicopteros14, source, true )
        setElementVisibleTo ( BlipHelicopteros14, source, true )
        setElementData ( source, "Carteira:StartHelicopteros13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros14 then
        if getElementData( source, "Carteira:StartHelicopteros13", true ) then
        setElementVisibleTo ( MarkerHelicopteros14, source, false )
        setElementVisibleTo ( BlipHelicopteros14, source, false )
        setElementVisibleTo ( MarkerHelicopteros15, source, true )
        setElementVisibleTo ( BlipHelicopteros15, source, true )
        setElementData ( source, "Carteira:StartHelicopteros14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros15 then
        if getElementData( source, "Carteira:StartHelicopteros14", true ) then
        setElementVisibleTo ( MarkerHelicopteros15, source, false )
        setElementVisibleTo ( BlipHelicopteros15, source, false )
        setElementVisibleTo ( MarkerHelicopteros16, source, true )
        setElementVisibleTo ( BlipHelicopteros16, source, true )
        setElementData ( source, "Carteira:StartHelicopteros15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros16 then
        if getElementData( source, "Carteira:StartHelicopteros15", true ) then
        AutoEscolaHelicopterosVida = getElementHealth ( AutoEscolaHelicopteros[source] )
        if AutoEscolaHelicopterosVida <= HelicopterosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros04, "error")
        else
        setElementData( source, "Habilitacoes:Helicopteros", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros15", false )
        setElementVisibleTo ( MarkerHelicopteros16, source, false )
        setElementVisibleTo ( BlipHelicopteros16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaHelicopteros[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerHelicopteros)

function SairDoVeiculoAutoEscolaHelicopteros (source)
if ( AutoEscolaHelicopteros[source] ) and isElement( AutoEscolaHelicopteros[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaHelicopteros[source] )
setElementData ( source, "Carteira:StartHelicopteros00", false )
setElementData ( source, "Carteira:StartHelicopteros01", false )
setElementData ( source, "Carteira:StartHelicopteros02", false )
setElementData ( source, "Carteira:StartHelicopteros03", false )
setElementData ( source, "Carteira:StartHelicopteros04", false )
setElementData ( source, "Carteira:StartHelicopteros05", false )
setElementData ( source, "Carteira:StartHelicopteros06", false )
setElementData ( source, "Carteira:StartHelicopteros07", false )
setElementData ( source, "Carteira:StartHelicopteros08", false )
setElementData ( source, "Carteira:StartHelicopteros09", false )
setElementData ( source, "Carteira:StartHelicopteros10", false )
setElementData ( source, "Carteira:StartHelicopteros11", false )
setElementData ( source, "Carteira:StartHelicopteros12", false )
setElementData ( source, "Carteira:StartHelicopteros13", false )
setElementData ( source, "Carteira:StartHelicopteros14", false )
setElementData ( source, "Carteira:StartHelicopteros15", false )
setElementVisibleTo ( MarkerHelicopteros01, source, false )
setElementVisibleTo ( BlipHelicopteros01, source, false )
setElementVisibleTo ( MarkerHelicopteros02, source, false )
setElementVisibleTo ( BlipHelicopteros02, source, false )
setElementVisibleTo ( MarkerHelicopteros03, source, false )
setElementVisibleTo ( BlipHelicopteros03, source, false )
setElementVisibleTo ( MarkerHelicopteros04, source, false )
setElementVisibleTo ( BlipHelicopteros04, source, false )
setElementVisibleTo ( MarkerHelicopteros05, source, false )
setElementVisibleTo ( BlipHelicopteros05, source, false )
setElementVisibleTo ( MarkerHelicopteros06, source, false )
setElementVisibleTo ( BlipHelicopteros06, source, false )
setElementVisibleTo ( MarkerHelicopteros07, source, false )
setElementVisibleTo ( BlipHelicopteros07, source, false )
setElementVisibleTo ( MarkerHelicopteros08, source, false )
setElementVisibleTo ( BlipHelicopteros08, source, false )
setElementVisibleTo ( MarkerHelicopteros09, source, false )
setElementVisibleTo ( BlipHelicopteros09, source, false )
setElementVisibleTo ( MarkerHelicopteros10, source, false )
setElementVisibleTo ( BlipHelicopteros10, source, false )
setElementVisibleTo ( MarkerHelicopteros11, source, false )
setElementVisibleTo ( BlipHelicopteros11, source, false )
setElementVisibleTo ( MarkerHelicopteros12, source, false )
setElementVisibleTo ( BlipHelicopteros12, source, false )
setElementVisibleTo ( MarkerHelicopteros13, source, false )
setElementVisibleTo ( BlipHelicopteros13, source, false )
setElementVisibleTo ( MarkerHelicopteros14, source, false )
setElementVisibleTo ( BlipHelicopteros14, source, false )
setElementVisibleTo ( MarkerHelicopteros15, source, false )
setElementVisibleTo ( BlipHelicopteros15, source, false )
setElementVisibleTo ( MarkerHelicopteros16, source, false )
setElementVisibleTo ( BlipHelicopteros16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaHelicopteros )

function MorrerAutoEscolaHelicopteros ()
if ( AutoEscolaHelicopteros[source] ) and isElement( AutoEscolaHelicopteros[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaHelicopteros[source] )
setElementData ( source, "Carteira:StartHelicopteros00", false )
setElementData ( source, "Carteira:StartHelicopteros01", false )
setElementData ( source, "Carteira:StartHelicopteros02", false )
setElementData ( source, "Carteira:StartHelicopteros03", false )
setElementData ( source, "Carteira:StartHelicopteros04", false )
setElementData ( source, "Carteira:StartHelicopteros05", false )
setElementData ( source, "Carteira:StartHelicopteros06", false )
setElementData ( source, "Carteira:StartHelicopteros07", false )
setElementData ( source, "Carteira:StartHelicopteros08", false )
setElementData ( source, "Carteira:StartHelicopteros09", false )
setElementData ( source, "Carteira:StartHelicopteros10", false )
setElementData ( source, "Carteira:StartHelicopteros11", false )
setElementData ( source, "Carteira:StartHelicopteros12", false )
setElementData ( source, "Carteira:StartHelicopteros13", false )
setElementData ( source, "Carteira:StartHelicopteros14", false )
setElementData ( source, "Carteira:StartHelicopteros15", false )
setElementVisibleTo ( MarkerHelicopteros01, source, false )
setElementVisibleTo ( BlipHelicopteros01, source, false )
setElementVisibleTo ( MarkerHelicopteros02, source, false )
setElementVisibleTo ( BlipHelicopteros02, source, false )
setElementVisibleTo ( MarkerHelicopteros03, source, false )
setElementVisibleTo ( BlipHelicopteros03, source, false )
setElementVisibleTo ( MarkerHelicopteros04, source, false )
setElementVisibleTo ( BlipHelicopteros04, source, false )
setElementVisibleTo ( MarkerHelicopteros05, source, false )
setElementVisibleTo ( BlipHelicopteros05, source, false )
setElementVisibleTo ( MarkerHelicopteros06, source, false )
setElementVisibleTo ( BlipHelicopteros06, source, false )
setElementVisibleTo ( MarkerHelicopteros07, source, false )
setElementVisibleTo ( BlipHelicopteros07, source, false )
setElementVisibleTo ( MarkerHelicopteros08, source, false )
setElementVisibleTo ( BlipHelicopteros08, source, false )
setElementVisibleTo ( MarkerHelicopteros09, source, false )
setElementVisibleTo ( BlipHelicopteros09, source, false )
setElementVisibleTo ( MarkerHelicopteros10, source, false )
setElementVisibleTo ( BlipHelicopteros10, source, false )
setElementVisibleTo ( MarkerHelicopteros11, source, false )
setElementVisibleTo ( BlipHelicopteros11, source, false )
setElementVisibleTo ( MarkerHelicopteros12, source, false )
setElementVisibleTo ( BlipHelicopteros12, source, false )
setElementVisibleTo ( MarkerHelicopteros13, source, false )
setElementVisibleTo ( BlipHelicopteros13, source, false )
setElementVisibleTo ( MarkerHelicopteros14, source, false )
setElementVisibleTo ( BlipHelicopteros14, source, false )
setElementVisibleTo ( MarkerHelicopteros15, source, false )
setElementVisibleTo ( BlipHelicopteros15, source, false )
setElementVisibleTo ( MarkerHelicopteros16, source, false )
setElementVisibleTo ( BlipHelicopteros16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaHelicopteros )

function SairDoServidorAutoEscolaHelicopteros ( quitType )    
if isElement( AutoEscolaHelicopteros[source] ) then
destroyElement ( AutoEscolaHelicopteros[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaHelicopteros )

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Avioes

AvioesRX, AvioesRY, AvioesRZ           = 390.00958, 2515.68384, 16.48438 -- Coordenadas de Respawn do Aviao
AvioesRotA, AvioesRotB, AvioesRotC     = 0, 0, 90 -- Rotação do Veiculo ao Spawnar
AvioesID                               = 593 -- ID do Aviao
HabValorAvioes                         = 15000 -- Valor da Habilitação Categoria "Avioes"
AvioesDanoParaReprovar                 = 950 -- 95%

MsgAvioes01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgAvioes02 = "Você Não Tem Dinheiro Suficiente!"
MsgAvioes03 = "Você Ja Possui Essa Habilitação!"
MsgAvioes04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgAvioes05 = "Carteira de Habilitação Categoria 'Avioes' Concedida!"
MsgAvioes06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgAvioes07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

AvioesX01, AvioesY01, AvioesZ01 = 327.50638, 2512.08057, 16.56849
AvioesX02, AvioesY02, AvioesZ02 = -27.39510, 2514.81250, 41.52960
AvioesX03, AvioesY03, AvioesZ03 = -235.67519, 2590.04077, 87.09184
AvioesX04, AvioesY04, AvioesZ04 = -403.73294, 2635.43262, 92.30322
AvioesX05, AvioesY05, AvioesZ05 = -584.24835, 2685.85059, 91.69495
AvioesX06, AvioesY06, AvioesZ06 = -767.21533, 2720.34180, 94.28947
AvioesX07, AvioesY07, AvioesZ07 = -964.20673, 2691.60156, 83.17091
AvioesX08, AvioesY08, AvioesZ08 = -991.19080, 2565.01172, 107.92737
AvioesX09, AvioesY09, AvioesZ09 = -968.22424, 2412.37500, 106.02930
AvioesX10, AvioesY10, AvioesZ10 = -938.10565, 2296.36255, 72.00851
AvioesX11, AvioesY11, AvioesZ11 = -715.26495, 2211.76196, 85.63451
AvioesX12, AvioesY12, AvioesZ12 = -430.74518, 2224.39038, 87.41293
AvioesX13, AvioesY13, AvioesZ13 = -200.35358, 2237.01172, 80.83124
AvioesX14, AvioesY14, AvioesZ14 = -24.59806, 2413.50269, 64.73052
AvioesX15, AvioesY15, AvioesZ15 = 114.86245, 2467.75830, 41.54504
AvioesX16, AvioesY16, AvioesZ16 = 318.45193, 2490.21558, 16.48438

MarkerAvioes01 = createMarker ( AvioesX01, AvioesY01, AvioesZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipAvioes01 = createBlipAttachedTo ( MarkerAvioes01, 0 )
setElementVisibleTo ( MarkerAvioes01, root, false )
setElementVisibleTo ( BlipAvioes01, root, false )

MarkerAvioes02 = createMarker ( AvioesX02, AvioesY02, AvioesZ02 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes02 = createBlipAttachedTo ( MarkerAvioes02, 0 )
setElementVisibleTo ( MarkerAvioes02, root, false )
setElementVisibleTo ( BlipAvioes02, root, false )

MarkerAvioes03 = createMarker ( AvioesX03, AvioesY03, AvioesZ03 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes03 = createBlipAttachedTo ( MarkerAvioes03, 0 )
setElementVisibleTo ( MarkerAvioes03, root, false )
setElementVisibleTo ( BlipAvioes03, root, false )

MarkerAvioes04 = createMarker ( AvioesX04, AvioesY04, AvioesZ04 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes04 = createBlipAttachedTo ( MarkerAvioes04, 0 )
setElementVisibleTo ( MarkerAvioes04, root, false )
setElementVisibleTo ( BlipAvioes04, root, false )

MarkerAvioes05 = createMarker ( AvioesX05, AvioesY05, AvioesZ05 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes05 = createBlipAttachedTo ( MarkerAvioes05, 0 )
setElementVisibleTo ( MarkerAvioes05, root, false )
setElementVisibleTo ( BlipAvioes05, root, false )

MarkerAvioes06 = createMarker ( AvioesX06, AvioesY06, AvioesZ06 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes06 = createBlipAttachedTo ( MarkerAvioes06, 0 )
setElementVisibleTo ( MarkerAvioes06, root, false )
setElementVisibleTo ( BlipAvioes06, root, false )

MarkerAvioes07 = createMarker ( AvioesX07, AvioesY07, AvioesZ07 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes07 = createBlipAttachedTo ( MarkerAvioes07, 0 )
setElementVisibleTo ( MarkerAvioes07, root, false )
setElementVisibleTo ( BlipAvioes07, root, false )

MarkerAvioes08 = createMarker ( AvioesX08, AvioesY08, AvioesZ08 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes08 = createBlipAttachedTo ( MarkerAvioes08, 0 )
setElementVisibleTo ( MarkerAvioes08, root, false )
setElementVisibleTo ( BlipAvioes08, root, false )

MarkerAvioes09 = createMarker ( AvioesX09, AvioesY09, AvioesZ09 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes09 = createBlipAttachedTo ( MarkerAvioes09, 0 )
setElementVisibleTo ( MarkerAvioes09, root, false )
setElementVisibleTo ( BlipAvioes09, root, false )

MarkerAvioes10 = createMarker ( AvioesX10, AvioesY10, AvioesZ10 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes10 = createBlipAttachedTo ( MarkerAvioes10, 0 )
setElementVisibleTo ( MarkerAvioes10, root, false )
setElementVisibleTo ( BlipAvioes10, root, false )

MarkerAvioes11 = createMarker ( AvioesX11, AvioesY11, AvioesZ11 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes11 = createBlipAttachedTo ( MarkerAvioes11, 0 )
setElementVisibleTo ( MarkerAvioes11, root, false )
setElementVisibleTo ( BlipAvioes11, root, false )

MarkerAvioes12 = createMarker ( AvioesX12, AvioesY12, AvioesZ12 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes12 = createBlipAttachedTo ( MarkerAvioes12, 0 )
setElementVisibleTo ( MarkerAvioes12, root, false )
setElementVisibleTo ( BlipAvioes12, root, false )

MarkerAvioes13 = createMarker ( AvioesX13, AvioesY13, AvioesZ13 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes13 = createBlipAttachedTo ( MarkerAvioes13, 0 )
setElementVisibleTo ( MarkerAvioes13, root, false )
setElementVisibleTo ( BlipAvioes13, root, false )

MarkerAvioes14 = createMarker ( AvioesX14, AvioesY14, AvioesZ14 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes14 = createBlipAttachedTo ( MarkerAvioes14, 0 )
setElementVisibleTo ( MarkerAvioes14, root, false )
setElementVisibleTo ( BlipAvioes14, root, false )

MarkerAvioes15 = createMarker ( AvioesX15, AvioesY15, AvioesZ15 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes15 = createBlipAttachedTo ( MarkerAvioes15, 0 )
setElementVisibleTo ( MarkerAvioes15, root, false )
setElementVisibleTo ( BlipAvioes15, root, false )

MarkerAvioes16 = createMarker ( AvioesX16, AvioesY16, AvioesZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipAvioes16 = createBlipAttachedTo ( MarkerAvioes16, 0 )
setElementVisibleTo ( MarkerAvioes16, root, false )
setElementVisibleTo ( BlipAvioes16, root, false )

AutoEscolaAvioes = {}

function AvioesHab(entrar)
if getElementData ( source, "PontosNacarteira" ) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Avioes" ) == true then
if getPlayerMoney(source) >= HabValorAvioes then
takePlayerMoney(source, HabValorAvioes)
if AutoEscolaAvioes[source] and isElement( AutoEscolaAvioes[source] ) then destroyElement ( AutoEscolaAvioes[source] )
AutoEscolaAvioes[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaAvioes[source] = createVehicle( AvioesID, AvioesRX, AvioesRY, AvioesRZ )
setElementRotation ( AutoEscolaAvioes[source], AvioesRotA, AvioesRotB, AvioesRotC )
setVehicleLocked ( AutoEscolaAvioes[source], true )
warpPedIntoVehicle ( source, AutoEscolaAvioes[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartAvioes00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerAvioes01, source, true )
setElementVisibleTo ( BlipAvioes01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes03, "warning")
end
end
addEvent("Hab:Aviao", true)
addEventHandler ( "Hab:Aviao", root, AvioesHab)

function emarkerAvioes(marker,md) 
    if (md) then
      if AutoEscolaAvioes[source] and isElement( AutoEscolaAvioes[source] ) then
        if marker == MarkerAvioes01 then
        if getElementData( source, "Carteira:StartAvioes00", true ) then
        setElementVisibleTo ( MarkerAvioes01, source, false )
        setElementVisibleTo ( BlipAvioes01, source, false )
        setElementVisibleTo ( MarkerAvioes02, source, true )
        setElementVisibleTo ( BlipAvioes02, source, true )
        setElementData ( source, "Carteira:StartAvioes01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes02 then
        if getElementData( source, "Carteira:StartAvioes01", true ) then
        setElementVisibleTo ( MarkerAvioes02, source, false )
        setElementVisibleTo ( BlipAvioes02, source, false )
        setElementVisibleTo ( MarkerAvioes03, source, true )
        setElementVisibleTo ( BlipAvioes03, source, true )
        setElementData ( source, "Carteira:StartAvioes02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes03 then
        if getElementData( source, "Carteira:StartAvioes02", true ) then
        setElementVisibleTo ( MarkerAvioes03, source, false )
        setElementVisibleTo ( BlipAvioes03, source, false )
        setElementVisibleTo ( MarkerAvioes04, source, true )
        setElementVisibleTo ( BlipAvioes04, source, true )
        setElementData ( source, "Carteira:StartAvioes03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes04 then
        if getElementData( source, "Carteira:StartAvioes03", true ) then
        setElementVisibleTo ( MarkerAvioes04, source, false )
        setElementVisibleTo ( BlipAvioes04, source, false )
        setElementVisibleTo ( MarkerAvioes05, source, true )
        setElementVisibleTo ( BlipAvioes05, source, true )
        setElementData ( source, "Carteira:StartAvioes04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes05 then
        if getElementData( source, "Carteira:StartAvioes04", true ) then
        setElementVisibleTo ( MarkerAvioes05, source, false )
        setElementVisibleTo ( BlipAvioes05, source, false )
        setElementVisibleTo ( MarkerAvioes06, source, true )
        setElementVisibleTo ( BlipAvioes06, source, true )
        setElementData ( source, "Carteira:StartAvioes05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes06 then
        if getElementData( source, "Carteira:StartAvioes05", true ) then
        setElementVisibleTo ( MarkerAvioes06, source, false )
        setElementVisibleTo ( BlipAvioes06, source, false )
        setElementVisibleTo ( MarkerAvioes07, source, true )
        setElementVisibleTo ( BlipAvioes07, source, true )
        setElementData ( source, "Carteira:StartAvioes06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes07 then
        if getElementData( source, "Carteira:StartAvioes06", true ) then
        setElementVisibleTo ( MarkerAvioes07, source, false )
        setElementVisibleTo ( BlipAvioes07, source, false )
        setElementVisibleTo ( MarkerAvioes08, source, true )
        setElementVisibleTo ( BlipAvioes08, source, true )
        setElementData ( source, "Carteira:StartAvioes07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes08 then
        if getElementData( source, "Carteira:StartAvioes07", true ) then
        setElementVisibleTo ( MarkerAvioes08, source, false )
        setElementVisibleTo ( BlipAvioes08, source, false )
        setElementVisibleTo ( MarkerAvioes09, source, true )
        setElementVisibleTo ( BlipAvioes09, source, true )
        setElementData ( source, "Carteira:StartAvioes08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes09 then
        if getElementData( source, "Carteira:StartAvioes08", true ) then
        setElementVisibleTo ( MarkerAvioes09, source, false )
        setElementVisibleTo ( BlipAvioes09, source, false )
        setElementVisibleTo ( MarkerAvioes10, source, true )
        setElementVisibleTo ( BlipAvioes10, source, true )
        setElementData ( source, "Carteira:StartAvioes09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes10 then
        if getElementData( source, "Carteira:StartAvioes09", true ) then
        setElementVisibleTo ( MarkerAvioes10, source, false )
        setElementVisibleTo ( BlipAvioes10, source, false )
        setElementVisibleTo ( MarkerAvioes11, source, true )
        setElementVisibleTo ( BlipAvioes11, source, true )
        setElementData ( source, "Carteira:StartAvioes10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes11 then
        if getElementData( source, "Carteira:StartAvioes10", true ) then
        setElementVisibleTo ( MarkerAvioes11, source, false )
        setElementVisibleTo ( BlipAvioes11, source, false )
        setElementVisibleTo ( MarkerAvioes12, source, true )
        setElementVisibleTo ( BlipAvioes12, source, true )
        setElementData ( source, "Carteira:StartAvioes11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes12 then
        if getElementData( source, "Carteira:StartAvioes11", true ) then
        setElementVisibleTo ( MarkerAvioes12, source, false )
        setElementVisibleTo ( BlipAvioes12, source, false )
        setElementVisibleTo ( MarkerAvioes13, source, true )
        setElementVisibleTo ( BlipAvioes13, source, true )
        setElementData ( source, "Carteira:StartAvioes12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes13 then
        if getElementData( source, "Carteira:StartAvioes12", true ) then
        setElementVisibleTo ( MarkerAvioes13, source, false )
        setElementVisibleTo ( BlipAvioes13, source, false )
        setElementVisibleTo ( MarkerAvioes14, source, true )
        setElementVisibleTo ( BlipAvioes14, source, true )
        setElementData ( source, "Carteira:StartAvioes13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes14 then
        if getElementData( source, "Carteira:StartAvioes13", true ) then
        setElementVisibleTo ( MarkerAvioes14, source, false )
        setElementVisibleTo ( BlipAvioes14, source, false )
        setElementVisibleTo ( MarkerAvioes15, source, true )
        setElementVisibleTo ( BlipAvioes15, source, true )
        setElementData ( source, "Carteira:StartAvioes14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes15 then
        if getElementData( source, "Carteira:StartAvioes14", true ) then
        setElementVisibleTo ( MarkerAvioes15, source, false )
        setElementVisibleTo ( BlipAvioes15, source, false )
        setElementVisibleTo ( MarkerAvioes16, source, true )
        setElementVisibleTo ( BlipAvioes16, source, true )
        setElementData ( source, "Carteira:StartAvioes15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes16 then
        if getElementData( source, "Carteira:StartAvioes15", true ) then
        AutoEscolaAvioesVida = getElementHealth ( AutoEscolaAvioes[source] )
        if AutoEscolaAvioesVida <= AvioesDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgAvioes04, "error")
        else
        setElementData( source, "Habilitacoes:Avioes", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgAvioes05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes15", false )
        setElementVisibleTo ( MarkerAvioes16, source, false )
        setElementVisibleTo ( BlipAvioes16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaAvioes[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerAvioes)

function SairDoVeiculoAutoEscolaAvioes (source)
if ( AutoEscolaAvioes[source] ) and isElement( AutoEscolaAvioes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaAvioes[source] )
setElementData ( source, "Carteira:StartAvioes00", false )
setElementData ( source, "Carteira:StartAvioes01", false )
setElementData ( source, "Carteira:StartAvioes02", false )
setElementData ( source, "Carteira:StartAvioes03", false )
setElementData ( source, "Carteira:StartAvioes04", false )
setElementData ( source, "Carteira:StartAvioes05", false )
setElementData ( source, "Carteira:StartAvioes06", false )
setElementData ( source, "Carteira:StartAvioes07", false )
setElementData ( source, "Carteira:StartAvioes08", false )
setElementData ( source, "Carteira:StartAvioes09", false )
setElementData ( source, "Carteira:StartAvioes10", false )
setElementData ( source, "Carteira:StartAvioes11", false )
setElementData ( source, "Carteira:StartAvioes12", false )
setElementData ( source, "Carteira:StartAvioes13", false )
setElementData ( source, "Carteira:StartAvioes14", false )
setElementData ( source, "Carteira:StartAvioes15", false )
setElementVisibleTo ( MarkerAvioes01, source, false )
setElementVisibleTo ( BlipAvioes01, source, false )
setElementVisibleTo ( MarkerAvioes02, source, false )
setElementVisibleTo ( BlipAvioes02, source, false )
setElementVisibleTo ( MarkerAvioes03, source, false )
setElementVisibleTo ( BlipAvioes03, source, false )
setElementVisibleTo ( MarkerAvioes04, source, false )
setElementVisibleTo ( BlipAvioes04, source, false )
setElementVisibleTo ( MarkerAvioes05, source, false )
setElementVisibleTo ( BlipAvioes05, source, false )
setElementVisibleTo ( MarkerAvioes06, source, false )
setElementVisibleTo ( BlipAvioes06, source, false )
setElementVisibleTo ( MarkerAvioes07, source, false )
setElementVisibleTo ( BlipAvioes07, source, false )
setElementVisibleTo ( MarkerAvioes08, source, false )
setElementVisibleTo ( BlipAvioes08, source, false )
setElementVisibleTo ( MarkerAvioes09, source, false )
setElementVisibleTo ( BlipAvioes09, source, false )
setElementVisibleTo ( MarkerAvioes10, source, false )
setElementVisibleTo ( BlipAvioes10, source, false )
setElementVisibleTo ( MarkerAvioes11, source, false )
setElementVisibleTo ( BlipAvioes11, source, false )
setElementVisibleTo ( MarkerAvioes12, source, false )
setElementVisibleTo ( BlipAvioes12, source, false )
setElementVisibleTo ( MarkerAvioes13, source, false )
setElementVisibleTo ( BlipAvioes13, source, false )
setElementVisibleTo ( MarkerAvioes14, source, false )
setElementVisibleTo ( BlipAvioes14, source, false )
setElementVisibleTo ( MarkerAvioes15, source, false )
setElementVisibleTo ( BlipAvioes15, source, false )
setElementVisibleTo ( MarkerAvioes16, source, false )
setElementVisibleTo ( BlipAvioes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaAvioes )

function MorrerAutoEscolaAvioes ()
if ( AutoEscolaAvioes[source] ) and isElement( AutoEscolaAvioes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaAvioes[source] )
setElementData ( source, "Carteira:StartAvioes00", false )
setElementData ( source, "Carteira:StartAvioes01", false )
setElementData ( source, "Carteira:StartAvioes02", false )
setElementData ( source, "Carteira:StartAvioes03", false )
setElementData ( source, "Carteira:StartAvioes04", false )
setElementData ( source, "Carteira:StartAvioes05", false )
setElementData ( source, "Carteira:StartAvioes06", false )
setElementData ( source, "Carteira:StartAvioes07", false )
setElementData ( source, "Carteira:StartAvioes08", false )
setElementData ( source, "Carteira:StartAvioes09", false )
setElementData ( source, "Carteira:StartAvioes10", false )
setElementData ( source, "Carteira:StartAvioes11", false )
setElementData ( source, "Carteira:StartAvioes12", false )
setElementData ( source, "Carteira:StartAvioes13", false )
setElementData ( source, "Carteira:StartAvioes14", false )
setElementData ( source, "Carteira:StartAvioes15", false )
setElementVisibleTo ( MarkerAvioes01, source, false )
setElementVisibleTo ( BlipAvioes01, source, false )
setElementVisibleTo ( MarkerAvioes02, source, false )
setElementVisibleTo ( BlipAvioes02, source, false )
setElementVisibleTo ( MarkerAvioes03, source, false )
setElementVisibleTo ( BlipAvioes03, source, false )
setElementVisibleTo ( MarkerAvioes04, source, false )
setElementVisibleTo ( BlipAvioes04, source, false )
setElementVisibleTo ( MarkerAvioes05, source, false )
setElementVisibleTo ( BlipAvioes05, source, false )
setElementVisibleTo ( MarkerAvioes06, source, false )
setElementVisibleTo ( BlipAvioes06, source, false )
setElementVisibleTo ( MarkerAvioes07, source, false )
setElementVisibleTo ( BlipAvioes07, source, false )
setElementVisibleTo ( MarkerAvioes08, source, false )
setElementVisibleTo ( BlipAvioes08, source, false )
setElementVisibleTo ( MarkerAvioes09, source, false )
setElementVisibleTo ( BlipAvioes09, source, false )
setElementVisibleTo ( MarkerAvioes10, source, false )
setElementVisibleTo ( BlipAvioes10, source, false )
setElementVisibleTo ( MarkerAvioes11, source, false )
setElementVisibleTo ( BlipAvioes11, source, false )
setElementVisibleTo ( MarkerAvioes12, source, false )
setElementVisibleTo ( BlipAvioes12, source, false )
setElementVisibleTo ( MarkerAvioes13, source, false )
setElementVisibleTo ( BlipAvioes13, source, false )
setElementVisibleTo ( MarkerAvioes14, source, false )
setElementVisibleTo ( BlipAvioes14, source, false )
setElementVisibleTo ( MarkerAvioes15, source, false )
setElementVisibleTo ( BlipAvioes15, source, false )
setElementVisibleTo ( MarkerAvioes16, source, false )
setElementVisibleTo ( BlipAvioes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaAvioes )

function SairDoServidorAutoEscolaAvioes ( quitType )    
if isElement( AutoEscolaAvioes[source] ) then
destroyElement ( AutoEscolaAvioes[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaAvioes )

--------------------------------------------------------------------------------

function SalvarDadosHab(conta)
    if conta then
    local source = getAccountPlayer(conta)
    local emp = getElementData(source,"Habilitacoes:Motos") or false
    setAccountData (conta, "Habilitacoes:Motos",emp)
    local emp = getElementData(source,"Habilitacoes:Carros") or false
    setAccountData (conta, "Habilitacoes:Carros",emp)
    local emp = getElementData(source,"Habilitacoes:Caminhoes") or false
    setAccountData (conta, "Habilitacoes:Caminhoes",emp)
    local emp = getElementData(source,"Habilitacoes:Onibus") or false
    setAccountData (conta, "Habilitacoes:Onibus",emp)
    local emp = getElementData(source,"Habilitacoes:Carretas") or false
    setAccountData (conta, "Habilitacoes:Carretas",emp)
    local emp = getElementData(source,"Habilitacoes:Barcos") or false
    setAccountData (conta, "Habilitacoes:Barcos",emp)
    local emp = getElementData(source,"Habilitacoes:Helicopteros") or false
    setAccountData (conta, "Habilitacoes:Helicopteros",emp)
    local emp = getElementData(source,"Habilitacoes:Avioes") or false
    setAccountData (conta, "Habilitacoes:Avioes",emp)
    local emp = getElementData ( source,"AirNew:AutoEscola") or false
    setAccountData (conta, "AirNew:AutoEscola", emp)
    end    
end

function CarregarDadosHab(conta)
    if not (isGuestAccount (conta)) then
        if (conta) then    
            local source = getAccountPlayer(conta)    
            local emp = getAccountData(conta,"Habilitacoes:Motos") or false
            setElementData (source, "Habilitacoes:Motos", emp)
            local emp = getAccountData(conta,"Habilitacoes:Carros") or false
            setElementData (source, "Habilitacoes:Carros", emp)
            local emp = getAccountData(conta,"Habilitacoes:Caminhoes") or false
            setElementData (source, "Habilitacoes:Caminhoes", emp)
            local emp = getAccountData(conta,"Habilitacoes:Onibus") or false
            setElementData (source, "Habilitacoes:Onibus", emp)
            local emp = getAccountData(conta,"Habilitacoes:Carretas") or false
            setElementData (source, "Habilitacoes:Carretas", emp)
            local emp = getAccountData(conta,"Habilitacoes:Barcos") or false
            setElementData (source, "Habilitacoes:Barcos", emp)
            local emp = getAccountData(conta,"Habilitacoes:Helicopteros") or false
            setElementData (source, "Habilitacoes:Helicopteros", emp)
            local emp = getAccountData(conta,"Habilitacoes:Avioes") or false
            setElementData (source, "Habilitacoes:Avioes", emp)
            local emp = getAccountData(conta,"AirNew:AutoEscola") or false
            setElementData (source, "AirNew:AutoEscola", emp)
        end
    end    
end

--------------------------------------------------------------------------------

addEventHandler("onPlayerLogin", root,
  function( _, acc )
    setTimer(CarregarDadosHab,1000,1,acc)
  end
)

function startScript ( res )
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                CarregarDadosHab(acc)
            end
        end
    end
end
addEventHandler ( "onResourceStart", getRootElement(), startScript )

function stopScript( res )
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                SalvarDadosHab(acc)
            end
        end
    end
end 
addEventHandler ( "onResourceStop", getRootElement(), stopScript )

function sair ( quitType )
    local acc = getPlayerAccount(source)
    if not (isGuestAccount (acc)) then
        if acc then
            SalvarDadosHab(acc)
        end
    end
end
addEventHandler ( "onPlayerQuit", getRootElement(), sair )

--------------------------------------------------------------------------------

 

 

Edited by Vinicios Pfeil
Link to comment
1 hour ago, DNL291 said:

O erro ocorre sempre nesta verificação:


if getElementData ( source, "PontosNacarteira" ) > 0 then

Talvez isto corrija o aviso:


if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then

 

Olá! Olha na primeira linha a 253 deu certo(habilitação de moto), as outras deu algum problema, inclusive o sistema some.

Link to comment
5 hours ago, DNL291 said:

Mostre o código pra mim ver como você fez.

Spoiler

function reset ( source )
setElementData ( source, "Habilitacoes:Motos", false )
setElementData ( source, "Habilitacoes:Carros", false )
setElementData ( source, "Habilitacoes:Caminhoes", false )
setElementData ( source, "Habilitacoes:Onibus", false )
setElementData ( source, "Habilitacoes:Carretas", false )
setElementData ( source, "Habilitacoes:Barcos", false )
setElementData ( source, "Habilitacoes:Helicopteros", false )
setElementData ( source, "Habilitacoes:Avioes", false )
end
addCommandHandler ( "rs", reset )

function reset2 ( source )
setElementData ( source, "Habilitacoes:Motos", true )
setElementData ( source, "Habilitacoes:Carros", true )
setElementData ( source, "Habilitacoes:Caminhoes", true )
setElementData ( source, "Habilitacoes:Onibus", true )
setElementData ( source, "Habilitacoes:Carretas", true )
setElementData ( source, "Habilitacoes:Barcos", true )
setElementData ( source, "Habilitacoes:Helicopteros", true )
setElementData ( source, "Habilitacoes:Avioes", true )
end
addCommandHandler ( "rs2", reset2 )

--------------------------------------------------------------------------------

-- Config Auto-Escola Geral

Tamanho, R, G, B, Alpha = 1.2, 22, 86, 231, 150

MarkerHab = createMarker( -2033.04480, -117.46468, 1035.17188 -1, "cylinder", Tamanho, 255, 0, 0, Alpha )
setElementInterior ( MarkerHab, 3 )
setElementDimension ( MarkerHab, 10 )

SaidaAutoEscola = createMarker ( -2026.86194, -104.12791, 1035.17188 -1, "cylinder", Tamanho, R, G, B, Alpha )
setElementInterior ( SaidaAutoEscola, 3 )
setElementDimension ( SaidaAutoEscola, 10 )

EntradaSF = createMarker ( -2026.62073, -101.46782, 35.16406 -1, "cylinder", Tamanho, R, G, B, Alpha )
local EntradaSFBlip = createBlipAttachedTo ( EntradaSF, 36 )
setBlipVisibleDistance ( EntradaSFBlip, 150)

EntradaLV = createMarker ( 2634.10547, 1716.65076, 11.02344 -1, "cylinder", Tamanho, R, G, B, Alpha )
local EntradaLVBlip = createBlipAttachedTo ( EntradaLV, 36 )
setBlipVisibleDistance ( EntradaLVBlip, 150)

EntradaLS = createMarker ( 1699.13550, -1667.85620, 20.19406 -1, "cylinder", Tamanho, R, G, B, Alpha )
local EntradaLSBlip = createBlipAttachedTo ( EntradaLS, 36 )
setBlipVisibleDistance ( EntradaLSBlip, 150)

function emarker(marker,md) 
    if (md) then
        if marker == MarkerHab then
            triggerClientEvent (source, "AirNew:AbrirAutoEscola", root )
        end
        if marker == SaidaAutoEscola then
            setTimer ( setElementInterior, 400, 1, source, 0 )
            setTimer ( setElementDimension, 400, 1, source, 0 )
            
            if getElementData ( source, "AirNew:AutoEscola" ) == "SF" then
            setTimer ( setElementPosition, 400, 1, source, -2026.62073, -101.46782 +2, 35.16406 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 0 )
            elseif getElementData ( source, "AirNew:AutoEscola" ) == "LV" then
            setTimer ( setElementPosition, 400, 1, source, 2634.10547 -2, 1716.65076, 11.02344 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 0 )
            elseif getElementData ( source, "AirNew:AutoEscola" ) == "LS" then
            setTimer ( setElementPosition, 400, 1, source, 1699.13550 -2, -1667.85620, 20.19406 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 90 )
            end
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
        if marker == EntradaSF then
            setElementData ( source, "AirNew:AutoEscola", "SF" )
            setTimer ( setElementInterior, 400, 1, source, 3 )
            setTimer ( setElementDimension, 400, 1, source, 10 )
            setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
        if marker == EntradaLV then
            setElementData ( source, "AirNew:AutoEscola", "LV" )
            setTimer ( setElementInterior, 400, 1, source, 3 )
            setTimer ( setElementDimension, 400, 1, source, 10 )
            setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
        if marker == EntradaLS then
            setElementData ( source, "AirNew:AutoEscola", "LS" )
            setTimer ( setElementInterior, 400, 1, source, 3 )
            setTimer ( setElementDimension, 400, 1, source, 10 )
            setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
            setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
            fadeCamera ( source, false, 0.1, 0, 0, 0 )   
            setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
            setTimer ( setCameraTarget, 600, 1, source )
        end
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarker)

function lmarker(marker,md)
    if (md) then
        if marker == MarkerHab then
            triggerClientEvent (source, "AirNew:FecharAutoEscola", root )
        end
    end
end
addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)

MsgMultas = "Pague Suas Multas no Detran (Letra D no Mapa) Para Poder Tirar Suas Habilitações!"

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Moto

MotoRX, MotoRY, MotoRZ       = -2396.43237, -594.70099, 132.64844 -- Coordenadas de Respawn da Moto
MotoRotA, MotoRotB, MotoRotC = 0, 0, 124.86428833008 -- Rotação do Veiculo ao Spawnar
MotoID                       = 522 -- ID da Moto
HabValorMoto                 = 800 -- Valor da Habilitação Categoria "Motos"
MotosDanoParaReprovar        = 950 -- 95%

MsgMoto01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgMoto02 = "Você Não Tem Dinheiro Suficiente!"
MsgMoto03 = "Você Ja Possui Essa Habilitação!"
MsgMoto04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgMoto05 = "Carteira de Habilitação Categoria 'Motos' Concedida!"
MsgMoto06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgMoto07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

MotoX01, MotoY01, MotoZ01 = -2422.07007, -605.07965, 132.56250
MotoX02, MotoY02, MotoZ02 = -2445.08643, -561.66852, 127.07077
MotoX03, MotoY03, MotoZ03 = -2483.30347, -478.62625, 97.87623
MotoX04, MotoY04, MotoZ04 = -2560.02051, -488.40961, 78.45337
MotoX05, MotoY05, MotoZ05 = -2625.70630, -488.14209, 69.72830
MotoX06, MotoY06, MotoZ06 = -2534.92261, -466.62216, 70.20143
MotoX07, MotoY07, MotoZ07 = -2439.25806, -422.37332, 85.08891
MotoX08, MotoY08, MotoZ08 = -2375.37891, -438.73767, 81.99551
MotoX09, MotoY09, MotoZ09 = -2317.64746, -440.15088, 79.54469
MotoX10, MotoY10, MotoZ10 = -2403.41187, -369.33237, 74.28725
MotoX11, MotoY11, MotoZ11 = -2597.68823, -368.77106, 44.60019
MotoX12, MotoY12, MotoZ12 = -2680.39307, -440.12732, 30.35506
MotoX13, MotoY13, MotoZ13 = -2716.07153, -526.10675, 9.80222
MotoX14, MotoY14, MotoZ14 = -2812.60352, -461.69827, 7.03906
MotoX15, MotoY15, MotoZ15 = -2803.00708, -331.57635, 7.03906
MotoX16, MotoY16, MotoZ16 = -2785.26929, -311.93359, 7.03906

MarkerMoto01 = createMarker ( MotoX01, MotoY01, MotoZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto01 = createBlipAttachedTo ( MarkerMoto01, 0 )
setElementVisibleTo ( MarkerMoto01, root, false )
setElementVisibleTo ( BlipMoto01, root, false )

MarkerMoto02 = createMarker ( MotoX02, MotoY02, MotoZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto02 = createBlipAttachedTo ( MarkerMoto02, 0 )
setElementVisibleTo ( MarkerMoto02, root, false )
setElementVisibleTo ( BlipMoto02, root, false )

MarkerMoto03 = createMarker ( MotoX03, MotoY03, MotoZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto03 = createBlipAttachedTo ( MarkerMoto03, 0 )
setElementVisibleTo ( MarkerMoto03, root, false )
setElementVisibleTo ( BlipMoto03, root, false )

MarkerMoto04 = createMarker ( MotoX04, MotoY04, MotoZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto04 = createBlipAttachedTo ( MarkerMoto04, 0 )
setElementVisibleTo ( MarkerMoto04, root, false )
setElementVisibleTo ( BlipMoto04, root, false )

MarkerMoto05 = createMarker ( MotoX05, MotoY05, MotoZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto05 = createBlipAttachedTo ( MarkerMoto05, 0 )
setElementVisibleTo ( MarkerMoto05, root, false )
setElementVisibleTo ( BlipMoto05, root, false )

MarkerMoto06 = createMarker ( MotoX06, MotoY06, MotoZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto06 = createBlipAttachedTo ( MarkerMoto06, 0 )
setElementVisibleTo ( MarkerMoto06, root, false )
setElementVisibleTo ( BlipMoto06, root, false )

MarkerMoto07 = createMarker ( MotoX07, MotoY07, MotoZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto07 = createBlipAttachedTo ( MarkerMoto07, 0 )
setElementVisibleTo ( MarkerMoto07, root, false )
setElementVisibleTo ( BlipMoto07, root, false )

MarkerMoto08 = createMarker ( MotoX08, MotoY08, MotoZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto08 = createBlipAttachedTo ( MarkerMoto08, 0 )
setElementVisibleTo ( MarkerMoto08, root, false )
setElementVisibleTo ( BlipMoto08, root, false )

MarkerMoto09 = createMarker ( MotoX09, MotoY09, MotoZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto09 = createBlipAttachedTo ( MarkerMoto09, 0 )
setElementVisibleTo ( MarkerMoto09, root, false )
setElementVisibleTo ( BlipMoto09, root, false )

MarkerMoto10 = createMarker ( MotoX10, MotoY10, MotoZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto10 = createBlipAttachedTo ( MarkerMoto10, 0 )
setElementVisibleTo ( MarkerMoto10, root, false )
setElementVisibleTo ( BlipMoto10, root, false )

MarkerMoto11 = createMarker ( MotoX11, MotoY11, MotoZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto11 = createBlipAttachedTo ( MarkerMoto11, 0 )
setElementVisibleTo ( MarkerMoto11, root, false )
setElementVisibleTo ( BlipMoto11, root, false )

MarkerMoto12 = createMarker ( MotoX12, MotoY12, MotoZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto12 = createBlipAttachedTo ( MarkerMoto12, 0 )
setElementVisibleTo ( MarkerMoto12, root, false )
setElementVisibleTo ( BlipMoto12, root, false )

MarkerMoto13 = createMarker ( MotoX13, MotoY13, MotoZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto13 = createBlipAttachedTo ( MarkerMoto13, 0 )
setElementVisibleTo ( MarkerMoto13, root, false )
setElementVisibleTo ( BlipMoto13, root, false )

MarkerMoto14 = createMarker ( MotoX14, MotoY14, MotoZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto14 = createBlipAttachedTo ( MarkerMoto14, 0 )
setElementVisibleTo ( MarkerMoto14, root, false )
setElementVisibleTo ( BlipMoto14, root, false )

MarkerMoto15 = createMarker ( MotoX15, MotoY15, MotoZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto15 = createBlipAttachedTo ( MarkerMoto15, 0 )
setElementVisibleTo ( MarkerMoto15, root, false )
setElementVisibleTo ( BlipMoto15, root, false )

MarkerMoto16 = createMarker ( MotoX16, MotoY16, MotoZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipMoto16 = createBlipAttachedTo ( MarkerMoto16, 0 )
setElementVisibleTo ( MarkerMoto16, root, false )
setElementVisibleTo ( BlipMoto16, root, false )

AutoEscolaMoto = {}

function MotosHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Motos" ) == true then
if getPlayerMoney(source) >= HabValorMoto then
takePlayerMoney(source, HabValorMoto)
if AutoEscolaMoto[source] and isElement( AutoEscolaMoto[source] ) then destroyElement ( AutoEscolaMoto[source] )
AutoEscolaMoto[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaMoto[source] = createVehicle( MotoID, MotoRX, MotoRY, MotoRZ )
setElementRotation ( AutoEscolaMoto[source], MotoRotA, MotoRotB, MotoRotC )
setVehicleLocked ( AutoEscolaMoto[source], true )
warpPedIntoVehicle ( source, AutoEscolaMoto[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartMoto00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerMoto01, source, true )
setElementVisibleTo ( BlipMoto01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgMoto01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgMoto02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgMoto03, "warning")
end
end
addEvent("Hab:Moto", true)
addEventHandler ( "Hab:Moto", root, MotosHab)

function emarkerMotos(marker,md) 
    if (md) then
      if AutoEscolaMoto[source] and isElement( AutoEscolaMoto[source] ) then
        if marker == MarkerMoto01 then
        if getElementData( source, "Carteira:StartMoto00", true ) then
        setElementVisibleTo ( MarkerMoto01, source, false )
        setElementVisibleTo ( BlipMoto01, source, false )
        setElementVisibleTo ( MarkerMoto02, source, true )
        setElementVisibleTo ( BlipMoto02, source, true )
        setElementData ( source, "Carteira:StartMoto01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto02 then
        if getElementData( source, "Carteira:StartMoto01", true ) then
        setElementVisibleTo ( MarkerMoto02, source, false )
        setElementVisibleTo ( BlipMoto02, source, false )
        setElementVisibleTo ( MarkerMoto03, source, true )
        setElementVisibleTo ( BlipMoto03, source, true )
        setElementData ( source, "Carteira:StartMoto02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto03 then
        if getElementData( source, "Carteira:StartMoto02", true ) then
        setElementVisibleTo ( MarkerMoto03, source, false )
        setElementVisibleTo ( BlipMoto03, source, false )
        setElementVisibleTo ( MarkerMoto04, source, true )
        setElementVisibleTo ( BlipMoto04, source, true )
        setElementData ( source, "Carteira:StartMoto03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto04 then
        if getElementData( source, "Carteira:StartMoto03", true ) then
        setElementVisibleTo ( MarkerMoto04, source, false )
        setElementVisibleTo ( BlipMoto04, source, false )
        setElementVisibleTo ( MarkerMoto05, source, true )
        setElementVisibleTo ( BlipMoto05, source, true )
        setElementData ( source, "Carteira:StartMoto04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto05 then
        if getElementData( source, "Carteira:StartMoto04", true ) then
        setElementVisibleTo ( MarkerMoto05, source, false )
        setElementVisibleTo ( BlipMoto05, source, false )
        setElementVisibleTo ( MarkerMoto06, source, true )
        setElementVisibleTo ( BlipMoto06, source, true )
        setElementData ( source, "Carteira:StartMoto05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto06 then
        if getElementData( source, "Carteira:StartMoto05", true ) then
        setElementVisibleTo ( MarkerMoto06, source, false )
        setElementVisibleTo ( BlipMoto06, source, false )
        setElementVisibleTo ( MarkerMoto07, source, true )
        setElementVisibleTo ( BlipMoto07, source, true )
        setElementData ( source, "Carteira:StartMoto06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto07 then
        if getElementData( source, "Carteira:StartMoto06", true ) then
        setElementVisibleTo ( MarkerMoto07, source, false )
        setElementVisibleTo ( BlipMoto07, source, false )
        setElementVisibleTo ( MarkerMoto08, source, true )
        setElementVisibleTo ( BlipMoto08, source, true )
        setElementData ( source, "Carteira:StartMoto07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto08 then
        if getElementData( source, "Carteira:StartMoto07", true ) then
        setElementVisibleTo ( MarkerMoto08, source, false )
        setElementVisibleTo ( BlipMoto08, source, false )
        setElementVisibleTo ( MarkerMoto09, source, true )
        setElementVisibleTo ( BlipMoto09, source, true )
        setElementData ( source, "Carteira:StartMoto08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto09 then
        if getElementData( source, "Carteira:StartMoto08", true ) then
        setElementVisibleTo ( MarkerMoto09, source, false )
        setElementVisibleTo ( BlipMoto09, source, false )
        setElementVisibleTo ( MarkerMoto10, source, true )
        setElementVisibleTo ( BlipMoto10, source, true )
        setElementData ( source, "Carteira:StartMoto09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto10 then
        if getElementData( source, "Carteira:StartMoto09", true ) then
        setElementVisibleTo ( MarkerMoto10, source, false )
        setElementVisibleTo ( BlipMoto10, source, false )
        setElementVisibleTo ( MarkerMoto11, source, true )
        setElementVisibleTo ( BlipMoto11, source, true )
        setElementData ( source, "Carteira:StartMoto10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto11 then
        if getElementData( source, "Carteira:StartMoto10", true ) then
        setElementVisibleTo ( MarkerMoto11, source, false )
        setElementVisibleTo ( BlipMoto11, source, false )
        setElementVisibleTo ( MarkerMoto12, source, true )
        setElementVisibleTo ( BlipMoto12, source, true )
        setElementData ( source, "Carteira:StartMoto11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto12 then
        if getElementData( source, "Carteira:StartMoto11", true ) then
        setElementVisibleTo ( MarkerMoto12, source, false )
        setElementVisibleTo ( BlipMoto12, source, false )
        setElementVisibleTo ( MarkerMoto13, source, true )
        setElementVisibleTo ( BlipMoto13, source, true )
        setElementData ( source, "Carteira:StartMoto12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto13 then
        if getElementData( source, "Carteira:StartMoto12", true ) then
        setElementVisibleTo ( MarkerMoto13, source, false )
        setElementVisibleTo ( BlipMoto13, source, false )
        setElementVisibleTo ( MarkerMoto14, source, true )
        setElementVisibleTo ( BlipMoto14, source, true )
        setElementData ( source, "Carteira:StartMoto13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto14 then
        if getElementData( source, "Carteira:StartMoto13", true ) then
        setElementVisibleTo ( MarkerMoto14, source, false )
        setElementVisibleTo ( BlipMoto14, source, false )
        setElementVisibleTo ( MarkerMoto15, source, true )
        setElementVisibleTo ( BlipMoto15, source, true )
        setElementData ( source, "Carteira:StartMoto14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto15 then
        if getElementData( source, "Carteira:StartMoto14", true ) then
        setElementVisibleTo ( MarkerMoto15, source, false )
        setElementVisibleTo ( BlipMoto15, source, false )
        setElementVisibleTo ( MarkerMoto16, source, true )
        setElementVisibleTo ( BlipMoto16, source, true )
        setElementData ( source, "Carteira:StartMoto15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerMoto16 then
        if getElementData( source, "Carteira:StartMoto15", true ) then
        AutoEscolaMotoVida = getElementHealth ( AutoEscolaMoto[source] )
        if AutoEscolaMotoVida <= MotosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgMoto04, "error")
        else
        setElementData( source, "Habilitacoes:Motos", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgMoto05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartMoto15", false )
        setElementVisibleTo ( MarkerMoto16, source, false )
        setElementVisibleTo ( BlipMoto16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaMoto[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerMotos)

function SairDoVeiculoAutoEscolaMoto (source)
if ( AutoEscolaMoto[source] ) and isElement( AutoEscolaMoto[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaMoto[source] )
setElementData ( source, "Carteira:StartMoto00", false )
setElementData ( source, "Carteira:StartMoto01", false )
setElementData ( source, "Carteira:StartMoto02", false )
setElementData ( source, "Carteira:StartMoto03", false )
setElementData ( source, "Carteira:StartMoto04", false )
setElementData ( source, "Carteira:StartMoto05", false )
setElementData ( source, "Carteira:StartMoto06", false )
setElementData ( source, "Carteira:StartMoto07", false )
setElementData ( source, "Carteira:StartMoto08", false )
setElementData ( source, "Carteira:StartMoto09", false )
setElementData ( source, "Carteira:StartMoto10", false )
setElementData ( source, "Carteira:StartMoto11", false )
setElementData ( source, "Carteira:StartMoto12", false )
setElementData ( source, "Carteira:StartMoto13", false )
setElementData ( source, "Carteira:StartMoto14", false )
setElementData ( source, "Carteira:StartMoto15", false )
setElementVisibleTo ( MarkerMoto01, source, false )
setElementVisibleTo ( BlipMoto01, source, false )
setElementVisibleTo ( MarkerMoto02, source, false )
setElementVisibleTo ( BlipMoto02, source, false )
setElementVisibleTo ( MarkerMoto03, source, false )
setElementVisibleTo ( BlipMoto03, source, false )
setElementVisibleTo ( MarkerMoto04, source, false )
setElementVisibleTo ( BlipMoto04, source, false )
setElementVisibleTo ( MarkerMoto05, source, false )
setElementVisibleTo ( BlipMoto05, source, false )
setElementVisibleTo ( MarkerMoto06, source, false )
setElementVisibleTo ( BlipMoto06, source, false )
setElementVisibleTo ( MarkerMoto07, source, false )
setElementVisibleTo ( BlipMoto07, source, false )
setElementVisibleTo ( MarkerMoto08, source, false )
setElementVisibleTo ( BlipMoto08, source, false )
setElementVisibleTo ( MarkerMoto09, source, false )
setElementVisibleTo ( BlipMoto09, source, false )
setElementVisibleTo ( MarkerMoto10, source, false )
setElementVisibleTo ( BlipMoto10, source, false )
setElementVisibleTo ( MarkerMoto11, source, false )
setElementVisibleTo ( BlipMoto11, source, false )
setElementVisibleTo ( MarkerMoto12, source, false )
setElementVisibleTo ( BlipMoto12, source, false )
setElementVisibleTo ( MarkerMoto13, source, false )
setElementVisibleTo ( BlipMoto13, source, false )
setElementVisibleTo ( MarkerMoto14, source, false )
setElementVisibleTo ( BlipMoto14, source, false )
setElementVisibleTo ( MarkerMoto15, source, false )
setElementVisibleTo ( BlipMoto15, source, false )
setElementVisibleTo ( MarkerMoto16, source, false )
setElementVisibleTo ( BlipMoto16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgMoto06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaMoto )

function MorrerAutoEscolaMoto ()
if ( AutoEscolaMoto[source] ) and isElement( AutoEscolaMoto[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaMoto[source] )
setElementData ( source, "Carteira:StartMoto00", false )
setElementData ( source, "Carteira:StartMoto01", false )
setElementData ( source, "Carteira:StartMoto02", false )
setElementData ( source, "Carteira:StartMoto03", false )
setElementData ( source, "Carteira:StartMoto04", false )
setElementData ( source, "Carteira:StartMoto05", false )
setElementData ( source, "Carteira:StartMoto06", false )
setElementData ( source, "Carteira:StartMoto07", false )
setElementData ( source, "Carteira:StartMoto08", false )
setElementData ( source, "Carteira:StartMoto09", false )
setElementData ( source, "Carteira:StartMoto10", false )
setElementData ( source, "Carteira:StartMoto11", false )
setElementData ( source, "Carteira:StartMoto12", false )
setElementData ( source, "Carteira:StartMoto13", false )
setElementData ( source, "Carteira:StartMoto14", false )
setElementData ( source, "Carteira:StartMoto15", false )
setElementVisibleTo ( MarkerMoto01, source, false )
setElementVisibleTo ( BlipMoto01, source, false )
setElementVisibleTo ( MarkerMoto02, source, false )
setElementVisibleTo ( BlipMoto02, source, false )
setElementVisibleTo ( MarkerMoto03, source, false )
setElementVisibleTo ( BlipMoto03, source, false )
setElementVisibleTo ( MarkerMoto04, source, false )
setElementVisibleTo ( BlipMoto04, source, false )
setElementVisibleTo ( MarkerMoto05, source, false )
setElementVisibleTo ( BlipMoto05, source, false )
setElementVisibleTo ( MarkerMoto06, source, false )
setElementVisibleTo ( BlipMoto06, source, false )
setElementVisibleTo ( MarkerMoto07, source, false )
setElementVisibleTo ( BlipMoto07, source, false )
setElementVisibleTo ( MarkerMoto08, source, false )
setElementVisibleTo ( BlipMoto08, source, false )
setElementVisibleTo ( MarkerMoto09, source, false )
setElementVisibleTo ( BlipMoto09, source, false )
setElementVisibleTo ( MarkerMoto10, source, false )
setElementVisibleTo ( BlipMoto10, source, false )
setElementVisibleTo ( MarkerMoto11, source, false )
setElementVisibleTo ( BlipMoto11, source, false )
setElementVisibleTo ( MarkerMoto12, source, false )
setElementVisibleTo ( BlipMoto12, source, false )
setElementVisibleTo ( MarkerMoto13, source, false )
setElementVisibleTo ( BlipMoto13, source, false )
setElementVisibleTo ( MarkerMoto14, source, false )
setElementVisibleTo ( BlipMoto14, source, false )
setElementVisibleTo ( MarkerMoto15, source, false )
setElementVisibleTo ( BlipMoto15, source, false )
setElementVisibleTo ( MarkerMoto16, source, false )
setElementVisibleTo ( BlipMoto16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgMoto07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaMoto )

function SairDoServidorAutoEscolaMoto ( quitType )    
if isElement( AutoEscolaMoto[source] ) then
destroyElement ( AutoEscolaMoto[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaMoto )

-- ( Final ) Percurso de Moto

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Carro

CarroRX, CarroRY, CarroRZ       = -270.44916, 1547.39783, 75.35938 -- Coordenadas de Respawn do Carro
CarroRotA, CarroRotB, CarroRotC = 0, 0, 135.25268554688 -- Rotação do Veiculo ao Spawnar
CarroID                         = 516 -- ID do Carro
HabValorCarro                   = 1000 -- Valor da Habilitação Categoria "Carros"
CarrosDanoParaReprovar          = 950 -- 95%

MsgCarro01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCarro02 = "Você Não Tem Dinheiro Suficiente!"
MsgCarro03 = "Você Ja Possui Essa Habilitação!"
MsgCarro04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCarro05 = "Carteira de Habilitação Categoria 'Carros' Concedida!"
MsgCarro06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCarro07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CarroX01, CarroY01, CarroZ01 = -304.31372, 1497.35303, 75.67019
CarroX02, CarroY02, CarroZ02 = -297.91571, 1412.75647, 72.31325
CarroX03, CarroY03, CarroZ03 = -358.71982, 1398.42810, 58.37130
CarroX04, CarroY04, CarroZ04 = -383.39719, 1397.47485, 42.07113
CarroX05, CarroY05, CarroZ05 = -453.04425, 1579.76025, 36.17015
CarroX06, CarroY06, CarroZ06 = -403.00198, 1714.00647, 40.57639
CarroX07, CarroY07, CarroZ07 = -388.58905, 1880.69397, 55.31573
CarroX08, CarroY08, CarroZ08 = -429.19666, 1818.11926, 67.87206
CarroX09, CarroY09, CarroZ09 = -468.87231, 1869.95264, 82.43024
CarroX10, CarroY10, CarroZ10 = -397.42804, 2034.05908, 65.20287
CarroX11, CarroY11, CarroZ11 = -458.04187, 2028.86401, 60.53470
CarroX12, CarroY12, CarroZ12 = -541.70868, 2008.56213, 60.21884
CarroX13, CarroY13, CarroZ13 = -652.17749, 2064.89575, 60.21832
CarroX14, CarroY14, CarroZ14 = -757.40155, 2064.42749, 60.22342
CarroX15, CarroY15, CarroZ15 = -851.88013, 2019.84998, 60.22160
CarroX16, CarroY16, CarroZ16 = -912.48688, 2008.76563, 60.94514

MarkerCarro01 = createMarker ( CarroX01, CarroY01, CarroZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro01 = createBlipAttachedTo ( MarkerCarro01, 0 )
setElementVisibleTo ( MarkerCarro01, root, false )
setElementVisibleTo ( BlipCarro01, root, false )

MarkerCarro02 = createMarker ( CarroX02, CarroY02, CarroZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro02 = createBlipAttachedTo ( MarkerCarro02, 0 )
setElementVisibleTo ( MarkerCarro02, root, false )
setElementVisibleTo ( BlipCarro02, root, false )

MarkerCarro03 = createMarker ( CarroX03, CarroY03, CarroZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro03 = createBlipAttachedTo ( MarkerCarro03, 0 )
setElementVisibleTo ( MarkerCarro03, root, false )
setElementVisibleTo ( BlipCarro03, root, false )

MarkerCarro04 = createMarker ( CarroX04, CarroY04, CarroZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro04 = createBlipAttachedTo ( MarkerCarro04, 0 )
setElementVisibleTo ( MarkerCarro04, root, false )
setElementVisibleTo ( BlipCarro04, root, false )

MarkerCarro05 = createMarker ( CarroX05, CarroY05, CarroZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro05 = createBlipAttachedTo ( MarkerCarro05, 0 )
setElementVisibleTo ( MarkerCarro05, root, false )
setElementVisibleTo ( BlipCarro05, root, false )

MarkerCarro06 = createMarker ( CarroX06, CarroY06, CarroZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro06 = createBlipAttachedTo ( MarkerCarro06, 0 )
setElementVisibleTo ( MarkerCarro06, root, false )
setElementVisibleTo ( BlipCarro06, root, false )

MarkerCarro07 = createMarker ( CarroX07, CarroY07, CarroZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro07 = createBlipAttachedTo ( MarkerCarro07, 0 )
setElementVisibleTo ( MarkerCarro07, root, false )
setElementVisibleTo ( BlipCarro07, root, false )

MarkerCarro08 = createMarker ( CarroX08, CarroY08, CarroZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro08 = createBlipAttachedTo ( MarkerCarro08, 0 )
setElementVisibleTo ( MarkerCarro08, root, false )
setElementVisibleTo ( BlipCarro08, root, false )

MarkerCarro09 = createMarker ( CarroX09, CarroY09, CarroZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro09 = createBlipAttachedTo ( MarkerCarro09, 0 )
setElementVisibleTo ( MarkerCarro09, root, false )
setElementVisibleTo ( BlipCarro09, root, false )

MarkerCarro10 = createMarker ( CarroX10, CarroY10, CarroZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro10 = createBlipAttachedTo ( MarkerCarro10, 0 )
setElementVisibleTo ( MarkerCarro10, root, false )
setElementVisibleTo ( BlipCarro10, root, false )

MarkerCarro11 = createMarker ( CarroX11, CarroY11, CarroZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro11 = createBlipAttachedTo ( MarkerCarro11, 0 )
setElementVisibleTo ( MarkerCarro11, root, false )
setElementVisibleTo ( BlipCarro11, root, false )

MarkerCarro12 = createMarker ( CarroX12, CarroY12, CarroZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro12 = createBlipAttachedTo ( MarkerCarro12, 0 )
setElementVisibleTo ( MarkerCarro12, root, false )
setElementVisibleTo ( BlipCarro12, root, false )

MarkerCarro13 = createMarker ( CarroX13, CarroY13, CarroZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro13 = createBlipAttachedTo ( MarkerCarro13, 0 )
setElementVisibleTo ( MarkerCarro13, root, false )
setElementVisibleTo ( BlipCarro13, root, false )

MarkerCarro14 = createMarker ( CarroX14, CarroY14, CarroZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro14 = createBlipAttachedTo ( MarkerCarro14, 0 )
setElementVisibleTo ( MarkerCarro14, root, false )
setElementVisibleTo ( BlipCarro14, root, false )

MarkerCarro15 = createMarker ( CarroX15, CarroY15, CarroZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro15 = createBlipAttachedTo ( MarkerCarro15, 0 )
setElementVisibleTo ( MarkerCarro15, root, false )
setElementVisibleTo ( BlipCarro15, root, false )

MarkerCarro16 = createMarker ( CarroX16, CarroY16, CarroZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro16 = createBlipAttachedTo ( MarkerCarro16, 0 )
setElementVisibleTo ( MarkerCarro16, root, false )
setElementVisibleTo ( BlipCarro16, root, false )

AutoEscolaCarro = {}

function CarrosHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Carros" ) == true then
if getPlayerMoney(source) >= HabValorCarro then
takePlayerMoney(source, HabValorCarro)
if AutoEscolaCarro[source] and isElement( AutoEscolaCarro[source] ) then destroyElement ( AutoEscolaCarro[source] )
AutoEscolaCarro[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCarro[source] = createVehicle( CarroID, CarroRX, CarroRY, CarroRZ )
setElementRotation ( AutoEscolaCarro[source], CarroRotA, CarroRotB, CarroRotC )
setVehicleLocked ( AutoEscolaCarro[source], true )
warpPedIntoVehicle ( source, AutoEscolaCarro[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCarro00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCarro01, source, true )
setElementVisibleTo ( BlipCarro01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarro02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarro03, "warning")
end
end
addEvent("Hab:Carro", true)
addEventHandler ( "Hab:Carro", root, CarrosHab)

function emarkerCarros(marker,md) 
    if (md) then
      if AutoEscolaCarro[source] and isElement( AutoEscolaCarro[source] ) then
        if marker == MarkerCarro01 then
        if getElementData( source, "Carteira:StartCarro00", true ) then
        setElementVisibleTo ( MarkerCarro01, source, false )
        setElementVisibleTo ( BlipCarro01, source, false )
        setElementVisibleTo ( MarkerCarro02, source, true )
        setElementVisibleTo ( BlipCarro02, source, true )
        setElementData ( source, "Carteira:StartCarro01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro02 then
        if getElementData( source, "Carteira:StartCarro01", true ) then
        setElementVisibleTo ( MarkerCarro02, source, false )
        setElementVisibleTo ( BlipCarro02, source, false )
        setElementVisibleTo ( MarkerCarro03, source, true )
        setElementVisibleTo ( BlipCarro03, source, true )
        setElementData ( source, "Carteira:StartCarro02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro03 then
        if getElementData( source, "Carteira:StartCarro02", true ) then
        setElementVisibleTo ( MarkerCarro03, source, false )
        setElementVisibleTo ( BlipCarro03, source, false )
        setElementVisibleTo ( MarkerCarro04, source, true )
        setElementVisibleTo ( BlipCarro04, source, true )
        setElementData ( source, "Carteira:StartCarro03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro04 then
        if getElementData( source, "Carteira:StartCarro03", true ) then
        setElementVisibleTo ( MarkerCarro04, source, false )
        setElementVisibleTo ( BlipCarro04, source, false )
        setElementVisibleTo ( MarkerCarro05, source, true )
        setElementVisibleTo ( BlipCarro05, source, true )
        setElementData ( source, "Carteira:StartCarro04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro05 then
        if getElementData( source, "Carteira:StartCarro04", true ) then
        setElementVisibleTo ( MarkerCarro05, source, false )
        setElementVisibleTo ( BlipCarro05, source, false )
        setElementVisibleTo ( MarkerCarro06, source, true )
        setElementVisibleTo ( BlipCarro06, source, true )
        setElementData ( source, "Carteira:StartCarro05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro06 then
        if getElementData( source, "Carteira:StartCarro05", true ) then
        setElementVisibleTo ( MarkerCarro06, source, false )
        setElementVisibleTo ( BlipCarro06, source, false )
        setElementVisibleTo ( MarkerCarro07, source, true )
        setElementVisibleTo ( BlipCarro07, source, true )
        setElementData ( source, "Carteira:StartCarro06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro07 then
        if getElementData( source, "Carteira:StartCarro06", true ) then
        setElementVisibleTo ( MarkerCarro07, source, false )
        setElementVisibleTo ( BlipCarro07, source, false )
        setElementVisibleTo ( MarkerCarro08, source, true )
        setElementVisibleTo ( BlipCarro08, source, true )
        setElementData ( source, "Carteira:StartCarro07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro08 then
        if getElementData( source, "Carteira:StartCarro07", true ) then
        setElementVisibleTo ( MarkerCarro08, source, false )
        setElementVisibleTo ( BlipCarro08, source, false )
        setElementVisibleTo ( MarkerCarro09, source, true )
        setElementVisibleTo ( BlipCarro09, source, true )
        setElementData ( source, "Carteira:StartCarro08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro09 then
        if getElementData( source, "Carteira:StartCarro08", true ) then
        setElementVisibleTo ( MarkerCarro09, source, false )
        setElementVisibleTo ( BlipCarro09, source, false )
        setElementVisibleTo ( MarkerCarro10, source, true )
        setElementVisibleTo ( BlipCarro10, source, true )
        setElementData ( source, "Carteira:StartCarro09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro10 then
        if getElementData( source, "Carteira:StartCarro09", true ) then
        setElementVisibleTo ( MarkerCarro10, source, false )
        setElementVisibleTo ( BlipCarro10, source, false )
        setElementVisibleTo ( MarkerCarro11, source, true )
        setElementVisibleTo ( BlipCarro11, source, true )
        setElementData ( source, "Carteira:StartCarro10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro11 then
        if getElementData( source, "Carteira:StartCarro10", true ) then
        setElementVisibleTo ( MarkerCarro11, source, false )
        setElementVisibleTo ( BlipCarro11, source, false )
        setElementVisibleTo ( MarkerCarro12, source, true )
        setElementVisibleTo ( BlipCarro12, source, true )
        setElementData ( source, "Carteira:StartCarro11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro12 then
        if getElementData( source, "Carteira:StartCarro11", true ) then
        setElementVisibleTo ( MarkerCarro12, source, false )
        setElementVisibleTo ( BlipCarro12, source, false )
        setElementVisibleTo ( MarkerCarro13, source, true )
        setElementVisibleTo ( BlipCarro13, source, true )
        setElementData ( source, "Carteira:StartCarro12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro13 then
        if getElementData( source, "Carteira:StartCarro12", true ) then
        setElementVisibleTo ( MarkerCarro13, source, false )
        setElementVisibleTo ( BlipCarro13, source, false )
        setElementVisibleTo ( MarkerCarro14, source, true )
        setElementVisibleTo ( BlipCarro14, source, true )
        setElementData ( source, "Carteira:StartCarro13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro14 then
        if getElementData( source, "Carteira:StartCarro13", true ) then
        setElementVisibleTo ( MarkerCarro14, source, false )
        setElementVisibleTo ( BlipCarro14, source, false )
        setElementVisibleTo ( MarkerCarro15, source, true )
        setElementVisibleTo ( BlipCarro15, source, true )
        setElementData ( source, "Carteira:StartCarro14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro15 then
        if getElementData( source, "Carteira:StartCarro14", true ) then
        setElementVisibleTo ( MarkerCarro15, source, false )
        setElementVisibleTo ( BlipCarro15, source, false )
        setElementVisibleTo ( MarkerCarro16, source, true )
        setElementVisibleTo ( BlipCarro16, source, true )
        setElementData ( source, "Carteira:StartCarro15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarro16 then
        if getElementData( source, "Carteira:StartCarro15", true ) then
        AutoEscolaCarroVida = getElementHealth ( AutoEscolaCarro[source] )
        if AutoEscolaCarroVida <= CarrosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgCarro04, "error")
        else
        setElementData( source, "Habilitacoes:Carros", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgCarro05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro15", false )
        setElementVisibleTo ( MarkerCarro16, source, false )
        setElementVisibleTo ( BlipCarro16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaCarro[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCarros)

function SairDoVeiculoAutoEscolaCarro (source)
if ( AutoEscolaCarro[source] ) and isElement( AutoEscolaCarro[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarro[source] )
setElementData ( source, "Carteira:StartCarro00", false )
setElementData ( source, "Carteira:StartCarro01", false )
setElementData ( source, "Carteira:StartCarro02", false )
setElementData ( source, "Carteira:StartCarro03", false )
setElementData ( source, "Carteira:StartCarro04", false )
setElementData ( source, "Carteira:StartCarro05", false )
setElementData ( source, "Carteira:StartCarro06", false )
setElementData ( source, "Carteira:StartCarro07", false )
setElementData ( source, "Carteira:StartCarro08", false )
setElementData ( source, "Carteira:StartCarro09", false )
setElementData ( source, "Carteira:StartCarro10", false )
setElementData ( source, "Carteira:StartCarro11", false )
setElementData ( source, "Carteira:StartCarro12", false )
setElementData ( source, "Carteira:StartCarro13", false )
setElementData ( source, "Carteira:StartCarro14", false )
setElementData ( source, "Carteira:StartCarro15", false )
setElementVisibleTo ( MarkerCarro01, source, false )
setElementVisibleTo ( BlipCarro01, source, false )
setElementVisibleTo ( MarkerCarro02, source, false )
setElementVisibleTo ( BlipCarro02, source, false )
setElementVisibleTo ( MarkerCarro03, source, false )
setElementVisibleTo ( BlipCarro03, source, false )
setElementVisibleTo ( MarkerCarro04, source, false )
setElementVisibleTo ( BlipCarro04, source, false )
setElementVisibleTo ( MarkerCarro05, source, false )
setElementVisibleTo ( BlipCarro05, source, false )
setElementVisibleTo ( MarkerCarro06, source, false )
setElementVisibleTo ( BlipCarro06, source, false )
setElementVisibleTo ( MarkerCarro07, source, false )
setElementVisibleTo ( BlipCarro07, source, false )
setElementVisibleTo ( MarkerCarro08, source, false )
setElementVisibleTo ( BlipCarro08, source, false )
setElementVisibleTo ( MarkerCarro09, source, false )
setElementVisibleTo ( BlipCarro09, source, false )
setElementVisibleTo ( MarkerCarro10, source, false )
setElementVisibleTo ( BlipCarro10, source, false )
setElementVisibleTo ( MarkerCarro11, source, false )
setElementVisibleTo ( BlipCarro11, source, false )
setElementVisibleTo ( MarkerCarro12, source, false )
setElementVisibleTo ( BlipCarro12, source, false )
setElementVisibleTo ( MarkerCarro13, source, false )
setElementVisibleTo ( BlipCarro13, source, false )
setElementVisibleTo ( MarkerCarro14, source, false )
setElementVisibleTo ( BlipCarro14, source, false )
setElementVisibleTo ( MarkerCarro15, source, false )
setElementVisibleTo ( BlipCarro15, source, false )
setElementVisibleTo ( MarkerCarro16, source, false )
setElementVisibleTo ( BlipCarro16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCarro )

function MorrerAutoEscolaCarro ()
if ( AutoEscolaCarro[source] ) and isElement( AutoEscolaCarro[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarro[source] )
setElementData ( source, "Carteira:StartCarro00", false )
setElementData ( source, "Carteira:StartCarro01", false )
setElementData ( source, "Carteira:StartCarro02", false )
setElementData ( source, "Carteira:StartCarro03", false )
setElementData ( source, "Carteira:StartCarro04", false )
setElementData ( source, "Carteira:StartCarro05", false )
setElementData ( source, "Carteira:StartCarro06", false )
setElementData ( source, "Carteira:StartCarro07", false )
setElementData ( source, "Carteira:StartCarro08", false )
setElementData ( source, "Carteira:StartCarro09", false )
setElementData ( source, "Carteira:StartCarro10", false )
setElementData ( source, "Carteira:StartCarro11", false )
setElementData ( source, "Carteira:StartCarro12", false )
setElementData ( source, "Carteira:StartCarro13", false )
setElementData ( source, "Carteira:StartCarro14", false )
setElementData ( source, "Carteira:StartCarro15", false )
setElementVisibleTo ( MarkerCarro01, source, false )
setElementVisibleTo ( BlipCarro01, source, false )
setElementVisibleTo ( MarkerCarro02, source, false )
setElementVisibleTo ( BlipCarro02, source, false )
setElementVisibleTo ( MarkerCarro03, source, false )
setElementVisibleTo ( BlipCarro03, source, false )
setElementVisibleTo ( MarkerCarro04, source, false )
setElementVisibleTo ( BlipCarro04, source, false )
setElementVisibleTo ( MarkerCarro05, source, false )
setElementVisibleTo ( BlipCarro05, source, false )
setElementVisibleTo ( MarkerCarro06, source, false )
setElementVisibleTo ( BlipCarro06, source, false )
setElementVisibleTo ( MarkerCarro07, source, false )
setElementVisibleTo ( BlipCarro07, source, false )
setElementVisibleTo ( MarkerCarro08, source, false )
setElementVisibleTo ( BlipCarro08, source, false )
setElementVisibleTo ( MarkerCarro09, source, false )
setElementVisibleTo ( BlipCarro09, source, false )
setElementVisibleTo ( MarkerCarro10, source, false )
setElementVisibleTo ( BlipCarro10, source, false )
setElementVisibleTo ( MarkerCarro11, source, false )
setElementVisibleTo ( BlipCarro11, source, false )
setElementVisibleTo ( MarkerCarro12, source, false )
setElementVisibleTo ( BlipCarro12, source, false )
setElementVisibleTo ( MarkerCarro13, source, false )
setElementVisibleTo ( BlipCarro13, source, false )
setElementVisibleTo ( MarkerCarro14, source, false )
setElementVisibleTo ( BlipCarro14, source, false )
setElementVisibleTo ( MarkerCarro15, source, false )
setElementVisibleTo ( BlipCarro15, source, false )
setElementVisibleTo ( MarkerCarro16, source, false )
setElementVisibleTo ( BlipCarro16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCarro )

function SairDoServidorAutoEscolaCarro ( quitType )    
if isElement( AutoEscolaCarro[source] ) then
destroyElement ( AutoEscolaCarro[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCarro )

-- ( Final ) Percurso de Carro

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Caminhoes

CaminhoesRX, CaminhoesRY, CaminhoesRZ       = -186.86996, -282.80127, 2 -- Coordenadas de Respawn do Caminhão
CaminhoesRotA, CaminhoesRotB, CaminhoesRotC = 0, 0, 89.390258789062 -- Rotação do Veiculo ao Spawnar
CaminhoesID                                 = 578 -- ID do Caminhão
HabValorCaminhoes                           = 1200 -- Valor da Habilitação Categoria "Caminhoes"
CaminhoesDanoParaReprovar                   = 950 -- 95%

MsgCaminhoes01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCaminhoes02 = "Você Não Tem Dinheiro Suficiente!"
MsgCaminhoes03 = "Você Ja Possui Essa Habilitação!"
MsgCaminhoes04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCaminhoes05 = "Carteira de Habilitação Categoria 'Caminhões' Concedida!"
MsgCaminhoes06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCaminhoes07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CaminhoesX01, CaminhoesY01, CaminhoesZ01 = -363.84027, -259.21094, 18.09703
CaminhoesX02, CaminhoesY02, CaminhoesZ02 = -622.80951, -239.56918, 63.33517
CaminhoesX03, CaminhoesY03, CaminhoesZ03 = -834.09595, -244.60388, 39.88686
CaminhoesX04, CaminhoesY04, CaminhoesZ04 = -922.18018, -161.59911, 51.42817
CaminhoesX05, CaminhoesY05, CaminhoesZ05 = -729.85437, -81.97001, 68.00546
CaminhoesX06, CaminhoesY06, CaminhoesZ06 = -704.71832, 14.58052, 63.10910
CaminhoesX07, CaminhoesY07, CaminhoesZ07 = -883.24341, -35.44294, 33.93914
CaminhoesX08, CaminhoesY08, CaminhoesZ08 = -701.52087, 117.37077, 17.28315
CaminhoesX09, CaminhoesY09, CaminhoesZ09 = -612.81458, 272.79623, 2.11294
CaminhoesX10, CaminhoesY10, CaminhoesZ10 = -454.35080, 279.44788, 2.12201
CaminhoesX11, CaminhoesY11, CaminhoesZ11 = -282.21484, 256.32724, 5.90919
CaminhoesX12, CaminhoesY12, CaminhoesZ12 = -52.85775, 186.78911, 2.11299
CaminhoesX13, CaminhoesY13, CaminhoesZ13 = 148.15988, 70.31498, 2.10743
CaminhoesX14, CaminhoesY14, CaminhoesZ14 = 230.43140, -11.07954, 1.54030
CaminhoesX15, CaminhoesY15, CaminhoesZ15 = 280.68811, -74.20872, 1.46440
CaminhoesX16, CaminhoesY16, CaminhoesZ16 = 319.41028, -53.83272, 1.60561

MarkerCaminhoes01 = createMarker ( CaminhoesX01, CaminhoesY01, CaminhoesZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes01 = createBlipAttachedTo ( MarkerCaminhoes01, 0 )
setElementVisibleTo ( MarkerCaminhoes01, root, false )
setElementVisibleTo ( BlipCaminhoes01, root, false )

MarkerCaminhoes02 = createMarker ( CaminhoesX02, CaminhoesY02, CaminhoesZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes02 = createBlipAttachedTo ( MarkerCaminhoes02, 0 )
setElementVisibleTo ( MarkerCaminhoes02, root, false )
setElementVisibleTo ( BlipCaminhoes02, root, false )

MarkerCaminhoes03 = createMarker ( CaminhoesX03, CaminhoesY03, CaminhoesZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes03 = createBlipAttachedTo ( MarkerCaminhoes03, 0 )
setElementVisibleTo ( MarkerCaminhoes03, root, false )
setElementVisibleTo ( BlipCaminhoes03, root, false )

MarkerCaminhoes04 = createMarker ( CaminhoesX04, CaminhoesY04, CaminhoesZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes04 = createBlipAttachedTo ( MarkerCaminhoes04, 0 )
setElementVisibleTo ( MarkerCaminhoes04, root, false )
setElementVisibleTo ( BlipCaminhoes04, root, false )

MarkerCaminhoes05 = createMarker ( CaminhoesX05, CaminhoesY05, CaminhoesZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes05 = createBlipAttachedTo ( MarkerCaminhoes05, 0 )
setElementVisibleTo ( MarkerCaminhoes05, root, false )
setElementVisibleTo ( BlipCaminhoes05, root, false )

MarkerCaminhoes06 = createMarker ( CaminhoesX06, CaminhoesY06, CaminhoesZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes06 = createBlipAttachedTo ( MarkerCaminhoes06, 0 )
setElementVisibleTo ( MarkerCaminhoes06, root, false )
setElementVisibleTo ( BlipCaminhoes06, root, false )

MarkerCaminhoes07 = createMarker ( CaminhoesX07, CaminhoesY07, CaminhoesZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes07 = createBlipAttachedTo ( MarkerCaminhoes07, 0 )
setElementVisibleTo ( MarkerCaminhoes07, root, false )
setElementVisibleTo ( BlipCaminhoes07, root, false )

MarkerCaminhoes08 = createMarker ( CaminhoesX08, CaminhoesY08, CaminhoesZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes08 = createBlipAttachedTo ( MarkerCaminhoes08, 0 )
setElementVisibleTo ( MarkerCaminhoes08, root, false )
setElementVisibleTo ( BlipCaminhoes08, root, false )

MarkerCaminhoes09 = createMarker ( CaminhoesX09, CaminhoesY09, CaminhoesZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes09 = createBlipAttachedTo ( MarkerCaminhoes09, 0 )
setElementVisibleTo ( MarkerCaminhoes09, root, false )
setElementVisibleTo ( BlipCaminhoes09, root, false )

MarkerCaminhoes10 = createMarker ( CaminhoesX10, CaminhoesY10, CaminhoesZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes10 = createBlipAttachedTo ( MarkerCaminhoes10, 0 )
setElementVisibleTo ( MarkerCaminhoes10, root, false )
setElementVisibleTo ( BlipCaminhoes10, root, false )

MarkerCaminhoes11 = createMarker ( CaminhoesX11, CaminhoesY11, CaminhoesZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes11 = createBlipAttachedTo ( MarkerCaminhoes11, 0 )
setElementVisibleTo ( MarkerCaminhoes11, root, false )
setElementVisibleTo ( BlipCaminhoes11, root, false )

MarkerCaminhoes12 = createMarker ( CaminhoesX12, CaminhoesY12, CaminhoesZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes12 = createBlipAttachedTo ( MarkerCaminhoes12, 0 )
setElementVisibleTo ( MarkerCaminhoes12, root, false )
setElementVisibleTo ( BlipCaminhoes12, root, false )

MarkerCaminhoes13 = createMarker ( CaminhoesX13, CaminhoesY13, CaminhoesZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes13 = createBlipAttachedTo ( MarkerCaminhoes13, 0 )
setElementVisibleTo ( MarkerCaminhoes13, root, false )
setElementVisibleTo ( BlipCaminhoes13, root, false )

MarkerCaminhoes14 = createMarker ( CaminhoesX14, CaminhoesY14, CaminhoesZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes14 = createBlipAttachedTo ( MarkerCaminhoes14, 0 )
setElementVisibleTo ( MarkerCaminhoes14, root, false )
setElementVisibleTo ( BlipCaminhoes14, root, false )

MarkerCaminhoes15 = createMarker ( CaminhoesX15, CaminhoesY15, CaminhoesZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes15 = createBlipAttachedTo ( MarkerCaminhoes15, 0 )
setElementVisibleTo ( MarkerCaminhoes15, root, false )
setElementVisibleTo ( BlipCaminhoes15, root, false )

MarkerCaminhoes16 = createMarker ( CaminhoesX16, CaminhoesY16, CaminhoesZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCaminhoes16 = createBlipAttachedTo ( MarkerCaminhoes16, 0 )
setElementVisibleTo ( MarkerCaminhoes16, root, false )
setElementVisibleTo ( BlipCaminhoes16, root, false )

AutoEscolaCaminhoes = {}

function CaminhoesHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Caminhoes" ) == true then
if getPlayerMoney(source) >= HabValorCaminhoes then
takePlayerMoney(source, HabValorCaminhoes)
if AutoEscolaCaminhoes[source] and isElement( AutoEscolaCaminhoes[source] ) then destroyElement ( AutoEscolaCaminhoes[source] )
AutoEscolaCaminhoes[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCaminhoes[source] = createVehicle( CaminhoesID, CaminhoesRX, CaminhoesRY, CaminhoesRZ )
setElementRotation ( AutoEscolaCaminhoes[source], CaminhoesRotA, CaminhoesRotB, CaminhoesRotC )
setVehicleLocked ( AutoEscolaCaminhoes[source], true )
warpPedIntoVehicle ( source, AutoEscolaCaminhoes[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCaminhoes00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCaminhoes01, source, true )
setElementVisibleTo ( BlipCaminhoes01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes03, "warning")
end
end
addEvent("Hab:Caminhao", true)
addEventHandler ( "Hab:Caminhao", root, CaminhoesHab)

function emarkerCaminhoes(marker,md) 
    if (md) then
      if AutoEscolaCaminhoes[source] and isElement( AutoEscolaCaminhoes[source] ) then
        if marker == MarkerCaminhoes01 then
        if getElementData( source, "Carteira:StartCaminhoes00", true ) then
        setElementVisibleTo ( MarkerCaminhoes01, source, false )
        setElementVisibleTo ( BlipCaminhoes01, source, false )
        setElementVisibleTo ( MarkerCaminhoes02, source, true )
        setElementVisibleTo ( BlipCaminhoes02, source, true )
        setElementData ( source, "Carteira:StartCaminhoes01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes02 then
        if getElementData( source, "Carteira:StartCaminhoes01", true ) then
        setElementVisibleTo ( MarkerCaminhoes02, source, false )
        setElementVisibleTo ( BlipCaminhoes02, source, false )
        setElementVisibleTo ( MarkerCaminhoes03, source, true )
        setElementVisibleTo ( BlipCaminhoes03, source, true )
        setElementData ( source, "Carteira:StartCaminhoes02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes03 then
        if getElementData( source, "Carteira:StartCaminhoes02", true ) then
        setElementVisibleTo ( MarkerCaminhoes03, source, false )
        setElementVisibleTo ( BlipCaminhoes03, source, false )
        setElementVisibleTo ( MarkerCaminhoes04, source, true )
        setElementVisibleTo ( BlipCaminhoes04, source, true )
        setElementData ( source, "Carteira:StartCaminhoes03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes04 then
        if getElementData( source, "Carteira:StartCaminhoes03", true ) then
        setElementVisibleTo ( MarkerCaminhoes04, source, false )
        setElementVisibleTo ( BlipCaminhoes04, source, false )
        setElementVisibleTo ( MarkerCaminhoes05, source, true )
        setElementVisibleTo ( BlipCaminhoes05, source, true )
        setElementData ( source, "Carteira:StartCaminhoes04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes05 then
        if getElementData( source, "Carteira:StartCaminhoes04", true ) then
        setElementVisibleTo ( MarkerCaminhoes05, source, false )
        setElementVisibleTo ( BlipCaminhoes05, source, false )
        setElementVisibleTo ( MarkerCaminhoes06, source, true )
        setElementVisibleTo ( BlipCaminhoes06, source, true )
        setElementData ( source, "Carteira:StartCaminhoes05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes06 then
        if getElementData( source, "Carteira:StartCaminhoes05", true ) then
        setElementVisibleTo ( MarkerCaminhoes06, source, false )
        setElementVisibleTo ( BlipCaminhoes06, source, false )
        setElementVisibleTo ( MarkerCaminhoes07, source, true )
        setElementVisibleTo ( BlipCaminhoes07, source, true )
        setElementData ( source, "Carteira:StartCaminhoes06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes07 then
        if getElementData( source, "Carteira:StartCaminhoes06", true ) then
        setElementVisibleTo ( MarkerCaminhoes07, source, false )
        setElementVisibleTo ( BlipCaminhoes07, source, false )
        setElementVisibleTo ( MarkerCaminhoes08, source, true )
        setElementVisibleTo ( BlipCaminhoes08, source, true )
        setElementData ( source, "Carteira:StartCaminhoes07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes08 then
        if getElementData( source, "Carteira:StartCaminhoes07", true ) then
        setElementVisibleTo ( MarkerCaminhoes08, source, false )
        setElementVisibleTo ( BlipCaminhoes08, source, false )
        setElementVisibleTo ( MarkerCaminhoes09, source, true )
        setElementVisibleTo ( BlipCaminhoes09, source, true )
        setElementData ( source, "Carteira:StartCaminhoes08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes09 then
        if getElementData( source, "Carteira:StartCaminhoes08", true ) then
        setElementVisibleTo ( MarkerCaminhoes09, source, false )
        setElementVisibleTo ( BlipCaminhoes09, source, false )
        setElementVisibleTo ( MarkerCaminhoes10, source, true )
        setElementVisibleTo ( BlipCaminhoes10, source, true )
        setElementData ( source, "Carteira:StartCaminhoes09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes10 then
        if getElementData( source, "Carteira:StartCaminhoes09", true ) then
        setElementVisibleTo ( MarkerCaminhoes10, source, false )
        setElementVisibleTo ( BlipCaminhoes10, source, false )
        setElementVisibleTo ( MarkerCaminhoes11, source, true )
        setElementVisibleTo ( BlipCaminhoes11, source, true )
        setElementData ( source, "Carteira:StartCaminhoes10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes11 then
        if getElementData( source, "Carteira:StartCaminhoes10", true ) then
        setElementVisibleTo ( MarkerCaminhoes11, source, false )
        setElementVisibleTo ( BlipCaminhoes11, source, false )
        setElementVisibleTo ( MarkerCaminhoes12, source, true )
        setElementVisibleTo ( BlipCaminhoes12, source, true )
        setElementData ( source, "Carteira:StartCaminhoes11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes12 then
        if getElementData( source, "Carteira:StartCaminhoes11", true ) then
        setElementVisibleTo ( MarkerCaminhoes12, source, false )
        setElementVisibleTo ( BlipCaminhoes12, source, false )
        setElementVisibleTo ( MarkerCaminhoes13, source, true )
        setElementVisibleTo ( BlipCaminhoes13, source, true )
        setElementData ( source, "Carteira:StartCaminhoes12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes13 then
        if getElementData( source, "Carteira:StartCaminhoes12", true ) then
        setElementVisibleTo ( MarkerCaminhoes13, source, false )
        setElementVisibleTo ( BlipCaminhoes13, source, false )
        setElementVisibleTo ( MarkerCaminhoes14, source, true )
        setElementVisibleTo ( BlipCaminhoes14, source, true )
        setElementData ( source, "Carteira:StartCaminhoes13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes14 then
        if getElementData( source, "Carteira:StartCaminhoes13", true ) then
        setElementVisibleTo ( MarkerCaminhoes14, source, false )
        setElementVisibleTo ( BlipCaminhoes14, source, false )
        setElementVisibleTo ( MarkerCaminhoes15, source, true )
        setElementVisibleTo ( BlipCaminhoes15, source, true )
        setElementData ( source, "Carteira:StartCaminhoes14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes15 then
        if getElementData( source, "Carteira:StartCaminhoes14", true ) then
        setElementVisibleTo ( MarkerCaminhoes15, source, false )
        setElementVisibleTo ( BlipCaminhoes15, source, false )
        setElementVisibleTo ( MarkerCaminhoes16, source, true )
        setElementVisibleTo ( BlipCaminhoes16, source, true )
        setElementData ( source, "Carteira:StartCaminhoes15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCaminhoes16 then
        if getElementData( source, "Carteira:StartCaminhoes15", true ) then
        AutoEscolaCaminhoesVida = getElementHealth ( AutoEscolaCaminhoes[source] )
        if AutoEscolaCaminhoesVida <= CaminhoesDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes04, "error")
        else
        setElementData( source, "Habilitacoes:Caminhoes", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCaminhoes15", false )
        setElementVisibleTo ( MarkerCaminhoes16, source, false )
        setElementVisibleTo ( BlipCaminhoes16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaCaminhoes[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCaminhoes)

function SairDoVeiculoAutoEscolaCaminhoes (source)
if ( AutoEscolaCaminhoes[source] ) and isElement( AutoEscolaCaminhoes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCaminhoes[source] )
setElementData ( source, "Carteira:StartCaminhoes00", false )
setElementData ( source, "Carteira:StartCaminhoes01", false )
setElementData ( source, "Carteira:StartCaminhoes02", false )
setElementData ( source, "Carteira:StartCaminhoes03", false )
setElementData ( source, "Carteira:StartCaminhoes04", false )
setElementData ( source, "Carteira:StartCaminhoes05", false )
setElementData ( source, "Carteira:StartCaminhoes06", false )
setElementData ( source, "Carteira:StartCaminhoes07", false )
setElementData ( source, "Carteira:StartCaminhoes08", false )
setElementData ( source, "Carteira:StartCaminhoes09", false )
setElementData ( source, "Carteira:StartCaminhoes10", false )
setElementData ( source, "Carteira:StartCaminhoes11", false )
setElementData ( source, "Carteira:StartCaminhoes12", false )
setElementData ( source, "Carteira:StartCaminhoes13", false )
setElementData ( source, "Carteira:StartCaminhoes14", false )
setElementData ( source, "Carteira:StartCaminhoes15", false )
setElementVisibleTo ( MarkerCaminhoes01, source, false )
setElementVisibleTo ( BlipCaminhoes01, source, false )
setElementVisibleTo ( MarkerCaminhoes02, source, false )
setElementVisibleTo ( BlipCaminhoes02, source, false )
setElementVisibleTo ( MarkerCaminhoes03, source, false )
setElementVisibleTo ( BlipCaminhoes03, source, false )
setElementVisibleTo ( MarkerCaminhoes04, source, false )
setElementVisibleTo ( BlipCaminhoes04, source, false )
setElementVisibleTo ( MarkerCaminhoes05, source, false )
setElementVisibleTo ( BlipCaminhoes05, source, false )
setElementVisibleTo ( MarkerCaminhoes06, source, false )
setElementVisibleTo ( BlipCaminhoes06, source, false )
setElementVisibleTo ( MarkerCaminhoes07, source, false )
setElementVisibleTo ( BlipCaminhoes07, source, false )
setElementVisibleTo ( MarkerCaminhoes08, source, false )
setElementVisibleTo ( BlipCaminhoes08, source, false )
setElementVisibleTo ( MarkerCaminhoes09, source, false )
setElementVisibleTo ( BlipCaminhoes09, source, false )
setElementVisibleTo ( MarkerCaminhoes10, source, false )
setElementVisibleTo ( BlipCaminhoes10, source, false )
setElementVisibleTo ( MarkerCaminhoes11, source, false )
setElementVisibleTo ( BlipCaminhoes11, source, false )
setElementVisibleTo ( MarkerCaminhoes12, source, false )
setElementVisibleTo ( BlipCaminhoes12, source, false )
setElementVisibleTo ( MarkerCaminhoes13, source, false )
setElementVisibleTo ( BlipCaminhoes13, source, false )
setElementVisibleTo ( MarkerCaminhoes14, source, false )
setElementVisibleTo ( BlipCaminhoes14, source, false )
setElementVisibleTo ( MarkerCaminhoes15, source, false )
setElementVisibleTo ( BlipCaminhoes15, source, false )
setElementVisibleTo ( MarkerCaminhoes16, source, false )
setElementVisibleTo ( BlipCaminhoes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCaminhoes )

function MorrerAutoEscolaCaminhoes ()
if ( AutoEscolaCaminhoes[source] ) and isElement( AutoEscolaCaminhoes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCaminhoes[source] )
setElementData ( source, "Carteira:StartCaminhoes00", false )
setElementData ( source, "Carteira:StartCaminhoes01", false )
setElementData ( source, "Carteira:StartCaminhoes02", false )
setElementData ( source, "Carteira:StartCaminhoes03", false )
setElementData ( source, "Carteira:StartCaminhoes04", false )
setElementData ( source, "Carteira:StartCaminhoes05", false )
setElementData ( source, "Carteira:StartCaminhoes06", false )
setElementData ( source, "Carteira:StartCaminhoes07", false )
setElementData ( source, "Carteira:StartCaminhoes08", false )
setElementData ( source, "Carteira:StartCaminhoes09", false )
setElementData ( source, "Carteira:StartCaminhoes10", false )
setElementData ( source, "Carteira:StartCaminhoes11", false )
setElementData ( source, "Carteira:StartCaminhoes12", false )
setElementData ( source, "Carteira:StartCaminhoes13", false )
setElementData ( source, "Carteira:StartCaminhoes14", false )
setElementData ( source, "Carteira:StartCaminhoes15", false )
setElementVisibleTo ( MarkerCaminhoes01, source, false )
setElementVisibleTo ( BlipCaminhoes01, source, false )
setElementVisibleTo ( MarkerCaminhoes02, source, false )
setElementVisibleTo ( BlipCaminhoes02, source, false )
setElementVisibleTo ( MarkerCaminhoes03, source, false )
setElementVisibleTo ( BlipCaminhoes03, source, false )
setElementVisibleTo ( MarkerCaminhoes04, source, false )
setElementVisibleTo ( BlipCaminhoes04, source, false )
setElementVisibleTo ( MarkerCaminhoes05, source, false )
setElementVisibleTo ( BlipCaminhoes05, source, false )
setElementVisibleTo ( MarkerCaminhoes06, source, false )
setElementVisibleTo ( BlipCaminhoes06, source, false )
setElementVisibleTo ( MarkerCaminhoes07, source, false )
setElementVisibleTo ( BlipCaminhoes07, source, false )
setElementVisibleTo ( MarkerCaminhoes08, source, false )
setElementVisibleTo ( BlipCaminhoes08, source, false )
setElementVisibleTo ( MarkerCaminhoes09, source, false )
setElementVisibleTo ( BlipCaminhoes09, source, false )
setElementVisibleTo ( MarkerCaminhoes10, source, false )
setElementVisibleTo ( BlipCaminhoes10, source, false )
setElementVisibleTo ( MarkerCaminhoes11, source, false )
setElementVisibleTo ( BlipCaminhoes11, source, false )
setElementVisibleTo ( MarkerCaminhoes12, source, false )
setElementVisibleTo ( BlipCaminhoes12, source, false )
setElementVisibleTo ( MarkerCaminhoes13, source, false )
setElementVisibleTo ( BlipCaminhoes13, source, false )
setElementVisibleTo ( MarkerCaminhoes14, source, false )
setElementVisibleTo ( BlipCaminhoes14, source, false )
setElementVisibleTo ( MarkerCaminhoes15, source, false )
setElementVisibleTo ( BlipCaminhoes15, source, false )
setElementVisibleTo ( MarkerCaminhoes16, source, false )
setElementVisibleTo ( BlipCaminhoes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCaminhoes07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCaminhoes )

function SairDoServidorAutoEscolaCaminhoes ( quitType )    
if isElement( AutoEscolaCaminhoes[source] ) then
destroyElement ( AutoEscolaCaminhoes[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCaminhoes )

-- ( Final ) Percurso de Caminhoes

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Onibus

OnibusRX, OnibusRY, OnibusRZ       = 2131.74976, 2728.53027, 10.82031 -- Coordenadas de Respawn do Onibus
OnibusRotA, OnibusRotB, OnibusRotC = 0, 0, 0 -- Rotação do Veiculo ao Spawnar
OnibusID                           = 437 -- ID do Onibus
HabValorOnibus                     = 1400 -- Valor da Habilitação Categoria "Onibus"
OnibusDanoParaReprovar             = 950 -- 95%

MsgOnibus01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgOnibus02 = "Você Não Tem Dinheiro Suficiente!"
MsgOnibus03 = "Você Ja Possui Essa Habilitação!"
MsgOnibus04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgOnibus05 = "Carteira de Habilitação Categoria 'Ônibus' Concedida!"
MsgOnibus06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgOnibus07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

OnibusX01, OnibusY01, OnibusZ01 = 2127.71118, 2755.46826, 10.85947
OnibusX02, OnibusY02, OnibusZ02 = 2091.51147, 2774.08960, 10.70245
OnibusX03, OnibusY03, OnibusZ03 = 2085.05054, 2660.39233, 10.70181
OnibusX04, OnibusY04, OnibusZ04 = 2025.16162, 2602.87573, 11.88449
OnibusX05, OnibusY05, OnibusZ05 = 2025.23767, 2518.30054, 12.31421
OnibusX06, OnibusY06, OnibusZ06 = 2025.44836, 2420.84473, 10.72500
OnibusX07, OnibusY07, OnibusZ07 = 2043.32520, 2334.30859, 10.71358
OnibusX08, OnibusY08, OnibusZ08 = 2121.86963, 2249.28174, 10.70663
OnibusX09, OnibusY09, OnibusZ09 = 2125.64185, 2072.61621, 10.70400
OnibusX10, OnibusY10, OnibusZ10 = 2125.50269, 1963.75562, 10.71333
OnibusX11, OnibusY11, OnibusZ11 = 2119.42822, 1850.72949, 10.70842
OnibusX12, OnibusY12, OnibusZ12 = 2059.43579, 1730.45862, 10.69846
OnibusX13, OnibusY13, OnibusZ13 = 2045.76147, 1581.07239, 10.70090
OnibusX14, OnibusY14, OnibusZ14 = 2104.10229, 1531.17041, 10.70718
OnibusX15, OnibusY15, OnibusZ15 = 2215.26343, 1530.97510, 10.72500
OnibusX16, OnibusY16, OnibusZ16 = 2307.06714, 1516.97119, 10.84756

MarkerOnibus01 = createMarker ( OnibusX01, OnibusY01, OnibusZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus01 = createBlipAttachedTo ( MarkerOnibus01, 0 )
setElementVisibleTo ( MarkerOnibus01, root, false )
setElementVisibleTo ( BlipOnibus01, root, false )

MarkerOnibus02 = createMarker ( OnibusX02, OnibusY02, OnibusZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus02 = createBlipAttachedTo ( MarkerOnibus02, 0 )
setElementVisibleTo ( MarkerOnibus02, root, false )
setElementVisibleTo ( BlipOnibus02, root, false )

MarkerOnibus03 = createMarker ( OnibusX03, OnibusY03, OnibusZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus03 = createBlipAttachedTo ( MarkerOnibus03, 0 )
setElementVisibleTo ( MarkerOnibus03, root, false )
setElementVisibleTo ( BlipOnibus03, root, false )

MarkerOnibus04 = createMarker ( OnibusX04, OnibusY04, OnibusZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus04 = createBlipAttachedTo ( MarkerOnibus04, 0 )
setElementVisibleTo ( MarkerOnibus04, root, false )
setElementVisibleTo ( BlipOnibus04, root, false )

MarkerOnibus05 = createMarker ( OnibusX05, OnibusY05, OnibusZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus05 = createBlipAttachedTo ( MarkerOnibus05, 0 )
setElementVisibleTo ( MarkerOnibus05, root, false )
setElementVisibleTo ( BlipOnibus05, root, false )

MarkerOnibus06 = createMarker ( OnibusX06, OnibusY06, OnibusZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus06 = createBlipAttachedTo ( MarkerOnibus06, 0 )
setElementVisibleTo ( MarkerOnibus06, root, false )
setElementVisibleTo ( BlipOnibus06, root, false )

MarkerOnibus07 = createMarker ( OnibusX07, OnibusY07, OnibusZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus07 = createBlipAttachedTo ( MarkerOnibus07, 0 )
setElementVisibleTo ( MarkerOnibus07, root, false )
setElementVisibleTo ( BlipOnibus07, root, false )

MarkerOnibus08 = createMarker ( OnibusX08, OnibusY08, OnibusZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus08 = createBlipAttachedTo ( MarkerOnibus08, 0 )
setElementVisibleTo ( MarkerOnibus08, root, false )
setElementVisibleTo ( BlipOnibus08, root, false )

MarkerOnibus09 = createMarker ( OnibusX09, OnibusY09, OnibusZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus09 = createBlipAttachedTo ( MarkerOnibus09, 0 )
setElementVisibleTo ( MarkerOnibus09, root, false )
setElementVisibleTo ( BlipOnibus09, root, false )

MarkerOnibus10 = createMarker ( OnibusX10, OnibusY10, OnibusZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus10 = createBlipAttachedTo ( MarkerOnibus10, 0 )
setElementVisibleTo ( MarkerOnibus10, root, false )
setElementVisibleTo ( BlipOnibus10, root, false )

MarkerOnibus11 = createMarker ( OnibusX11, OnibusY11, OnibusZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus11 = createBlipAttachedTo ( MarkerOnibus11, 0 )
setElementVisibleTo ( MarkerOnibus11, root, false )
setElementVisibleTo ( BlipOnibus11, root, false )

MarkerOnibus12 = createMarker ( OnibusX12, OnibusY12, OnibusZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus12 = createBlipAttachedTo ( MarkerOnibus12, 0 )
setElementVisibleTo ( MarkerOnibus12, root, false )
setElementVisibleTo ( BlipOnibus12, root, false )

MarkerOnibus13 = createMarker ( OnibusX13, OnibusY13, OnibusZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus13 = createBlipAttachedTo ( MarkerOnibus13, 0 )
setElementVisibleTo ( MarkerOnibus13, root, false )
setElementVisibleTo ( BlipOnibus13, root, false )

MarkerOnibus14 = createMarker ( OnibusX14, OnibusY14, OnibusZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus14 = createBlipAttachedTo ( MarkerOnibus14, 0 )
setElementVisibleTo ( MarkerOnibus14, root, false )
setElementVisibleTo ( BlipOnibus14, root, false )

MarkerOnibus15 = createMarker ( OnibusX15, OnibusY15, OnibusZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus15 = createBlipAttachedTo ( MarkerOnibus15, 0 )
setElementVisibleTo ( MarkerOnibus15, root, false )
setElementVisibleTo ( BlipOnibus15, root, false )

MarkerOnibus16 = createMarker ( OnibusX16, OnibusY16, OnibusZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipOnibus16 = createBlipAttachedTo ( MarkerOnibus16, 0 )
setElementVisibleTo ( MarkerOnibus16, root, false )
setElementVisibleTo ( BlipOnibus16, root, false )

AutoEscolaOnibus = {}

function OnibusHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Onibus" ) == true then
if getPlayerMoney(source) >= HabValorOnibus then
takePlayerMoney(source, HabValorOnibus)
if AutoEscolaOnibus[source] and isElement( AutoEscolaOnibus[source] ) then destroyElement ( AutoEscolaOnibus[source] )
AutoEscolaOnibus[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaOnibus[source] = createVehicle( OnibusID, OnibusRX, OnibusRY, OnibusRZ )
setElementRotation ( AutoEscolaOnibus[source], OnibusRotA, OnibusRotB, OnibusRotC )
setVehicleLocked ( AutoEscolaOnibus[source], true )
warpPedIntoVehicle ( source, AutoEscolaOnibus[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartOnibus00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerOnibus01, source, true )
setElementVisibleTo ( BlipOnibus01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus03, "warning")
end
end
addEvent("Hab:Onibus", true)
addEventHandler ( "Hab:Onibus", root, OnibusHab)

function emarkerOnibus(marker,md) 
    if (md) then
      if AutoEscolaOnibus[source] and isElement( AutoEscolaOnibus[source] ) then
        if marker == MarkerOnibus01 then
        if getElementData( source, "Carteira:StartOnibus00", true ) then
        setElementVisibleTo ( MarkerOnibus01, source, false )
        setElementVisibleTo ( BlipOnibus01, source, false )
        setElementVisibleTo ( MarkerOnibus02, source, true )
        setElementVisibleTo ( BlipOnibus02, source, true )
        setElementData ( source, "Carteira:StartOnibus01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus02 then
        if getElementData( source, "Carteira:StartOnibus01", true ) then
        setElementVisibleTo ( MarkerOnibus02, source, false )
        setElementVisibleTo ( BlipOnibus02, source, false )
        setElementVisibleTo ( MarkerOnibus03, source, true )
        setElementVisibleTo ( BlipOnibus03, source, true )
        setElementData ( source, "Carteira:StartOnibus02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus03 then
        if getElementData( source, "Carteira:StartOnibus02", true ) then
        setElementVisibleTo ( MarkerOnibus03, source, false )
        setElementVisibleTo ( BlipOnibus03, source, false )
        setElementVisibleTo ( MarkerOnibus04, source, true )
        setElementVisibleTo ( BlipOnibus04, source, true )
        setElementData ( source, "Carteira:StartOnibus03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus04 then
        if getElementData( source, "Carteira:StartOnibus03", true ) then
        setElementVisibleTo ( MarkerOnibus04, source, false )
        setElementVisibleTo ( BlipOnibus04, source, false )
        setElementVisibleTo ( MarkerOnibus05, source, true )
        setElementVisibleTo ( BlipOnibus05, source, true )
        setElementData ( source, "Carteira:StartOnibus04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus05 then
        if getElementData( source, "Carteira:StartOnibus04", true ) then
        setElementVisibleTo ( MarkerOnibus05, source, false )
        setElementVisibleTo ( BlipOnibus05, source, false )
        setElementVisibleTo ( MarkerOnibus06, source, true )
        setElementVisibleTo ( BlipOnibus06, source, true )
        setElementData ( source, "Carteira:StartOnibus05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus06 then
        if getElementData( source, "Carteira:StartOnibus05", true ) then
        setElementVisibleTo ( MarkerOnibus06, source, false )
        setElementVisibleTo ( BlipOnibus06, source, false )
        setElementVisibleTo ( MarkerOnibus07, source, true )
        setElementVisibleTo ( BlipOnibus07, source, true )
        setElementData ( source, "Carteira:StartOnibus06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus07 then
        if getElementData( source, "Carteira:StartOnibus06", true ) then
        setElementVisibleTo ( MarkerOnibus07, source, false )
        setElementVisibleTo ( BlipOnibus07, source, false )
        setElementVisibleTo ( MarkerOnibus08, source, true )
        setElementVisibleTo ( BlipOnibus08, source, true )
        setElementData ( source, "Carteira:StartOnibus07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus08 then
        if getElementData( source, "Carteira:StartOnibus07", true ) then
        setElementVisibleTo ( MarkerOnibus08, source, false )
        setElementVisibleTo ( BlipOnibus08, source, false )
        setElementVisibleTo ( MarkerOnibus09, source, true )
        setElementVisibleTo ( BlipOnibus09, source, true )
        setElementData ( source, "Carteira:StartOnibus08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus09 then
        if getElementData( source, "Carteira:StartOnibus08", true ) then
        setElementVisibleTo ( MarkerOnibus09, source, false )
        setElementVisibleTo ( BlipOnibus09, source, false )
        setElementVisibleTo ( MarkerOnibus10, source, true )
        setElementVisibleTo ( BlipOnibus10, source, true )
        setElementData ( source, "Carteira:StartOnibus09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus10 then
        if getElementData( source, "Carteira:StartOnibus09", true ) then
        setElementVisibleTo ( MarkerOnibus10, source, false )
        setElementVisibleTo ( BlipOnibus10, source, false )
        setElementVisibleTo ( MarkerOnibus11, source, true )
        setElementVisibleTo ( BlipOnibus11, source, true )
        setElementData ( source, "Carteira:StartOnibus10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus11 then
        if getElementData( source, "Carteira:StartOnibus10", true ) then
        setElementVisibleTo ( MarkerOnibus11, source, false )
        setElementVisibleTo ( BlipOnibus11, source, false )
        setElementVisibleTo ( MarkerOnibus12, source, true )
        setElementVisibleTo ( BlipOnibus12, source, true )
        setElementData ( source, "Carteira:StartOnibus11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus12 then
        if getElementData( source, "Carteira:StartOnibus11", true ) then
        setElementVisibleTo ( MarkerOnibus12, source, false )
        setElementVisibleTo ( BlipOnibus12, source, false )
        setElementVisibleTo ( MarkerOnibus13, source, true )
        setElementVisibleTo ( BlipOnibus13, source, true )
        setElementData ( source, "Carteira:StartOnibus12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus13 then
        if getElementData( source, "Carteira:StartOnibus12", true ) then
        setElementVisibleTo ( MarkerOnibus13, source, false )
        setElementVisibleTo ( BlipOnibus13, source, false )
        setElementVisibleTo ( MarkerOnibus14, source, true )
        setElementVisibleTo ( BlipOnibus14, source, true )
        setElementData ( source, "Carteira:StartOnibus13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus14 then
        if getElementData( source, "Carteira:StartOnibus13", true ) then
        setElementVisibleTo ( MarkerOnibus14, source, false )
        setElementVisibleTo ( BlipOnibus14, source, false )
        setElementVisibleTo ( MarkerOnibus15, source, true )
        setElementVisibleTo ( BlipOnibus15, source, true )
        setElementData ( source, "Carteira:StartOnibus14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus15 then
        if getElementData( source, "Carteira:StartOnibus14", true ) then
        setElementVisibleTo ( MarkerOnibus15, source, false )
        setElementVisibleTo ( BlipOnibus15, source, false )
        setElementVisibleTo ( MarkerOnibus16, source, true )
        setElementVisibleTo ( BlipOnibus16, source, true )
        setElementData ( source, "Carteira:StartOnibus15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerOnibus16 then
        if getElementData( source, "Carteira:StartOnibus15", true ) then
        AutoEscolaOnibusVida = getElementHealth ( AutoEscolaOnibus[source] )
        if AutoEscolaOnibusVida <= OnibusDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgOnibus04, "error")
        else
        setElementData( source, "Habilitacoes:Onibus", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgOnibus05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartOnibus15", false )
        setElementVisibleTo ( MarkerOnibus16, source, false )
        setElementVisibleTo ( BlipOnibus16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaOnibus[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerOnibus)

function SairDoVeiculoAutoEscolaOnibus (source)
if ( AutoEscolaOnibus[source] ) and isElement( AutoEscolaOnibus[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaOnibus[source] )
setElementData ( source, "Carteira:StartOnibus00", false )
setElementData ( source, "Carteira:StartOnibus01", false )
setElementData ( source, "Carteira:StartOnibus02", false )
setElementData ( source, "Carteira:StartOnibus03", false )
setElementData ( source, "Carteira:StartOnibus04", false )
setElementData ( source, "Carteira:StartOnibus05", false )
setElementData ( source, "Carteira:StartOnibus06", false )
setElementData ( source, "Carteira:StartOnibus07", false )
setElementData ( source, "Carteira:StartOnibus08", false )
setElementData ( source, "Carteira:StartOnibus09", false )
setElementData ( source, "Carteira:StartOnibus10", false )
setElementData ( source, "Carteira:StartOnibus11", false )
setElementData ( source, "Carteira:StartOnibus12", false )
setElementData ( source, "Carteira:StartOnibus13", false )
setElementData ( source, "Carteira:StartOnibus14", false )
setElementData ( source, "Carteira:StartOnibus15", false )
setElementVisibleTo ( MarkerOnibus01, source, false )
setElementVisibleTo ( BlipOnibus01, source, false )
setElementVisibleTo ( MarkerOnibus02, source, false )
setElementVisibleTo ( BlipOnibus02, source, false )
setElementVisibleTo ( MarkerOnibus03, source, false )
setElementVisibleTo ( BlipOnibus03, source, false )
setElementVisibleTo ( MarkerOnibus04, source, false )
setElementVisibleTo ( BlipOnibus04, source, false )
setElementVisibleTo ( MarkerOnibus05, source, false )
setElementVisibleTo ( BlipOnibus05, source, false )
setElementVisibleTo ( MarkerOnibus06, source, false )
setElementVisibleTo ( BlipOnibus06, source, false )
setElementVisibleTo ( MarkerOnibus07, source, false )
setElementVisibleTo ( BlipOnibus07, source, false )
setElementVisibleTo ( MarkerOnibus08, source, false )
setElementVisibleTo ( BlipOnibus08, source, false )
setElementVisibleTo ( MarkerOnibus09, source, false )
setElementVisibleTo ( BlipOnibus09, source, false )
setElementVisibleTo ( MarkerOnibus10, source, false )
setElementVisibleTo ( BlipOnibus10, source, false )
setElementVisibleTo ( MarkerOnibus11, source, false )
setElementVisibleTo ( BlipOnibus11, source, false )
setElementVisibleTo ( MarkerOnibus12, source, false )
setElementVisibleTo ( BlipOnibus12, source, false )
setElementVisibleTo ( MarkerOnibus13, source, false )
setElementVisibleTo ( BlipOnibus13, source, false )
setElementVisibleTo ( MarkerOnibus14, source, false )
setElementVisibleTo ( BlipOnibus14, source, false )
setElementVisibleTo ( MarkerOnibus15, source, false )
setElementVisibleTo ( BlipOnibus15, source, false )
setElementVisibleTo ( MarkerOnibus16, source, false )
setElementVisibleTo ( BlipOnibus16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaOnibus )

function MorrerAutoEscolaOnibus ()
if ( AutoEscolaOnibus[source] ) and isElement( AutoEscolaOnibus[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaOnibus[source] )
setElementData ( source, "Carteira:StartOnibus00", false )
setElementData ( source, "Carteira:StartOnibus01", false )
setElementData ( source, "Carteira:StartOnibus02", false )
setElementData ( source, "Carteira:StartOnibus03", false )
setElementData ( source, "Carteira:StartOnibus04", false )
setElementData ( source, "Carteira:StartOnibus05", false )
setElementData ( source, "Carteira:StartOnibus06", false )
setElementData ( source, "Carteira:StartOnibus07", false )
setElementData ( source, "Carteira:StartOnibus08", false )
setElementData ( source, "Carteira:StartOnibus09", false )
setElementData ( source, "Carteira:StartOnibus10", false )
setElementData ( source, "Carteira:StartOnibus11", false )
setElementData ( source, "Carteira:StartOnibus12", false )
setElementData ( source, "Carteira:StartOnibus13", false )
setElementData ( source, "Carteira:StartOnibus14", false )
setElementData ( source, "Carteira:StartOnibus15", false )
setElementVisibleTo ( MarkerOnibus01, source, false )
setElementVisibleTo ( BlipOnibus01, source, false )
setElementVisibleTo ( MarkerOnibus02, source, false )
setElementVisibleTo ( BlipOnibus02, source, false )
setElementVisibleTo ( MarkerOnibus03, source, false )
setElementVisibleTo ( BlipOnibus03, source, false )
setElementVisibleTo ( MarkerOnibus04, source, false )
setElementVisibleTo ( BlipOnibus04, source, false )
setElementVisibleTo ( MarkerOnibus05, source, false )
setElementVisibleTo ( BlipOnibus05, source, false )
setElementVisibleTo ( MarkerOnibus06, source, false )
setElementVisibleTo ( BlipOnibus06, source, false )
setElementVisibleTo ( MarkerOnibus07, source, false )
setElementVisibleTo ( BlipOnibus07, source, false )
setElementVisibleTo ( MarkerOnibus08, source, false )
setElementVisibleTo ( BlipOnibus08, source, false )
setElementVisibleTo ( MarkerOnibus09, source, false )
setElementVisibleTo ( BlipOnibus09, source, false )
setElementVisibleTo ( MarkerOnibus10, source, false )
setElementVisibleTo ( BlipOnibus10, source, false )
setElementVisibleTo ( MarkerOnibus11, source, false )
setElementVisibleTo ( BlipOnibus11, source, false )
setElementVisibleTo ( MarkerOnibus12, source, false )
setElementVisibleTo ( BlipOnibus12, source, false )
setElementVisibleTo ( MarkerOnibus13, source, false )
setElementVisibleTo ( BlipOnibus13, source, false )
setElementVisibleTo ( MarkerOnibus14, source, false )
setElementVisibleTo ( BlipOnibus14, source, false )
setElementVisibleTo ( MarkerOnibus15, source, false )
setElementVisibleTo ( BlipOnibus15, source, false )
setElementVisibleTo ( MarkerOnibus16, source, false )
setElementVisibleTo ( BlipOnibus16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgOnibus07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaOnibus )

function SairDoServidorAutoEscolaOnibus ( quitType )    
if isElement( AutoEscolaOnibus[source] ) then
destroyElement ( AutoEscolaOnibus[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaOnibus )

-- ( Final ) Percurso de Onibus

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Carretas

CarretasRX, CarretasRY, CarretasRZ       = -1291.52820, 2710.38794, 51 -- Coordenadas de Respawn do Carreta
CarretasRotA, CarretasRotB, CarretasRotC = 0, 0, 182.73559570312 -- Rotação do Veiculo ao Spawnar
CarretasID                               = 403 -- ID do Carreta
HabValorCarretas                         = 1600 -- Valor da Habilitação Categoria "Carretas"
CarretasDanoParaReprovar                 = 950 -- 95%

MsgCarretas01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCarretas02 = "Você Não Tem Dinheiro Suficiente!"
MsgCarretas03 = "Você Ja Possui Essa Habilitação!"
MsgCarretas04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCarretas05 = "Carteira de Habilitação Categoria 'Carretas' Concedida!"
MsgCarretas06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCarretas07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CarretasX01, CarretasY01, CarretasZ01 = -1292.75232, 2661.98853, 49.58909
CarretasX02, CarretasY02, CarretasZ02 = -1371.68579, 2678.74536, 52.65607
CarretasX03, CarretasY03, CarretasZ03 = -1480.98108, 2733.20776, 65.90062
CarretasX04, CarretasY04, CarretasZ04 = -1643.80920, 2726.40698, 58.57969
CarretasX05, CarretasY05, CarretasZ05 = -1747.70764, 2729.60181, 59.95318
CarretasX06, CarretasY06, CarretasZ06 = -1849.49866, 2617.99048, 50.53489
CarretasX07, CarretasY07, CarretasZ07 = -1910.04419, 2512.77075, 44.94999
CarretasX08, CarretasY08, CarretasZ08 = -2002.78674, 2440.17944, 35.19661
CarretasX09, CarretasY09, CarretasZ09 = -1986.44226, 2352.16357, 28.50075
CarretasX10, CarretasY10, CarretasZ10 = -1960.02039, 2224.11255, 11.43757
CarretasX11, CarretasY11, CarretasZ11 = -1860.70874, 2192.22119, 5.79754
CarretasX12, CarretasY12, CarretasZ12 = -1821.54529, 2123.84326, 8.04688
CarretasX13, CarretasY13, CarretasZ13 = -1801.09155, 1990.08398, 13.05490
CarretasX14, CarretasY14, CarretasZ14 = -1736.97876, 1820.46912, 23.67095
CarretasX15, CarretasY15, CarretasZ15 = -1574.65247, 1835.91235, 26.51335
CarretasX16, CarretasY16, CarretasZ16 = -1486.08936, 1877.73352, 32.66355

MarkerCarretas01 = createMarker ( CarretasX01, CarretasY01, CarretasZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas01 = createBlipAttachedTo ( MarkerCarretas01, 0 )
setElementVisibleTo ( MarkerCarretas01, root, false )
setElementVisibleTo ( BlipCarretas01, root, false )

MarkerCarretas02 = createMarker ( CarretasX02, CarretasY02, CarretasZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas02 = createBlipAttachedTo ( MarkerCarretas02, 0 )
setElementVisibleTo ( MarkerCarretas02, root, false )
setElementVisibleTo ( BlipCarretas02, root, false )

MarkerCarretas03 = createMarker ( CarretasX03, CarretasY03, CarretasZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas03 = createBlipAttachedTo ( MarkerCarretas03, 0 )
setElementVisibleTo ( MarkerCarretas03, root, false )
setElementVisibleTo ( BlipCarretas03, root, false )

MarkerCarretas04 = createMarker ( CarretasX04, CarretasY04, CarretasZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas04 = createBlipAttachedTo ( MarkerCarretas04, 0 )
setElementVisibleTo ( MarkerCarretas04, root, false )
setElementVisibleTo ( BlipCarretas04, root, false )

MarkerCarretas05 = createMarker ( CarretasX05, CarretasY05, CarretasZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas05 = createBlipAttachedTo ( MarkerCarretas05, 0 )
setElementVisibleTo ( MarkerCarretas05, root, false )
setElementVisibleTo ( BlipCarretas05, root, false )

MarkerCarretas06 = createMarker ( CarretasX06, CarretasY06, CarretasZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas06 = createBlipAttachedTo ( MarkerCarretas06, 0 )
setElementVisibleTo ( MarkerCarretas06, root, false )
setElementVisibleTo ( BlipCarretas06, root, false )

MarkerCarretas07 = createMarker ( CarretasX07, CarretasY07, CarretasZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas07 = createBlipAttachedTo ( MarkerCarretas07, 0 )
setElementVisibleTo ( MarkerCarretas07, root, false )
setElementVisibleTo ( BlipCarretas07, root, false )

MarkerCarretas08 = createMarker ( CarretasX08, CarretasY08, CarretasZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas08 = createBlipAttachedTo ( MarkerCarretas08, 0 )
setElementVisibleTo ( MarkerCarretas08, root, false )
setElementVisibleTo ( BlipCarretas08, root, false )

MarkerCarretas09 = createMarker ( CarretasX09, CarretasY09, CarretasZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas09 = createBlipAttachedTo ( MarkerCarretas09, 0 )
setElementVisibleTo ( MarkerCarretas09, root, false )
setElementVisibleTo ( BlipCarretas09, root, false )

MarkerCarretas10 = createMarker ( CarretasX10, CarretasY10, CarretasZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas10 = createBlipAttachedTo ( MarkerCarretas10, 0 )
setElementVisibleTo ( MarkerCarretas10, root, false )
setElementVisibleTo ( BlipCarretas10, root, false )

MarkerCarretas11 = createMarker ( CarretasX11, CarretasY11, CarretasZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas11 = createBlipAttachedTo ( MarkerCarretas11, 0 )
setElementVisibleTo ( MarkerCarretas11, root, false )
setElementVisibleTo ( BlipCarretas11, root, false )

MarkerCarretas12 = createMarker ( CarretasX12, CarretasY12, CarretasZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas12 = createBlipAttachedTo ( MarkerCarretas12, 0 )
setElementVisibleTo ( MarkerCarretas12, root, false )
setElementVisibleTo ( BlipCarretas12, root, false )

MarkerCarretas13 = createMarker ( CarretasX13, CarretasY13, CarretasZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas13 = createBlipAttachedTo ( MarkerCarretas13, 0 )
setElementVisibleTo ( MarkerCarretas13, root, false )
setElementVisibleTo ( BlipCarretas13, root, false )

MarkerCarretas14 = createMarker ( CarretasX14, CarretasY14, CarretasZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas14 = createBlipAttachedTo ( MarkerCarretas14, 0 )
setElementVisibleTo ( MarkerCarretas14, root, false )
setElementVisibleTo ( BlipCarretas14, root, false )

MarkerCarretas15 = createMarker ( CarretasX15, CarretasY15, CarretasZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas15 = createBlipAttachedTo ( MarkerCarretas15, 0 )
setElementVisibleTo ( MarkerCarretas15, root, false )
setElementVisibleTo ( BlipCarretas15, root, false )

MarkerCarretas16 = createMarker ( CarretasX16, CarretasY16, CarretasZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarretas16 = createBlipAttachedTo ( MarkerCarretas16, 0 )
setElementVisibleTo ( MarkerCarretas16, root, false )
setElementVisibleTo ( BlipCarretas16, root, false )

AutoEscolaCarretas = {}

function CarretasHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Carretas" ) == true then
if getPlayerMoney(source) >= HabValorCarretas then
takePlayerMoney(source, HabValorCarretas)
if AutoEscolaCarretas[source] and isElement( AutoEscolaCarretas[source] ) then destroyElement ( AutoEscolaCarretas[source] )
AutoEscolaCarretas[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCarretas[source] = createVehicle( CarretasID, CarretasRX, CarretasRY, CarretasRZ )
setElementRotation ( AutoEscolaCarretas[source], CarretasRotA, CarretasRotB, CarretasRotC )
setVehicleLocked ( AutoEscolaCarretas[source], true )
warpPedIntoVehicle ( source, AutoEscolaCarretas[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCarretas00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCarretas01, source, true )
setElementVisibleTo ( BlipCarretas01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas03, "warning")
end
end
addEvent("Hab:Carreta", true)
addEventHandler ( "Hab:Carreta", root, CarretasHab)

function emarkerCarretas(marker,md) 
    if (md) then
      if AutoEscolaCarretas[source] and isElement( AutoEscolaCarretas[source] ) then
        if marker == MarkerCarretas01 then
        if getElementData( source, "Carteira:StartCarretas00", true ) then
        setElementVisibleTo ( MarkerCarretas01, source, false )
        setElementVisibleTo ( BlipCarretas01, source, false )
        setElementVisibleTo ( MarkerCarretas02, source, true )
        setElementVisibleTo ( BlipCarretas02, source, true )
        setElementData ( source, "Carteira:StartCarretas01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas02 then
        if getElementData( source, "Carteira:StartCarretas01", true ) then
        setElementVisibleTo ( MarkerCarretas02, source, false )
        setElementVisibleTo ( BlipCarretas02, source, false )
        setElementVisibleTo ( MarkerCarretas03, source, true )
        setElementVisibleTo ( BlipCarretas03, source, true )
        setElementData ( source, "Carteira:StartCarretas02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas03 then
        if getElementData( source, "Carteira:StartCarretas02", true ) then
        setElementVisibleTo ( MarkerCarretas03, source, false )
        setElementVisibleTo ( BlipCarretas03, source, false )
        setElementVisibleTo ( MarkerCarretas04, source, true )
        setElementVisibleTo ( BlipCarretas04, source, true )
        setElementData ( source, "Carteira:StartCarretas03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas04 then
        if getElementData( source, "Carteira:StartCarretas03", true ) then
        setElementVisibleTo ( MarkerCarretas04, source, false )
        setElementVisibleTo ( BlipCarretas04, source, false )
        setElementVisibleTo ( MarkerCarretas05, source, true )
        setElementVisibleTo ( BlipCarretas05, source, true )
        setElementData ( source, "Carteira:StartCarretas04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas05 then
        if getElementData( source, "Carteira:StartCarretas04", true ) then
        setElementVisibleTo ( MarkerCarretas05, source, false )
        setElementVisibleTo ( BlipCarretas05, source, false )
        setElementVisibleTo ( MarkerCarretas06, source, true )
        setElementVisibleTo ( BlipCarretas06, source, true )
        setElementData ( source, "Carteira:StartCarretas05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas06 then
        if getElementData( source, "Carteira:StartCarretas05", true ) then
        setElementVisibleTo ( MarkerCarretas06, source, false )
        setElementVisibleTo ( BlipCarretas06, source, false )
        setElementVisibleTo ( MarkerCarretas07, source, true )
        setElementVisibleTo ( BlipCarretas07, source, true )
        setElementData ( source, "Carteira:StartCarretas06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas07 then
        if getElementData( source, "Carteira:StartCarretas06", true ) then
        setElementVisibleTo ( MarkerCarretas07, source, false )
        setElementVisibleTo ( BlipCarretas07, source, false )
        setElementVisibleTo ( MarkerCarretas08, source, true )
        setElementVisibleTo ( BlipCarretas08, source, true )
        setElementData ( source, "Carteira:StartCarretas07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas08 then
        if getElementData( source, "Carteira:StartCarretas07", true ) then
        setElementVisibleTo ( MarkerCarretas08, source, false )
        setElementVisibleTo ( BlipCarretas08, source, false )
        setElementVisibleTo ( MarkerCarretas09, source, true )
        setElementVisibleTo ( BlipCarretas09, source, true )
        setElementData ( source, "Carteira:StartCarretas08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas09 then
        if getElementData( source, "Carteira:StartCarretas08", true ) then
        setElementVisibleTo ( MarkerCarretas09, source, false )
        setElementVisibleTo ( BlipCarretas09, source, false )
        setElementVisibleTo ( MarkerCarretas10, source, true )
        setElementVisibleTo ( BlipCarretas10, source, true )
        setElementData ( source, "Carteira:StartCarretas09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas10 then
        if getElementData( source, "Carteira:StartCarretas09", true ) then
        setElementVisibleTo ( MarkerCarretas10, source, false )
        setElementVisibleTo ( BlipCarretas10, source, false )
        setElementVisibleTo ( MarkerCarretas11, source, true )
        setElementVisibleTo ( BlipCarretas11, source, true )
        setElementData ( source, "Carteira:StartCarretas10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas11 then
        if getElementData( source, "Carteira:StartCarretas10", true ) then
        setElementVisibleTo ( MarkerCarretas11, source, false )
        setElementVisibleTo ( BlipCarretas11, source, false )
        setElementVisibleTo ( MarkerCarretas12, source, true )
        setElementVisibleTo ( BlipCarretas12, source, true )
        setElementData ( source, "Carteira:StartCarretas11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas12 then
        if getElementData( source, "Carteira:StartCarretas11", true ) then
        setElementVisibleTo ( MarkerCarretas12, source, false )
        setElementVisibleTo ( BlipCarretas12, source, false )
        setElementVisibleTo ( MarkerCarretas13, source, true )
        setElementVisibleTo ( BlipCarretas13, source, true )
        setElementData ( source, "Carteira:StartCarretas12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas13 then
        if getElementData( source, "Carteira:StartCarretas12", true ) then
        setElementVisibleTo ( MarkerCarretas13, source, false )
        setElementVisibleTo ( BlipCarretas13, source, false )
        setElementVisibleTo ( MarkerCarretas14, source, true )
        setElementVisibleTo ( BlipCarretas14, source, true )
        setElementData ( source, "Carteira:StartCarretas13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas14 then
        if getElementData( source, "Carteira:StartCarretas13", true ) then
        setElementVisibleTo ( MarkerCarretas14, source, false )
        setElementVisibleTo ( BlipCarretas14, source, false )
        setElementVisibleTo ( MarkerCarretas15, source, true )
        setElementVisibleTo ( BlipCarretas15, source, true )
        setElementData ( source, "Carteira:StartCarretas14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas15 then
        if getElementData( source, "Carteira:StartCarretas14", true ) then
        setElementVisibleTo ( MarkerCarretas15, source, false )
        setElementVisibleTo ( BlipCarretas15, source, false )
        setElementVisibleTo ( MarkerCarretas16, source, true )
        setElementVisibleTo ( BlipCarretas16, source, true )
        setElementData ( source, "Carteira:StartCarretas15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerCarretas16 then
        if getElementData( source, "Carteira:StartCarretas15", true ) then
        AutoEscolaCarretasVida = getElementHealth ( AutoEscolaCarretas[source] )
        if AutoEscolaCarretasVida <= CarretasDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgCarretas04, "error")
        else
        setElementData( source, "Habilitacoes:Carretas", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgCarretas05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarretas15", false )
        setElementVisibleTo ( MarkerCarretas16, source, false )
        setElementVisibleTo ( BlipCarretas16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaCarretas[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCarretas)

function SairDoVeiculoAutoEscolaCarretas (source)
if ( AutoEscolaCarretas[source] ) and isElement( AutoEscolaCarretas[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarretas[source] )
setElementData ( source, "Carteira:StartCarretas00", false )
setElementData ( source, "Carteira:StartCarretas01", false )
setElementData ( source, "Carteira:StartCarretas02", false )
setElementData ( source, "Carteira:StartCarretas03", false )
setElementData ( source, "Carteira:StartCarretas04", false )
setElementData ( source, "Carteira:StartCarretas05", false )
setElementData ( source, "Carteira:StartCarretas06", false )
setElementData ( source, "Carteira:StartCarretas07", false )
setElementData ( source, "Carteira:StartCarretas08", false )
setElementData ( source, "Carteira:StartCarretas09", false )
setElementData ( source, "Carteira:StartCarretas10", false )
setElementData ( source, "Carteira:StartCarretas11", false )
setElementData ( source, "Carteira:StartCarretas12", false )
setElementData ( source, "Carteira:StartCarretas13", false )
setElementData ( source, "Carteira:StartCarretas14", false )
setElementData ( source, "Carteira:StartCarretas15", false )
setElementVisibleTo ( MarkerCarretas01, source, false )
setElementVisibleTo ( BlipCarretas01, source, false )
setElementVisibleTo ( MarkerCarretas02, source, false )
setElementVisibleTo ( BlipCarretas02, source, false )
setElementVisibleTo ( MarkerCarretas03, source, false )
setElementVisibleTo ( BlipCarretas03, source, false )
setElementVisibleTo ( MarkerCarretas04, source, false )
setElementVisibleTo ( BlipCarretas04, source, false )
setElementVisibleTo ( MarkerCarretas05, source, false )
setElementVisibleTo ( BlipCarretas05, source, false )
setElementVisibleTo ( MarkerCarretas06, source, false )
setElementVisibleTo ( BlipCarretas06, source, false )
setElementVisibleTo ( MarkerCarretas07, source, false )
setElementVisibleTo ( BlipCarretas07, source, false )
setElementVisibleTo ( MarkerCarretas08, source, false )
setElementVisibleTo ( BlipCarretas08, source, false )
setElementVisibleTo ( MarkerCarretas09, source, false )
setElementVisibleTo ( BlipCarretas09, source, false )
setElementVisibleTo ( MarkerCarretas10, source, false )
setElementVisibleTo ( BlipCarretas10, source, false )
setElementVisibleTo ( MarkerCarretas11, source, false )
setElementVisibleTo ( BlipCarretas11, source, false )
setElementVisibleTo ( MarkerCarretas12, source, false )
setElementVisibleTo ( BlipCarretas12, source, false )
setElementVisibleTo ( MarkerCarretas13, source, false )
setElementVisibleTo ( BlipCarretas13, source, false )
setElementVisibleTo ( MarkerCarretas14, source, false )
setElementVisibleTo ( BlipCarretas14, source, false )
setElementVisibleTo ( MarkerCarretas15, source, false )
setElementVisibleTo ( BlipCarretas15, source, false )
setElementVisibleTo ( MarkerCarretas16, source, false )
setElementVisibleTo ( BlipCarretas16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCarretas )

function MorrerAutoEscolaCarretas ()
if ( AutoEscolaCarretas[source] ) and isElement( AutoEscolaCarretas[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarretas[source] )
setElementData ( source, "Carteira:StartCarretas00", false )
setElementData ( source, "Carteira:StartCarretas01", false )
setElementData ( source, "Carteira:StartCarretas02", false )
setElementData ( source, "Carteira:StartCarretas03", false )
setElementData ( source, "Carteira:StartCarretas04", false )
setElementData ( source, "Carteira:StartCarretas05", false )
setElementData ( source, "Carteira:StartCarretas06", false )
setElementData ( source, "Carteira:StartCarretas07", false )
setElementData ( source, "Carteira:StartCarretas08", false )
setElementData ( source, "Carteira:StartCarretas09", false )
setElementData ( source, "Carteira:StartCarretas10", false )
setElementData ( source, "Carteira:StartCarretas11", false )
setElementData ( source, "Carteira:StartCarretas12", false )
setElementData ( source, "Carteira:StartCarretas13", false )
setElementData ( source, "Carteira:StartCarretas14", false )
setElementData ( source, "Carteira:StartCarretas15", false )
setElementVisibleTo ( MarkerCarretas01, source, false )
setElementVisibleTo ( BlipCarretas01, source, false )
setElementVisibleTo ( MarkerCarretas02, source, false )
setElementVisibleTo ( BlipCarretas02, source, false )
setElementVisibleTo ( MarkerCarretas03, source, false )
setElementVisibleTo ( BlipCarretas03, source, false )
setElementVisibleTo ( MarkerCarretas04, source, false )
setElementVisibleTo ( BlipCarretas04, source, false )
setElementVisibleTo ( MarkerCarretas05, source, false )
setElementVisibleTo ( BlipCarretas05, source, false )
setElementVisibleTo ( MarkerCarretas06, source, false )
setElementVisibleTo ( BlipCarretas06, source, false )
setElementVisibleTo ( MarkerCarretas07, source, false )
setElementVisibleTo ( BlipCarretas07, source, false )
setElementVisibleTo ( MarkerCarretas08, source, false )
setElementVisibleTo ( BlipCarretas08, source, false )
setElementVisibleTo ( MarkerCarretas09, source, false )
setElementVisibleTo ( BlipCarretas09, source, false )
setElementVisibleTo ( MarkerCarretas10, source, false )
setElementVisibleTo ( BlipCarretas10, source, false )
setElementVisibleTo ( MarkerCarretas11, source, false )
setElementVisibleTo ( BlipCarretas11, source, false )
setElementVisibleTo ( MarkerCarretas12, source, false )
setElementVisibleTo ( BlipCarretas12, source, false )
setElementVisibleTo ( MarkerCarretas13, source, false )
setElementVisibleTo ( BlipCarretas13, source, false )
setElementVisibleTo ( MarkerCarretas14, source, false )
setElementVisibleTo ( BlipCarretas14, source, false )
setElementVisibleTo ( MarkerCarretas15, source, false )
setElementVisibleTo ( BlipCarretas15, source, false )
setElementVisibleTo ( MarkerCarretas16, source, false )
setElementVisibleTo ( BlipCarretas16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarretas07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCarretas )

function SairDoServidorAutoEscolaCarretas ( quitType )    
if isElement( AutoEscolaCarretas[source] ) then
destroyElement ( AutoEscolaCarretas[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCarretas )

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Barcos

BarcosRX, BarcosRY, BarcosRZ           = 2094.08521, -102.32258, 0.51715 -- Coordenadas de Respawn do Barco
BarcosRotA, BarcosRotB, BarcosRotC     = 0, 0, 125.45202636719 -- Rotação do Veiculo ao Spawnar
BarcosID                               = 446 -- ID do Barco
HabValorBarcos                         = 3000 -- Valor da Habilitação Categoria "Barcos"
BarcosDanoParaReprovar                 = 950 -- 95%

MsgBarcos01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgBarcos02 = "Você Não Tem Dinheiro Suficiente!"
MsgBarcos03 = "Você Ja Possui Essa Habilitação!"
MsgBarcos04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgBarcos05 = "Carteira de Habilitação Categoria 'Barcos' Concedida!"
MsgBarcos06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgBarcos07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

BarcosX01, BarcosY01, BarcosZ01 = 1969.37048, -76.51154, 0.61060
BarcosX02, BarcosY02, BarcosZ02 = 1778.74304, -25.28976, 1.06329
BarcosX03, BarcosY03, BarcosZ03 = 1604.60706, -42.24431, 0.20777
BarcosX04, BarcosY04, BarcosZ04 = 1564.81091, -188.31783, 1.03013
BarcosX05, BarcosY05, BarcosZ05 = 1351.16663, -255.22849, 0.64836
BarcosX06, BarcosY06, BarcosZ06 = 1224.50562, -147.91315, 0.70902
BarcosX07, BarcosY07, BarcosZ07 = 1078.58972, -103.00694, 0.49749
BarcosX08, BarcosY08, BarcosZ08 = 872.80511, -122.47253, 0.59834
BarcosX09, BarcosY09, BarcosZ09 = 752.33319, -192.47580, 0.66709
BarcosX10, BarcosY10, BarcosZ10 = 565.60455, -235.80785, 0.71552
BarcosX11, BarcosY11, BarcosZ11 = 389.19714, -285.92471, 0.58013
BarcosX12, BarcosY12, BarcosZ12 = 271.44901, -375.78848, 0.61753
BarcosX13, BarcosY13, BarcosZ13 = 109.00140, -434.07193, 0.24948
BarcosX14, BarcosY14, BarcosZ14 = -87.17338, -609.55768, -0.14524
BarcosX15, BarcosY15, BarcosZ15 = -217.76225, -535.85645, 0.12518
BarcosX16, BarcosY16, BarcosZ16 = -331.42117, -468.58258, 0.62195

MarkerBarcos01 = createMarker ( BarcosX01, BarcosY01, BarcosZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos01 = createBlipAttachedTo ( MarkerBarcos01, 0 )
setElementVisibleTo ( MarkerBarcos01, root, false )
setElementVisibleTo ( BlipBarcos01, root, false )

MarkerBarcos02 = createMarker ( BarcosX02, BarcosY02, BarcosZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos02 = createBlipAttachedTo ( MarkerBarcos02, 0 )
setElementVisibleTo ( MarkerBarcos02, root, false )
setElementVisibleTo ( BlipBarcos02, root, false )

MarkerBarcos03 = createMarker ( BarcosX03, BarcosY03, BarcosZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos03 = createBlipAttachedTo ( MarkerBarcos03, 0 )
setElementVisibleTo ( MarkerBarcos03, root, false )
setElementVisibleTo ( BlipBarcos03, root, false )

MarkerBarcos04 = createMarker ( BarcosX04, BarcosY04, BarcosZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos04 = createBlipAttachedTo ( MarkerBarcos04, 0 )
setElementVisibleTo ( MarkerBarcos04, root, false )
setElementVisibleTo ( BlipBarcos04, root, false )

MarkerBarcos05 = createMarker ( BarcosX05, BarcosY05, BarcosZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos05 = createBlipAttachedTo ( MarkerBarcos05, 0 )
setElementVisibleTo ( MarkerBarcos05, root, false )
setElementVisibleTo ( BlipBarcos05, root, false )

MarkerBarcos06 = createMarker ( BarcosX06, BarcosY06, BarcosZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos06 = createBlipAttachedTo ( MarkerBarcos06, 0 )
setElementVisibleTo ( MarkerBarcos06, root, false )
setElementVisibleTo ( BlipBarcos06, root, false )

MarkerBarcos07 = createMarker ( BarcosX07, BarcosY07, BarcosZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos07 = createBlipAttachedTo ( MarkerBarcos07, 0 )
setElementVisibleTo ( MarkerBarcos07, root, false )
setElementVisibleTo ( BlipBarcos07, root, false )

MarkerBarcos08 = createMarker ( BarcosX08, BarcosY08, BarcosZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos08 = createBlipAttachedTo ( MarkerBarcos08, 0 )
setElementVisibleTo ( MarkerBarcos08, root, false )
setElementVisibleTo ( BlipBarcos08, root, false )

MarkerBarcos09 = createMarker ( BarcosX09, BarcosY09, BarcosZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos09 = createBlipAttachedTo ( MarkerBarcos09, 0 )
setElementVisibleTo ( MarkerBarcos09, root, false )
setElementVisibleTo ( BlipBarcos09, root, false )

MarkerBarcos10 = createMarker ( BarcosX10, BarcosY10, BarcosZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos10 = createBlipAttachedTo ( MarkerBarcos10, 0 )
setElementVisibleTo ( MarkerBarcos10, root, false )
setElementVisibleTo ( BlipBarcos10, root, false )

MarkerBarcos11 = createMarker ( BarcosX11, BarcosY11, BarcosZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos11 = createBlipAttachedTo ( MarkerBarcos11, 0 )
setElementVisibleTo ( MarkerBarcos11, root, false )
setElementVisibleTo ( BlipBarcos11, root, false )

MarkerBarcos12 = createMarker ( BarcosX12, BarcosY12, BarcosZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos12 = createBlipAttachedTo ( MarkerBarcos12, 0 )
setElementVisibleTo ( MarkerBarcos12, root, false )
setElementVisibleTo ( BlipBarcos12, root, false )

MarkerBarcos13 = createMarker ( BarcosX13, BarcosY13, BarcosZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos13 = createBlipAttachedTo ( MarkerBarcos13, 0 )
setElementVisibleTo ( MarkerBarcos13, root, false )
setElementVisibleTo ( BlipBarcos13, root, false )

MarkerBarcos14 = createMarker ( BarcosX14, BarcosY14, BarcosZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos14 = createBlipAttachedTo ( MarkerBarcos14, 0 )
setElementVisibleTo ( MarkerBarcos14, root, false )
setElementVisibleTo ( BlipBarcos14, root, false )

MarkerBarcos15 = createMarker ( BarcosX15, BarcosY15, BarcosZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos15 = createBlipAttachedTo ( MarkerBarcos15, 0 )
setElementVisibleTo ( MarkerBarcos15, root, false )
setElementVisibleTo ( BlipBarcos15, root, false )

MarkerBarcos16 = createMarker ( BarcosX16, BarcosY16, BarcosZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipBarcos16 = createBlipAttachedTo ( MarkerBarcos16, 0 )
setElementVisibleTo ( MarkerBarcos16, root, false )
setElementVisibleTo ( BlipBarcos16, root, false )

AutoEscolaBarcos = {}

function BarcosHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Barcos" ) == true then
if getPlayerMoney(source) >= HabValorBarcos then
takePlayerMoney(source, HabValorBarcos)
if AutoEscolaBarcos[source] and isElement( AutoEscolaBarcos[source] ) then destroyElement ( AutoEscolaBarcos[source] )
AutoEscolaBarcos[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaBarcos[source] = createVehicle( BarcosID, BarcosRX, BarcosRY, BarcosRZ )
setElementRotation ( AutoEscolaBarcos[source], BarcosRotA, BarcosRotB, BarcosRotC )
setVehicleLocked ( AutoEscolaBarcos[source], true )
warpPedIntoVehicle ( source, AutoEscolaBarcos[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartBarcos00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerBarcos01, source, true )
setElementVisibleTo ( BlipBarcos01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos03, "warning")
end
end
addEvent("Hab:Barco", true)
addEventHandler ( "Hab:Barco", root, BarcosHab)

function emarkerBarcos(marker,md) 
    if (md) then
      if AutoEscolaBarcos[source] and isElement( AutoEscolaBarcos[source] ) then
        if marker == MarkerBarcos01 then
        if getElementData( source, "Carteira:StartBarcos00", true ) then
        setElementVisibleTo ( MarkerBarcos01, source, false )
        setElementVisibleTo ( BlipBarcos01, source, false )
        setElementVisibleTo ( MarkerBarcos02, source, true )
        setElementVisibleTo ( BlipBarcos02, source, true )
        setElementData ( source, "Carteira:StartBarcos01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos02 then
        if getElementData( source, "Carteira:StartBarcos01", true ) then
        setElementVisibleTo ( MarkerBarcos02, source, false )
        setElementVisibleTo ( BlipBarcos02, source, false )
        setElementVisibleTo ( MarkerBarcos03, source, true )
        setElementVisibleTo ( BlipBarcos03, source, true )
        setElementData ( source, "Carteira:StartBarcos02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos03 then
        if getElementData( source, "Carteira:StartBarcos02", true ) then
        setElementVisibleTo ( MarkerBarcos03, source, false )
        setElementVisibleTo ( BlipBarcos03, source, false )
        setElementVisibleTo ( MarkerBarcos04, source, true )
        setElementVisibleTo ( BlipBarcos04, source, true )
        setElementData ( source, "Carteira:StartBarcos03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos04 then
        if getElementData( source, "Carteira:StartBarcos03", true ) then
        setElementVisibleTo ( MarkerBarcos04, source, false )
        setElementVisibleTo ( BlipBarcos04, source, false )
        setElementVisibleTo ( MarkerBarcos05, source, true )
        setElementVisibleTo ( BlipBarcos05, source, true )
        setElementData ( source, "Carteira:StartBarcos04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos05 then
        if getElementData( source, "Carteira:StartBarcos04", true ) then
        setElementVisibleTo ( MarkerBarcos05, source, false )
        setElementVisibleTo ( BlipBarcos05, source, false )
        setElementVisibleTo ( MarkerBarcos06, source, true )
        setElementVisibleTo ( BlipBarcos06, source, true )
        setElementData ( source, "Carteira:StartBarcos05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos06 then
        if getElementData( source, "Carteira:StartBarcos05", true ) then
        setElementVisibleTo ( MarkerBarcos06, source, false )
        setElementVisibleTo ( BlipBarcos06, source, false )
        setElementVisibleTo ( MarkerBarcos07, source, true )
        setElementVisibleTo ( BlipBarcos07, source, true )
        setElementData ( source, "Carteira:StartBarcos06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos07 then
        if getElementData( source, "Carteira:StartBarcos06", true ) then
        setElementVisibleTo ( MarkerBarcos07, source, false )
        setElementVisibleTo ( BlipBarcos07, source, false )
        setElementVisibleTo ( MarkerBarcos08, source, true )
        setElementVisibleTo ( BlipBarcos08, source, true )
        setElementData ( source, "Carteira:StartBarcos07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos08 then
        if getElementData( source, "Carteira:StartBarcos07", true ) then
        setElementVisibleTo ( MarkerBarcos08, source, false )
        setElementVisibleTo ( BlipBarcos08, source, false )
        setElementVisibleTo ( MarkerBarcos09, source, true )
        setElementVisibleTo ( BlipBarcos09, source, true )
        setElementData ( source, "Carteira:StartBarcos08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos09 then
        if getElementData( source, "Carteira:StartBarcos08", true ) then
        setElementVisibleTo ( MarkerBarcos09, source, false )
        setElementVisibleTo ( BlipBarcos09, source, false )
        setElementVisibleTo ( MarkerBarcos10, source, true )
        setElementVisibleTo ( BlipBarcos10, source, true )
        setElementData ( source, "Carteira:StartBarcos09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos10 then
        if getElementData( source, "Carteira:StartBarcos09", true ) then
        setElementVisibleTo ( MarkerBarcos10, source, false )
        setElementVisibleTo ( BlipBarcos10, source, false )
        setElementVisibleTo ( MarkerBarcos11, source, true )
        setElementVisibleTo ( BlipBarcos11, source, true )
        setElementData ( source, "Carteira:StartBarcos10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos11 then
        if getElementData( source, "Carteira:StartBarcos10", true ) then
        setElementVisibleTo ( MarkerBarcos11, source, false )
        setElementVisibleTo ( BlipBarcos11, source, false )
        setElementVisibleTo ( MarkerBarcos12, source, true )
        setElementVisibleTo ( BlipBarcos12, source, true )
        setElementData ( source, "Carteira:StartBarcos11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos12 then
        if getElementData( source, "Carteira:StartBarcos11", true ) then
        setElementVisibleTo ( MarkerBarcos12, source, false )
        setElementVisibleTo ( BlipBarcos12, source, false )
        setElementVisibleTo ( MarkerBarcos13, source, true )
        setElementVisibleTo ( BlipBarcos13, source, true )
        setElementData ( source, "Carteira:StartBarcos12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos13 then
        if getElementData( source, "Carteira:StartBarcos12", true ) then
        setElementVisibleTo ( MarkerBarcos13, source, false )
        setElementVisibleTo ( BlipBarcos13, source, false )
        setElementVisibleTo ( MarkerBarcos14, source, true )
        setElementVisibleTo ( BlipBarcos14, source, true )
        setElementData ( source, "Carteira:StartBarcos13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos14 then
        if getElementData( source, "Carteira:StartBarcos13", true ) then
        setElementVisibleTo ( MarkerBarcos14, source, false )
        setElementVisibleTo ( BlipBarcos14, source, false )
        setElementVisibleTo ( MarkerBarcos15, source, true )
        setElementVisibleTo ( BlipBarcos15, source, true )
        setElementData ( source, "Carteira:StartBarcos14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos15 then
        if getElementData( source, "Carteira:StartBarcos14", true ) then
        setElementVisibleTo ( MarkerBarcos15, source, false )
        setElementVisibleTo ( BlipBarcos15, source, false )
        setElementVisibleTo ( MarkerBarcos16, source, true )
        setElementVisibleTo ( BlipBarcos16, source, true )
        setElementData ( source, "Carteira:StartBarcos15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerBarcos16 then
        if getElementData( source, "Carteira:StartBarcos15", true ) then
        AutoEscolaBarcosVida = getElementHealth ( AutoEscolaBarcos[source] )
        if AutoEscolaBarcosVida <= BarcosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgBarcos04, "error")
        else
        setElementData( source, "Habilitacoes:Barcos", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgBarcos05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartBarcos15", false )
        setElementVisibleTo ( MarkerBarcos16, source, false )
        setElementVisibleTo ( BlipBarcos16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaBarcos[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerBarcos)

function SairDoVeiculoAutoEscolaBarcos (source)
if ( AutoEscolaBarcos[source] ) and isElement( AutoEscolaBarcos[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaBarcos[source] )
setElementData ( source, "Carteira:StartBarcos00", false )
setElementData ( source, "Carteira:StartBarcos01", false )
setElementData ( source, "Carteira:StartBarcos02", false )
setElementData ( source, "Carteira:StartBarcos03", false )
setElementData ( source, "Carteira:StartBarcos04", false )
setElementData ( source, "Carteira:StartBarcos05", false )
setElementData ( source, "Carteira:StartBarcos06", false )
setElementData ( source, "Carteira:StartBarcos07", false )
setElementData ( source, "Carteira:StartBarcos08", false )
setElementData ( source, "Carteira:StartBarcos09", false )
setElementData ( source, "Carteira:StartBarcos10", false )
setElementData ( source, "Carteira:StartBarcos11", false )
setElementData ( source, "Carteira:StartBarcos12", false )
setElementData ( source, "Carteira:StartBarcos13", false )
setElementData ( source, "Carteira:StartBarcos14", false )
setElementData ( source, "Carteira:StartBarcos15", false )
setElementVisibleTo ( MarkerBarcos01, source, false )
setElementVisibleTo ( BlipBarcos01, source, false )
setElementVisibleTo ( MarkerBarcos02, source, false )
setElementVisibleTo ( BlipBarcos02, source, false )
setElementVisibleTo ( MarkerBarcos03, source, false )
setElementVisibleTo ( BlipBarcos03, source, false )
setElementVisibleTo ( MarkerBarcos04, source, false )
setElementVisibleTo ( BlipBarcos04, source, false )
setElementVisibleTo ( MarkerBarcos05, source, false )
setElementVisibleTo ( BlipBarcos05, source, false )
setElementVisibleTo ( MarkerBarcos06, source, false )
setElementVisibleTo ( BlipBarcos06, source, false )
setElementVisibleTo ( MarkerBarcos07, source, false )
setElementVisibleTo ( BlipBarcos07, source, false )
setElementVisibleTo ( MarkerBarcos08, source, false )
setElementVisibleTo ( BlipBarcos08, source, false )
setElementVisibleTo ( MarkerBarcos09, source, false )
setElementVisibleTo ( BlipBarcos09, source, false )
setElementVisibleTo ( MarkerBarcos10, source, false )
setElementVisibleTo ( BlipBarcos10, source, false )
setElementVisibleTo ( MarkerBarcos11, source, false )
setElementVisibleTo ( BlipBarcos11, source, false )
setElementVisibleTo ( MarkerBarcos12, source, false )
setElementVisibleTo ( BlipBarcos12, source, false )
setElementVisibleTo ( MarkerBarcos13, source, false )
setElementVisibleTo ( BlipBarcos13, source, false )
setElementVisibleTo ( MarkerBarcos14, source, false )
setElementVisibleTo ( BlipBarcos14, source, false )
setElementVisibleTo ( MarkerBarcos15, source, false )
setElementVisibleTo ( BlipBarcos15, source, false )
setElementVisibleTo ( MarkerBarcos16, source, false )
setElementVisibleTo ( BlipBarcos16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaBarcos )

function MorrerAutoEscolaBarcos ()
if ( AutoEscolaBarcos[source] ) and isElement( AutoEscolaBarcos[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaBarcos[source] )
setElementData ( source, "Carteira:StartBarcos00", false )
setElementData ( source, "Carteira:StartBarcos01", false )
setElementData ( source, "Carteira:StartBarcos02", false )
setElementData ( source, "Carteira:StartBarcos03", false )
setElementData ( source, "Carteira:StartBarcos04", false )
setElementData ( source, "Carteira:StartBarcos05", false )
setElementData ( source, "Carteira:StartBarcos06", false )
setElementData ( source, "Carteira:StartBarcos07", false )
setElementData ( source, "Carteira:StartBarcos08", false )
setElementData ( source, "Carteira:StartBarcos09", false )
setElementData ( source, "Carteira:StartBarcos10", false )
setElementData ( source, "Carteira:StartBarcos11", false )
setElementData ( source, "Carteira:StartBarcos12", false )
setElementData ( source, "Carteira:StartBarcos13", false )
setElementData ( source, "Carteira:StartBarcos14", false )
setElementData ( source, "Carteira:StartBarcos15", false )
setElementVisibleTo ( MarkerBarcos01, source, false )
setElementVisibleTo ( BlipBarcos01, source, false )
setElementVisibleTo ( MarkerBarcos02, source, false )
setElementVisibleTo ( BlipBarcos02, source, false )
setElementVisibleTo ( MarkerBarcos03, source, false )
setElementVisibleTo ( BlipBarcos03, source, false )
setElementVisibleTo ( MarkerBarcos04, source, false )
setElementVisibleTo ( BlipBarcos04, source, false )
setElementVisibleTo ( MarkerBarcos05, source, false )
setElementVisibleTo ( BlipBarcos05, source, false )
setElementVisibleTo ( MarkerBarcos06, source, false )
setElementVisibleTo ( BlipBarcos06, source, false )
setElementVisibleTo ( MarkerBarcos07, source, false )
setElementVisibleTo ( BlipBarcos07, source, false )
setElementVisibleTo ( MarkerBarcos08, source, false )
setElementVisibleTo ( BlipBarcos08, source, false )
setElementVisibleTo ( MarkerBarcos09, source, false )
setElementVisibleTo ( BlipBarcos09, source, false )
setElementVisibleTo ( MarkerBarcos10, source, false )
setElementVisibleTo ( BlipBarcos10, source, false )
setElementVisibleTo ( MarkerBarcos11, source, false )
setElementVisibleTo ( BlipBarcos11, source, false )
setElementVisibleTo ( MarkerBarcos12, source, false )
setElementVisibleTo ( BlipBarcos12, source, false )
setElementVisibleTo ( MarkerBarcos13, source, false )
setElementVisibleTo ( BlipBarcos13, source, false )
setElementVisibleTo ( MarkerBarcos14, source, false )
setElementVisibleTo ( BlipBarcos14, source, false )
setElementVisibleTo ( MarkerBarcos15, source, false )
setElementVisibleTo ( BlipBarcos15, source, false )
setElementVisibleTo ( MarkerBarcos16, source, false )
setElementVisibleTo ( BlipBarcos16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgBarcos07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaBarcos )

function SairDoServidorAutoEscolaBarcos ( quitType )    
if isElement( AutoEscolaBarcos[source] ) then
destroyElement ( AutoEscolaBarcos[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaBarcos )

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Helicopteros

HelicopterosRX, HelicopterosRY, HelicopterosRZ           = 190.13397, -302.89218, 1.57813 -- Coordenadas de Respawn do Helicoptero
HelicopterosRotA, HelicopterosRotB, HelicopterosRotC     = 0, 0, 0 -- Rotação do Veiculo ao Spawnar
HelicopterosID                               = 469 -- ID do Helicoptero
HabValorHelicopteros                         = 10000 -- Valor da Habilitação Categoria "Helicopteros"
HelicopterosDanoParaReprovar                 = 950 -- 95%

MsgHelicopteros01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgHelicopteros02 = "Você Não Tem Dinheiro Suficiente!"
MsgHelicopteros03 = "Você Ja Possui Essa Habilitação!"
MsgHelicopteros04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgHelicopteros05 = "Carteira de Habilitação Categoria 'Helicopteros' Concedida!"
MsgHelicopteros06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgHelicopteros07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

HelicopterosX01, HelicopterosY01, HelicopterosZ01 = 192.54529, -255.43195, 19.71858
HelicopterosX02, HelicopterosY02, HelicopterosZ02 = 289.75629, -62.69717, 38.09697
HelicopterosX03, HelicopterosY03, HelicopterosZ03 = 387.02344, 109.72382, 49.56145
HelicopterosX04, HelicopterosY04, HelicopterosZ04 = 523.74475, 401.76590, 59.54094
HelicopterosX05, HelicopterosY05, HelicopterosZ05 = 648.68756, 623.60193, 53.53587
HelicopterosX06, HelicopterosY06, HelicopterosZ06 = 821.34821, 797.55927, 57.30814
HelicopterosX07, HelicopterosY07, HelicopterosZ07 = 923.19025, 960.18860, 59.13763
HelicopterosX08, HelicopterosY08, HelicopterosZ08 = 1101.84985, 1189.58154, 66.81283
HelicopterosX09, HelicopterosY09, HelicopterosZ09 = 1265.18176, 1356.48291, 64.21224
HelicopterosX10, HelicopterosY10, HelicopterosZ10 = 1423.97729, 1519.96594, 74.06803
HelicopterosX11, HelicopterosY11, HelicopterosZ11 = 1599.68640, 1664.47388, 70.88983
HelicopterosX12, HelicopterosY12, HelicopterosZ12 = 1755.91052, 1766.84497, 103.27734
HelicopterosX13, HelicopterosY13, HelicopterosZ13 = 1905.53833, 1863.55908, 143.65627
HelicopterosX14, HelicopterosY14, HelicopterosZ14 = 2048.65479, 1947.74756, 106.53687
HelicopterosX15, HelicopterosY15, HelicopterosZ15 = 2107.26782, 2225.87476, 99.85953
HelicopterosX16, HelicopterosY16, HelicopterosZ16 = 2092.58252, 2415.30615, 74.52721

MarkerHelicopteros01 = createMarker ( HelicopterosX01, HelicopterosY01, HelicopterosZ01 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros01 = createBlipAttachedTo ( MarkerHelicopteros01, 0 )
setElementVisibleTo ( MarkerHelicopteros01, root, false )
setElementVisibleTo ( BlipHelicopteros01, root, false )

MarkerHelicopteros02 = createMarker ( HelicopterosX02, HelicopterosY02, HelicopterosZ02 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros02 = createBlipAttachedTo ( MarkerHelicopteros02, 0 )
setElementVisibleTo ( MarkerHelicopteros02, root, false )
setElementVisibleTo ( BlipHelicopteros02, root, false )

MarkerHelicopteros03 = createMarker ( HelicopterosX03, HelicopterosY03, HelicopterosZ03 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros03 = createBlipAttachedTo ( MarkerHelicopteros03, 0 )
setElementVisibleTo ( MarkerHelicopteros03, root, false )
setElementVisibleTo ( BlipHelicopteros03, root, false )

MarkerHelicopteros04 = createMarker ( HelicopterosX04, HelicopterosY04, HelicopterosZ04 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros04 = createBlipAttachedTo ( MarkerHelicopteros04, 0 )
setElementVisibleTo ( MarkerHelicopteros04, root, false )
setElementVisibleTo ( BlipHelicopteros04, root, false )

MarkerHelicopteros05 = createMarker ( HelicopterosX05, HelicopterosY05, HelicopterosZ05 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros05 = createBlipAttachedTo ( MarkerHelicopteros05, 0 )
setElementVisibleTo ( MarkerHelicopteros05, root, false )
setElementVisibleTo ( BlipHelicopteros05, root, false )

MarkerHelicopteros06 = createMarker ( HelicopterosX06, HelicopterosY06, HelicopterosZ06 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros06 = createBlipAttachedTo ( MarkerHelicopteros06, 0 )
setElementVisibleTo ( MarkerHelicopteros06, root, false )
setElementVisibleTo ( BlipHelicopteros06, root, false )

MarkerHelicopteros07 = createMarker ( HelicopterosX07, HelicopterosY07, HelicopterosZ07 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros07 = createBlipAttachedTo ( MarkerHelicopteros07, 0 )
setElementVisibleTo ( MarkerHelicopteros07, root, false )
setElementVisibleTo ( BlipHelicopteros07, root, false )

MarkerHelicopteros08 = createMarker ( HelicopterosX08, HelicopterosY08, HelicopterosZ08 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros08 = createBlipAttachedTo ( MarkerHelicopteros08, 0 )
setElementVisibleTo ( MarkerHelicopteros08, root, false )
setElementVisibleTo ( BlipHelicopteros08, root, false )

MarkerHelicopteros09 = createMarker ( HelicopterosX09, HelicopterosY09, HelicopterosZ09 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros09 = createBlipAttachedTo ( MarkerHelicopteros09, 0 )
setElementVisibleTo ( MarkerHelicopteros09, root, false )
setElementVisibleTo ( BlipHelicopteros09, root, false )

MarkerHelicopteros10 = createMarker ( HelicopterosX10, HelicopterosY10, HelicopterosZ10 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros10 = createBlipAttachedTo ( MarkerHelicopteros10, 0 )
setElementVisibleTo ( MarkerHelicopteros10, root, false )
setElementVisibleTo ( BlipHelicopteros10, root, false )

MarkerHelicopteros11 = createMarker ( HelicopterosX11, HelicopterosY11, HelicopterosZ11 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros11 = createBlipAttachedTo ( MarkerHelicopteros11, 0 )
setElementVisibleTo ( MarkerHelicopteros11, root, false )
setElementVisibleTo ( BlipHelicopteros11, root, false )

MarkerHelicopteros12 = createMarker ( HelicopterosX12, HelicopterosY12, HelicopterosZ12 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros12 = createBlipAttachedTo ( MarkerHelicopteros12, 0 )
setElementVisibleTo ( MarkerHelicopteros12, root, false )
setElementVisibleTo ( BlipHelicopteros12, root, false )

MarkerHelicopteros13 = createMarker ( HelicopterosX13, HelicopterosY13, HelicopterosZ13 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros13 = createBlipAttachedTo ( MarkerHelicopteros13, 0 )
setElementVisibleTo ( MarkerHelicopteros13, root, false )
setElementVisibleTo ( BlipHelicopteros13, root, false )

MarkerHelicopteros14 = createMarker ( HelicopterosX14, HelicopterosY14, HelicopterosZ14 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros14 = createBlipAttachedTo ( MarkerHelicopteros14, 0 )
setElementVisibleTo ( MarkerHelicopteros14, root, false )
setElementVisibleTo ( BlipHelicopteros14, root, false )

MarkerHelicopteros15 = createMarker ( HelicopterosX15, HelicopterosY15, HelicopterosZ15 -1, "corona", 5, 255 ,0 ,0, 255)
BlipHelicopteros15 = createBlipAttachedTo ( MarkerHelicopteros15, 0 )
setElementVisibleTo ( MarkerHelicopteros15, root, false )
setElementVisibleTo ( BlipHelicopteros15, root, false )

MarkerHelicopteros16 = createMarker ( HelicopterosX16, HelicopterosY16, HelicopterosZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipHelicopteros16 = createBlipAttachedTo ( MarkerHelicopteros16, 0 )
setElementVisibleTo ( MarkerHelicopteros16, root, false )
setElementVisibleTo ( BlipHelicopteros16, root, false )

AutoEscolaHelicopteros = {}

function HelicopterosHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Helicopteros" ) == true then
if getPlayerMoney(source) >= HabValorHelicopteros then
takePlayerMoney(source, HabValorHelicopteros)
if AutoEscolaHelicopteros[source] and isElement( AutoEscolaHelicopteros[source] ) then destroyElement ( AutoEscolaHelicopteros[source] )
AutoEscolaHelicopteros[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaHelicopteros[source] = createVehicle( HelicopterosID, HelicopterosRX, HelicopterosRY, HelicopterosRZ )
setElementRotation ( AutoEscolaHelicopteros[source], HelicopterosRotA, HelicopterosRotB, HelicopterosRotC )
setVehicleLocked ( AutoEscolaHelicopteros[source], true )
warpPedIntoVehicle ( source, AutoEscolaHelicopteros[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartHelicopteros00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerHelicopteros01, source, true )
setElementVisibleTo ( BlipHelicopteros01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros03, "warning")
end
end
addEvent("Hab:Helicoptero", true)
addEventHandler ( "Hab:Helicoptero", root, HelicopterosHab)

function emarkerHelicopteros(marker,md) 
    if (md) then
      if AutoEscolaHelicopteros[source] and isElement( AutoEscolaHelicopteros[source] ) then
        if marker == MarkerHelicopteros01 then
        if getElementData( source, "Carteira:StartHelicopteros00", true ) then
        setElementVisibleTo ( MarkerHelicopteros01, source, false )
        setElementVisibleTo ( BlipHelicopteros01, source, false )
        setElementVisibleTo ( MarkerHelicopteros02, source, true )
        setElementVisibleTo ( BlipHelicopteros02, source, true )
        setElementData ( source, "Carteira:StartHelicopteros01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros02 then
        if getElementData( source, "Carteira:StartHelicopteros01", true ) then
        setElementVisibleTo ( MarkerHelicopteros02, source, false )
        setElementVisibleTo ( BlipHelicopteros02, source, false )
        setElementVisibleTo ( MarkerHelicopteros03, source, true )
        setElementVisibleTo ( BlipHelicopteros03, source, true )
        setElementData ( source, "Carteira:StartHelicopteros02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros03 then
        if getElementData( source, "Carteira:StartHelicopteros02", true ) then
        setElementVisibleTo ( MarkerHelicopteros03, source, false )
        setElementVisibleTo ( BlipHelicopteros03, source, false )
        setElementVisibleTo ( MarkerHelicopteros04, source, true )
        setElementVisibleTo ( BlipHelicopteros04, source, true )
        setElementData ( source, "Carteira:StartHelicopteros03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros04 then
        if getElementData( source, "Carteira:StartHelicopteros03", true ) then
        setElementVisibleTo ( MarkerHelicopteros04, source, false )
        setElementVisibleTo ( BlipHelicopteros04, source, false )
        setElementVisibleTo ( MarkerHelicopteros05, source, true )
        setElementVisibleTo ( BlipHelicopteros05, source, true )
        setElementData ( source, "Carteira:StartHelicopteros04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros05 then
        if getElementData( source, "Carteira:StartHelicopteros04", true ) then
        setElementVisibleTo ( MarkerHelicopteros05, source, false )
        setElementVisibleTo ( BlipHelicopteros05, source, false )
        setElementVisibleTo ( MarkerHelicopteros06, source, true )
        setElementVisibleTo ( BlipHelicopteros06, source, true )
        setElementData ( source, "Carteira:StartHelicopteros05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros06 then
        if getElementData( source, "Carteira:StartHelicopteros05", true ) then
        setElementVisibleTo ( MarkerHelicopteros06, source, false )
        setElementVisibleTo ( BlipHelicopteros06, source, false )
        setElementVisibleTo ( MarkerHelicopteros07, source, true )
        setElementVisibleTo ( BlipHelicopteros07, source, true )
        setElementData ( source, "Carteira:StartHelicopteros06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros07 then
        if getElementData( source, "Carteira:StartHelicopteros06", true ) then
        setElementVisibleTo ( MarkerHelicopteros07, source, false )
        setElementVisibleTo ( BlipHelicopteros07, source, false )
        setElementVisibleTo ( MarkerHelicopteros08, source, true )
        setElementVisibleTo ( BlipHelicopteros08, source, true )
        setElementData ( source, "Carteira:StartHelicopteros07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros08 then
        if getElementData( source, "Carteira:StartHelicopteros07", true ) then
        setElementVisibleTo ( MarkerHelicopteros08, source, false )
        setElementVisibleTo ( BlipHelicopteros08, source, false )
        setElementVisibleTo ( MarkerHelicopteros09, source, true )
        setElementVisibleTo ( BlipHelicopteros09, source, true )
        setElementData ( source, "Carteira:StartHelicopteros08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros09 then
        if getElementData( source, "Carteira:StartHelicopteros08", true ) then
        setElementVisibleTo ( MarkerHelicopteros09, source, false )
        setElementVisibleTo ( BlipHelicopteros09, source, false )
        setElementVisibleTo ( MarkerHelicopteros10, source, true )
        setElementVisibleTo ( BlipHelicopteros10, source, true )
        setElementData ( source, "Carteira:StartHelicopteros09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros10 then
        if getElementData( source, "Carteira:StartHelicopteros09", true ) then
        setElementVisibleTo ( MarkerHelicopteros10, source, false )
        setElementVisibleTo ( BlipHelicopteros10, source, false )
        setElementVisibleTo ( MarkerHelicopteros11, source, true )
        setElementVisibleTo ( BlipHelicopteros11, source, true )
        setElementData ( source, "Carteira:StartHelicopteros10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros11 then
        if getElementData( source, "Carteira:StartHelicopteros10", true ) then
        setElementVisibleTo ( MarkerHelicopteros11, source, false )
        setElementVisibleTo ( BlipHelicopteros11, source, false )
        setElementVisibleTo ( MarkerHelicopteros12, source, true )
        setElementVisibleTo ( BlipHelicopteros12, source, true )
        setElementData ( source, "Carteira:StartHelicopteros11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros12 then
        if getElementData( source, "Carteira:StartHelicopteros11", true ) then
        setElementVisibleTo ( MarkerHelicopteros12, source, false )
        setElementVisibleTo ( BlipHelicopteros12, source, false )
        setElementVisibleTo ( MarkerHelicopteros13, source, true )
        setElementVisibleTo ( BlipHelicopteros13, source, true )
        setElementData ( source, "Carteira:StartHelicopteros12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros13 then
        if getElementData( source, "Carteira:StartHelicopteros12", true ) then
        setElementVisibleTo ( MarkerHelicopteros13, source, false )
        setElementVisibleTo ( BlipHelicopteros13, source, false )
        setElementVisibleTo ( MarkerHelicopteros14, source, true )
        setElementVisibleTo ( BlipHelicopteros14, source, true )
        setElementData ( source, "Carteira:StartHelicopteros13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros14 then
        if getElementData( source, "Carteira:StartHelicopteros13", true ) then
        setElementVisibleTo ( MarkerHelicopteros14, source, false )
        setElementVisibleTo ( BlipHelicopteros14, source, false )
        setElementVisibleTo ( MarkerHelicopteros15, source, true )
        setElementVisibleTo ( BlipHelicopteros15, source, true )
        setElementData ( source, "Carteira:StartHelicopteros14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros15 then
        if getElementData( source, "Carteira:StartHelicopteros14", true ) then
        setElementVisibleTo ( MarkerHelicopteros15, source, false )
        setElementVisibleTo ( BlipHelicopteros15, source, false )
        setElementVisibleTo ( MarkerHelicopteros16, source, true )
        setElementVisibleTo ( BlipHelicopteros16, source, true )
        setElementData ( source, "Carteira:StartHelicopteros15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerHelicopteros16 then
        if getElementData( source, "Carteira:StartHelicopteros15", true ) then
        AutoEscolaHelicopterosVida = getElementHealth ( AutoEscolaHelicopteros[source] )
        if AutoEscolaHelicopterosVida <= HelicopterosDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros04, "error")
        else
        setElementData( source, "Habilitacoes:Helicopteros", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartHelicopteros15", false )
        setElementVisibleTo ( MarkerHelicopteros16, source, false )
        setElementVisibleTo ( BlipHelicopteros16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaHelicopteros[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerHelicopteros)

function SairDoVeiculoAutoEscolaHelicopteros (source)
if ( AutoEscolaHelicopteros[source] ) and isElement( AutoEscolaHelicopteros[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaHelicopteros[source] )
setElementData ( source, "Carteira:StartHelicopteros00", false )
setElementData ( source, "Carteira:StartHelicopteros01", false )
setElementData ( source, "Carteira:StartHelicopteros02", false )
setElementData ( source, "Carteira:StartHelicopteros03", false )
setElementData ( source, "Carteira:StartHelicopteros04", false )
setElementData ( source, "Carteira:StartHelicopteros05", false )
setElementData ( source, "Carteira:StartHelicopteros06", false )
setElementData ( source, "Carteira:StartHelicopteros07", false )
setElementData ( source, "Carteira:StartHelicopteros08", false )
setElementData ( source, "Carteira:StartHelicopteros09", false )
setElementData ( source, "Carteira:StartHelicopteros10", false )
setElementData ( source, "Carteira:StartHelicopteros11", false )
setElementData ( source, "Carteira:StartHelicopteros12", false )
setElementData ( source, "Carteira:StartHelicopteros13", false )
setElementData ( source, "Carteira:StartHelicopteros14", false )
setElementData ( source, "Carteira:StartHelicopteros15", false )
setElementVisibleTo ( MarkerHelicopteros01, source, false )
setElementVisibleTo ( BlipHelicopteros01, source, false )
setElementVisibleTo ( MarkerHelicopteros02, source, false )
setElementVisibleTo ( BlipHelicopteros02, source, false )
setElementVisibleTo ( MarkerHelicopteros03, source, false )
setElementVisibleTo ( BlipHelicopteros03, source, false )
setElementVisibleTo ( MarkerHelicopteros04, source, false )
setElementVisibleTo ( BlipHelicopteros04, source, false )
setElementVisibleTo ( MarkerHelicopteros05, source, false )
setElementVisibleTo ( BlipHelicopteros05, source, false )
setElementVisibleTo ( MarkerHelicopteros06, source, false )
setElementVisibleTo ( BlipHelicopteros06, source, false )
setElementVisibleTo ( MarkerHelicopteros07, source, false )
setElementVisibleTo ( BlipHelicopteros07, source, false )
setElementVisibleTo ( MarkerHelicopteros08, source, false )
setElementVisibleTo ( BlipHelicopteros08, source, false )
setElementVisibleTo ( MarkerHelicopteros09, source, false )
setElementVisibleTo ( BlipHelicopteros09, source, false )
setElementVisibleTo ( MarkerHelicopteros10, source, false )
setElementVisibleTo ( BlipHelicopteros10, source, false )
setElementVisibleTo ( MarkerHelicopteros11, source, false )
setElementVisibleTo ( BlipHelicopteros11, source, false )
setElementVisibleTo ( MarkerHelicopteros12, source, false )
setElementVisibleTo ( BlipHelicopteros12, source, false )
setElementVisibleTo ( MarkerHelicopteros13, source, false )
setElementVisibleTo ( BlipHelicopteros13, source, false )
setElementVisibleTo ( MarkerHelicopteros14, source, false )
setElementVisibleTo ( BlipHelicopteros14, source, false )
setElementVisibleTo ( MarkerHelicopteros15, source, false )
setElementVisibleTo ( BlipHelicopteros15, source, false )
setElementVisibleTo ( MarkerHelicopteros16, source, false )
setElementVisibleTo ( BlipHelicopteros16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaHelicopteros )

function MorrerAutoEscolaHelicopteros ()
if ( AutoEscolaHelicopteros[source] ) and isElement( AutoEscolaHelicopteros[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaHelicopteros[source] )
setElementData ( source, "Carteira:StartHelicopteros00", false )
setElementData ( source, "Carteira:StartHelicopteros01", false )
setElementData ( source, "Carteira:StartHelicopteros02", false )
setElementData ( source, "Carteira:StartHelicopteros03", false )
setElementData ( source, "Carteira:StartHelicopteros04", false )
setElementData ( source, "Carteira:StartHelicopteros05", false )
setElementData ( source, "Carteira:StartHelicopteros06", false )
setElementData ( source, "Carteira:StartHelicopteros07", false )
setElementData ( source, "Carteira:StartHelicopteros08", false )
setElementData ( source, "Carteira:StartHelicopteros09", false )
setElementData ( source, "Carteira:StartHelicopteros10", false )
setElementData ( source, "Carteira:StartHelicopteros11", false )
setElementData ( source, "Carteira:StartHelicopteros12", false )
setElementData ( source, "Carteira:StartHelicopteros13", false )
setElementData ( source, "Carteira:StartHelicopteros14", false )
setElementData ( source, "Carteira:StartHelicopteros15", false )
setElementVisibleTo ( MarkerHelicopteros01, source, false )
setElementVisibleTo ( BlipHelicopteros01, source, false )
setElementVisibleTo ( MarkerHelicopteros02, source, false )
setElementVisibleTo ( BlipHelicopteros02, source, false )
setElementVisibleTo ( MarkerHelicopteros03, source, false )
setElementVisibleTo ( BlipHelicopteros03, source, false )
setElementVisibleTo ( MarkerHelicopteros04, source, false )
setElementVisibleTo ( BlipHelicopteros04, source, false )
setElementVisibleTo ( MarkerHelicopteros05, source, false )
setElementVisibleTo ( BlipHelicopteros05, source, false )
setElementVisibleTo ( MarkerHelicopteros06, source, false )
setElementVisibleTo ( BlipHelicopteros06, source, false )
setElementVisibleTo ( MarkerHelicopteros07, source, false )
setElementVisibleTo ( BlipHelicopteros07, source, false )
setElementVisibleTo ( MarkerHelicopteros08, source, false )
setElementVisibleTo ( BlipHelicopteros08, source, false )
setElementVisibleTo ( MarkerHelicopteros09, source, false )
setElementVisibleTo ( BlipHelicopteros09, source, false )
setElementVisibleTo ( MarkerHelicopteros10, source, false )
setElementVisibleTo ( BlipHelicopteros10, source, false )
setElementVisibleTo ( MarkerHelicopteros11, source, false )
setElementVisibleTo ( BlipHelicopteros11, source, false )
setElementVisibleTo ( MarkerHelicopteros12, source, false )
setElementVisibleTo ( BlipHelicopteros12, source, false )
setElementVisibleTo ( MarkerHelicopteros13, source, false )
setElementVisibleTo ( BlipHelicopteros13, source, false )
setElementVisibleTo ( MarkerHelicopteros14, source, false )
setElementVisibleTo ( BlipHelicopteros14, source, false )
setElementVisibleTo ( MarkerHelicopteros15, source, false )
setElementVisibleTo ( BlipHelicopteros15, source, false )
setElementVisibleTo ( MarkerHelicopteros16, source, false )
setElementVisibleTo ( BlipHelicopteros16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgHelicopteros07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaHelicopteros )

function SairDoServidorAutoEscolaHelicopteros ( quitType )    
if isElement( AutoEscolaHelicopteros[source] ) then
destroyElement ( AutoEscolaHelicopteros[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaHelicopteros )

--------------------------------------------------------------------------------

-- ( Começo ) Percurso de Avioes

AvioesRX, AvioesRY, AvioesRZ           = 390.00958, 2515.68384, 16.48438 -- Coordenadas de Respawn do Aviao
AvioesRotA, AvioesRotB, AvioesRotC     = 0, 0, 90 -- Rotação do Veiculo ao Spawnar
AvioesID                               = 593 -- ID do Aviao
HabValorAvioes                         = 15000 -- Valor da Habilitação Categoria "Avioes"
AvioesDanoParaReprovar                 = 950 -- 95%

MsgAvioes01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgAvioes02 = "Você Não Tem Dinheiro Suficiente!"
MsgAvioes03 = "Você Ja Possui Essa Habilitação!"
MsgAvioes04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgAvioes05 = "Carteira de Habilitação Categoria 'Avioes' Concedida!"
MsgAvioes06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgAvioes07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

AvioesX01, AvioesY01, AvioesZ01 = 327.50638, 2512.08057, 16.56849
AvioesX02, AvioesY02, AvioesZ02 = -27.39510, 2514.81250, 41.52960
AvioesX03, AvioesY03, AvioesZ03 = -235.67519, 2590.04077, 87.09184
AvioesX04, AvioesY04, AvioesZ04 = -403.73294, 2635.43262, 92.30322
AvioesX05, AvioesY05, AvioesZ05 = -584.24835, 2685.85059, 91.69495
AvioesX06, AvioesY06, AvioesZ06 = -767.21533, 2720.34180, 94.28947
AvioesX07, AvioesY07, AvioesZ07 = -964.20673, 2691.60156, 83.17091
AvioesX08, AvioesY08, AvioesZ08 = -991.19080, 2565.01172, 107.92737
AvioesX09, AvioesY09, AvioesZ09 = -968.22424, 2412.37500, 106.02930
AvioesX10, AvioesY10, AvioesZ10 = -938.10565, 2296.36255, 72.00851
AvioesX11, AvioesY11, AvioesZ11 = -715.26495, 2211.76196, 85.63451
AvioesX12, AvioesY12, AvioesZ12 = -430.74518, 2224.39038, 87.41293
AvioesX13, AvioesY13, AvioesZ13 = -200.35358, 2237.01172, 80.83124
AvioesX14, AvioesY14, AvioesZ14 = -24.59806, 2413.50269, 64.73052
AvioesX15, AvioesY15, AvioesZ15 = 114.86245, 2467.75830, 41.54504
AvioesX16, AvioesY16, AvioesZ16 = 318.45193, 2490.21558, 16.48438

MarkerAvioes01 = createMarker ( AvioesX01, AvioesY01, AvioesZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipAvioes01 = createBlipAttachedTo ( MarkerAvioes01, 0 )
setElementVisibleTo ( MarkerAvioes01, root, false )
setElementVisibleTo ( BlipAvioes01, root, false )

MarkerAvioes02 = createMarker ( AvioesX02, AvioesY02, AvioesZ02 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes02 = createBlipAttachedTo ( MarkerAvioes02, 0 )
setElementVisibleTo ( MarkerAvioes02, root, false )
setElementVisibleTo ( BlipAvioes02, root, false )

MarkerAvioes03 = createMarker ( AvioesX03, AvioesY03, AvioesZ03 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes03 = createBlipAttachedTo ( MarkerAvioes03, 0 )
setElementVisibleTo ( MarkerAvioes03, root, false )
setElementVisibleTo ( BlipAvioes03, root, false )

MarkerAvioes04 = createMarker ( AvioesX04, AvioesY04, AvioesZ04 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes04 = createBlipAttachedTo ( MarkerAvioes04, 0 )
setElementVisibleTo ( MarkerAvioes04, root, false )
setElementVisibleTo ( BlipAvioes04, root, false )

MarkerAvioes05 = createMarker ( AvioesX05, AvioesY05, AvioesZ05 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes05 = createBlipAttachedTo ( MarkerAvioes05, 0 )
setElementVisibleTo ( MarkerAvioes05, root, false )
setElementVisibleTo ( BlipAvioes05, root, false )

MarkerAvioes06 = createMarker ( AvioesX06, AvioesY06, AvioesZ06 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes06 = createBlipAttachedTo ( MarkerAvioes06, 0 )
setElementVisibleTo ( MarkerAvioes06, root, false )
setElementVisibleTo ( BlipAvioes06, root, false )

MarkerAvioes07 = createMarker ( AvioesX07, AvioesY07, AvioesZ07 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes07 = createBlipAttachedTo ( MarkerAvioes07, 0 )
setElementVisibleTo ( MarkerAvioes07, root, false )
setElementVisibleTo ( BlipAvioes07, root, false )

MarkerAvioes08 = createMarker ( AvioesX08, AvioesY08, AvioesZ08 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes08 = createBlipAttachedTo ( MarkerAvioes08, 0 )
setElementVisibleTo ( MarkerAvioes08, root, false )
setElementVisibleTo ( BlipAvioes08, root, false )

MarkerAvioes09 = createMarker ( AvioesX09, AvioesY09, AvioesZ09 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes09 = createBlipAttachedTo ( MarkerAvioes09, 0 )
setElementVisibleTo ( MarkerAvioes09, root, false )
setElementVisibleTo ( BlipAvioes09, root, false )

MarkerAvioes10 = createMarker ( AvioesX10, AvioesY10, AvioesZ10 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes10 = createBlipAttachedTo ( MarkerAvioes10, 0 )
setElementVisibleTo ( MarkerAvioes10, root, false )
setElementVisibleTo ( BlipAvioes10, root, false )

MarkerAvioes11 = createMarker ( AvioesX11, AvioesY11, AvioesZ11 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes11 = createBlipAttachedTo ( MarkerAvioes11, 0 )
setElementVisibleTo ( MarkerAvioes11, root, false )
setElementVisibleTo ( BlipAvioes11, root, false )

MarkerAvioes12 = createMarker ( AvioesX12, AvioesY12, AvioesZ12 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes12 = createBlipAttachedTo ( MarkerAvioes12, 0 )
setElementVisibleTo ( MarkerAvioes12, root, false )
setElementVisibleTo ( BlipAvioes12, root, false )

MarkerAvioes13 = createMarker ( AvioesX13, AvioesY13, AvioesZ13 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes13 = createBlipAttachedTo ( MarkerAvioes13, 0 )
setElementVisibleTo ( MarkerAvioes13, root, false )
setElementVisibleTo ( BlipAvioes13, root, false )

MarkerAvioes14 = createMarker ( AvioesX14, AvioesY14, AvioesZ14 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes14 = createBlipAttachedTo ( MarkerAvioes14, 0 )
setElementVisibleTo ( MarkerAvioes14, root, false )
setElementVisibleTo ( BlipAvioes14, root, false )

MarkerAvioes15 = createMarker ( AvioesX15, AvioesY15, AvioesZ15 -1, "corona", 5, 255 ,0 ,0, 255)
BlipAvioes15 = createBlipAttachedTo ( MarkerAvioes15, 0 )
setElementVisibleTo ( MarkerAvioes15, root, false )
setElementVisibleTo ( BlipAvioes15, root, false )

MarkerAvioes16 = createMarker ( AvioesX16, AvioesY16, AvioesZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipAvioes16 = createBlipAttachedTo ( MarkerAvioes16, 0 )
setElementVisibleTo ( MarkerAvioes16, root, false )
setElementVisibleTo ( BlipAvioes16, root, false )

AutoEscolaAvioes = {}

function AvioesHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Avioes" ) == true then
if getPlayerMoney(source) >= HabValorAvioes then
takePlayerMoney(source, HabValorAvioes)
if AutoEscolaAvioes[source] and isElement( AutoEscolaAvioes[source] ) then destroyElement ( AutoEscolaAvioes[source] )
AutoEscolaAvioes[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaAvioes[source] = createVehicle( AvioesID, AvioesRX, AvioesRY, AvioesRZ )
setElementRotation ( AutoEscolaAvioes[source], AvioesRotA, AvioesRotB, AvioesRotC )
setVehicleLocked ( AutoEscolaAvioes[source], true )
warpPedIntoVehicle ( source, AutoEscolaAvioes[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartAvioes00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerAvioes01, source, true )
setElementVisibleTo ( BlipAvioes01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes03, "warning")
end
end
addEvent("Hab:Aviao", true)
addEventHandler ( "Hab:Aviao", root, AvioesHab)

function emarkerAvioes(marker,md) 
    if (md) then
      if AutoEscolaAvioes[source] and isElement( AutoEscolaAvioes[source] ) then
        if marker == MarkerAvioes01 then
        if getElementData( source, "Carteira:StartAvioes00", true ) then
        setElementVisibleTo ( MarkerAvioes01, source, false )
        setElementVisibleTo ( BlipAvioes01, source, false )
        setElementVisibleTo ( MarkerAvioes02, source, true )
        setElementVisibleTo ( BlipAvioes02, source, true )
        setElementData ( source, "Carteira:StartAvioes01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes00", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes02 then
        if getElementData( source, "Carteira:StartAvioes01", true ) then
        setElementVisibleTo ( MarkerAvioes02, source, false )
        setElementVisibleTo ( BlipAvioes02, source, false )
        setElementVisibleTo ( MarkerAvioes03, source, true )
        setElementVisibleTo ( BlipAvioes03, source, true )
        setElementData ( source, "Carteira:StartAvioes02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes01", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes03 then
        if getElementData( source, "Carteira:StartAvioes02", true ) then
        setElementVisibleTo ( MarkerAvioes03, source, false )
        setElementVisibleTo ( BlipAvioes03, source, false )
        setElementVisibleTo ( MarkerAvioes04, source, true )
        setElementVisibleTo ( BlipAvioes04, source, true )
        setElementData ( source, "Carteira:StartAvioes03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes02", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes04 then
        if getElementData( source, "Carteira:StartAvioes03", true ) then
        setElementVisibleTo ( MarkerAvioes04, source, false )
        setElementVisibleTo ( BlipAvioes04, source, false )
        setElementVisibleTo ( MarkerAvioes05, source, true )
        setElementVisibleTo ( BlipAvioes05, source, true )
        setElementData ( source, "Carteira:StartAvioes04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes03", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes05 then
        if getElementData( source, "Carteira:StartAvioes04", true ) then
        setElementVisibleTo ( MarkerAvioes05, source, false )
        setElementVisibleTo ( BlipAvioes05, source, false )
        setElementVisibleTo ( MarkerAvioes06, source, true )
        setElementVisibleTo ( BlipAvioes06, source, true )
        setElementData ( source, "Carteira:StartAvioes05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes04", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes06 then
        if getElementData( source, "Carteira:StartAvioes05", true ) then
        setElementVisibleTo ( MarkerAvioes06, source, false )
        setElementVisibleTo ( BlipAvioes06, source, false )
        setElementVisibleTo ( MarkerAvioes07, source, true )
        setElementVisibleTo ( BlipAvioes07, source, true )
        setElementData ( source, "Carteira:StartAvioes06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes05", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes07 then
        if getElementData( source, "Carteira:StartAvioes06", true ) then
        setElementVisibleTo ( MarkerAvioes07, source, false )
        setElementVisibleTo ( BlipAvioes07, source, false )
        setElementVisibleTo ( MarkerAvioes08, source, true )
        setElementVisibleTo ( BlipAvioes08, source, true )
        setElementData ( source, "Carteira:StartAvioes07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes06", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes08 then
        if getElementData( source, "Carteira:StartAvioes07", true ) then
        setElementVisibleTo ( MarkerAvioes08, source, false )
        setElementVisibleTo ( BlipAvioes08, source, false )
        setElementVisibleTo ( MarkerAvioes09, source, true )
        setElementVisibleTo ( BlipAvioes09, source, true )
        setElementData ( source, "Carteira:StartAvioes08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes07", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes09 then
        if getElementData( source, "Carteira:StartAvioes08", true ) then
        setElementVisibleTo ( MarkerAvioes09, source, false )
        setElementVisibleTo ( BlipAvioes09, source, false )
        setElementVisibleTo ( MarkerAvioes10, source, true )
        setElementVisibleTo ( BlipAvioes10, source, true )
        setElementData ( source, "Carteira:StartAvioes09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes08", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes10 then
        if getElementData( source, "Carteira:StartAvioes09", true ) then
        setElementVisibleTo ( MarkerAvioes10, source, false )
        setElementVisibleTo ( BlipAvioes10, source, false )
        setElementVisibleTo ( MarkerAvioes11, source, true )
        setElementVisibleTo ( BlipAvioes11, source, true )
        setElementData ( source, "Carteira:StartAvioes10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes09", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes11 then
        if getElementData( source, "Carteira:StartAvioes10", true ) then
        setElementVisibleTo ( MarkerAvioes11, source, false )
        setElementVisibleTo ( BlipAvioes11, source, false )
        setElementVisibleTo ( MarkerAvioes12, source, true )
        setElementVisibleTo ( BlipAvioes12, source, true )
        setElementData ( source, "Carteira:StartAvioes11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes10", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes12 then
        if getElementData( source, "Carteira:StartAvioes11", true ) then
        setElementVisibleTo ( MarkerAvioes12, source, false )
        setElementVisibleTo ( BlipAvioes12, source, false )
        setElementVisibleTo ( MarkerAvioes13, source, true )
        setElementVisibleTo ( BlipAvioes13, source, true )
        setElementData ( source, "Carteira:StartAvioes12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes11", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes13 then
        if getElementData( source, "Carteira:StartAvioes12", true ) then
        setElementVisibleTo ( MarkerAvioes13, source, false )
        setElementVisibleTo ( BlipAvioes13, source, false )
        setElementVisibleTo ( MarkerAvioes14, source, true )
        setElementVisibleTo ( BlipAvioes14, source, true )
        setElementData ( source, "Carteira:StartAvioes13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes12", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes14 then
        if getElementData( source, "Carteira:StartAvioes13", true ) then
        setElementVisibleTo ( MarkerAvioes14, source, false )
        setElementVisibleTo ( BlipAvioes14, source, false )
        setElementVisibleTo ( MarkerAvioes15, source, true )
        setElementVisibleTo ( BlipAvioes15, source, true )
        setElementData ( source, "Carteira:StartAvioes14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes13", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes15 then
        if getElementData( source, "Carteira:StartAvioes14", true ) then
        setElementVisibleTo ( MarkerAvioes15, source, false )
        setElementVisibleTo ( BlipAvioes15, source, false )
        setElementVisibleTo ( MarkerAvioes16, source, true )
        setElementVisibleTo ( BlipAvioes16, source, true )
        setElementData ( source, "Carteira:StartAvioes15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes14", false )
        playSoundFrontEnd ( source, 43 )
        end
        end
        if marker == MarkerAvioes16 then
        if getElementData( source, "Carteira:StartAvioes15", true ) then
        AutoEscolaAvioesVida = getElementHealth ( AutoEscolaAvioes[source] )
        if AutoEscolaAvioesVida <= AvioesDanoParaReprovar then
        exports.Scripts_Dxmessages:outputDx(source, MsgAvioes04, "error")
        else
        setElementData( source, "Habilitacoes:Avioes", true)
        exports.Scripts_Dxmessages:outputDx(source, MsgAvioes05, "success")
        end
        setTimer ( setElementData, 50, 1, source, "Carteira:StartAvioes15", false )
        setElementVisibleTo ( MarkerAvioes16, source, false )
        setElementVisibleTo ( BlipAvioes16, source, false )
        setElementData ( source, "AirNew_TirandoCarta", "Não" )
        destroyElement ( AutoEscolaAvioes[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
        end
      end 
    end    
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerAvioes)

function SairDoVeiculoAutoEscolaAvioes (source)
if ( AutoEscolaAvioes[source] ) and isElement( AutoEscolaAvioes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaAvioes[source] )
setElementData ( source, "Carteira:StartAvioes00", false )
setElementData ( source, "Carteira:StartAvioes01", false )
setElementData ( source, "Carteira:StartAvioes02", false )
setElementData ( source, "Carteira:StartAvioes03", false )
setElementData ( source, "Carteira:StartAvioes04", false )
setElementData ( source, "Carteira:StartAvioes05", false )
setElementData ( source, "Carteira:StartAvioes06", false )
setElementData ( source, "Carteira:StartAvioes07", false )
setElementData ( source, "Carteira:StartAvioes08", false )
setElementData ( source, "Carteira:StartAvioes09", false )
setElementData ( source, "Carteira:StartAvioes10", false )
setElementData ( source, "Carteira:StartAvioes11", false )
setElementData ( source, "Carteira:StartAvioes12", false )
setElementData ( source, "Carteira:StartAvioes13", false )
setElementData ( source, "Carteira:StartAvioes14", false )
setElementData ( source, "Carteira:StartAvioes15", false )
setElementVisibleTo ( MarkerAvioes01, source, false )
setElementVisibleTo ( BlipAvioes01, source, false )
setElementVisibleTo ( MarkerAvioes02, source, false )
setElementVisibleTo ( BlipAvioes02, source, false )
setElementVisibleTo ( MarkerAvioes03, source, false )
setElementVisibleTo ( BlipAvioes03, source, false )
setElementVisibleTo ( MarkerAvioes04, source, false )
setElementVisibleTo ( BlipAvioes04, source, false )
setElementVisibleTo ( MarkerAvioes05, source, false )
setElementVisibleTo ( BlipAvioes05, source, false )
setElementVisibleTo ( MarkerAvioes06, source, false )
setElementVisibleTo ( BlipAvioes06, source, false )
setElementVisibleTo ( MarkerAvioes07, source, false )
setElementVisibleTo ( BlipAvioes07, source, false )
setElementVisibleTo ( MarkerAvioes08, source, false )
setElementVisibleTo ( BlipAvioes08, source, false )
setElementVisibleTo ( MarkerAvioes09, source, false )
setElementVisibleTo ( BlipAvioes09, source, false )
setElementVisibleTo ( MarkerAvioes10, source, false )
setElementVisibleTo ( BlipAvioes10, source, false )
setElementVisibleTo ( MarkerAvioes11, source, false )
setElementVisibleTo ( BlipAvioes11, source, false )
setElementVisibleTo ( MarkerAvioes12, source, false )
setElementVisibleTo ( BlipAvioes12, source, false )
setElementVisibleTo ( MarkerAvioes13, source, false )
setElementVisibleTo ( BlipAvioes13, source, false )
setElementVisibleTo ( MarkerAvioes14, source, false )
setElementVisibleTo ( BlipAvioes14, source, false )
setElementVisibleTo ( MarkerAvioes15, source, false )
setElementVisibleTo ( BlipAvioes15, source, false )
setElementVisibleTo ( MarkerAvioes16, source, false )
setElementVisibleTo ( BlipAvioes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaAvioes )

function MorrerAutoEscolaAvioes ()
if ( AutoEscolaAvioes[source] ) and isElement( AutoEscolaAvioes[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaAvioes[source] )
setElementData ( source, "Carteira:StartAvioes00", false )
setElementData ( source, "Carteira:StartAvioes01", false )
setElementData ( source, "Carteira:StartAvioes02", false )
setElementData ( source, "Carteira:StartAvioes03", false )
setElementData ( source, "Carteira:StartAvioes04", false )
setElementData ( source, "Carteira:StartAvioes05", false )
setElementData ( source, "Carteira:StartAvioes06", false )
setElementData ( source, "Carteira:StartAvioes07", false )
setElementData ( source, "Carteira:StartAvioes08", false )
setElementData ( source, "Carteira:StartAvioes09", false )
setElementData ( source, "Carteira:StartAvioes10", false )
setElementData ( source, "Carteira:StartAvioes11", false )
setElementData ( source, "Carteira:StartAvioes12", false )
setElementData ( source, "Carteira:StartAvioes13", false )
setElementData ( source, "Carteira:StartAvioes14", false )
setElementData ( source, "Carteira:StartAvioes15", false )
setElementVisibleTo ( MarkerAvioes01, source, false )
setElementVisibleTo ( BlipAvioes01, source, false )
setElementVisibleTo ( MarkerAvioes02, source, false )
setElementVisibleTo ( BlipAvioes02, source, false )
setElementVisibleTo ( MarkerAvioes03, source, false )
setElementVisibleTo ( BlipAvioes03, source, false )
setElementVisibleTo ( MarkerAvioes04, source, false )
setElementVisibleTo ( BlipAvioes04, source, false )
setElementVisibleTo ( MarkerAvioes05, source, false )
setElementVisibleTo ( BlipAvioes05, source, false )
setElementVisibleTo ( MarkerAvioes06, source, false )
setElementVisibleTo ( BlipAvioes06, source, false )
setElementVisibleTo ( MarkerAvioes07, source, false )
setElementVisibleTo ( BlipAvioes07, source, false )
setElementVisibleTo ( MarkerAvioes08, source, false )
setElementVisibleTo ( BlipAvioes08, source, false )
setElementVisibleTo ( MarkerAvioes09, source, false )
setElementVisibleTo ( BlipAvioes09, source, false )
setElementVisibleTo ( MarkerAvioes10, source, false )
setElementVisibleTo ( BlipAvioes10, source, false )
setElementVisibleTo ( MarkerAvioes11, source, false )
setElementVisibleTo ( BlipAvioes11, source, false )
setElementVisibleTo ( MarkerAvioes12, source, false )
setElementVisibleTo ( BlipAvioes12, source, false )
setElementVisibleTo ( MarkerAvioes13, source, false )
setElementVisibleTo ( BlipAvioes13, source, false )
setElementVisibleTo ( MarkerAvioes14, source, false )
setElementVisibleTo ( BlipAvioes14, source, false )
setElementVisibleTo ( MarkerAvioes15, source, false )
setElementVisibleTo ( BlipAvioes15, source, false )
setElementVisibleTo ( MarkerAvioes16, source, false )
setElementVisibleTo ( BlipAvioes16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgAvioes07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaAvioes )

function SairDoServidorAutoEscolaAvioes ( quitType )    
if isElement( AutoEscolaAvioes[source] ) then
destroyElement ( AutoEscolaAvioes[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaAvioes )

--------------------------------------------------------------------------------

function SalvarDadosHab(conta)
    if conta then
    local source = getAccountPlayer(conta)
    local emp = getElementData(source,"Habilitacoes:Motos") or false
    setAccountData (conta, "Habilitacoes:Motos",emp)
    local emp = getElementData(source,"Habilitacoes:Carros") or false
    setAccountData (conta, "Habilitacoes:Carros",emp)
    local emp = getElementData(source,"Habilitacoes:Caminhoes") or false
    setAccountData (conta, "Habilitacoes:Caminhoes",emp)
    local emp = getElementData(source,"Habilitacoes:Onibus") or false
    setAccountData (conta, "Habilitacoes:Onibus",emp)
    local emp = getElementData(source,"Habilitacoes:Carretas") or false
    setAccountData (conta, "Habilitacoes:Carretas",emp)
    local emp = getElementData(source,"Habilitacoes:Barcos") or false
    setAccountData (conta, "Habilitacoes:Barcos",emp)
    local emp = getElementData(source,"Habilitacoes:Helicopteros") or false
    setAccountData (conta, "Habilitacoes:Helicopteros",emp)
    local emp = getElementData(source,"Habilitacoes:Avioes") or false
    setAccountData (conta, "Habilitacoes:Avioes",emp)
    local emp = getElementData ( source,"AirNew:AutoEscola") or false
    setAccountData (conta, "AirNew:AutoEscola", emp)
    end    
end

function CarregarDadosHab(conta)
    if not (isGuestAccount (conta)) then
        if (conta) then    
            local source = getAccountPlayer(conta)    
            local emp = getAccountData(conta,"Habilitacoes:Motos") or false
            setElementData (source, "Habilitacoes:Motos", emp)
            local emp = getAccountData(conta,"Habilitacoes:Carros") or false
            setElementData (source, "Habilitacoes:Carros", emp)
            local emp = getAccountData(conta,"Habilitacoes:Caminhoes") or false
            setElementData (source, "Habilitacoes:Caminhoes", emp)
            local emp = getAccountData(conta,"Habilitacoes:Onibus") or false
            setElementData (source, "Habilitacoes:Onibus", emp)
            local emp = getAccountData(conta,"Habilitacoes:Carretas") or false
            setElementData (source, "Habilitacoes:Carretas", emp)
            local emp = getAccountData(conta,"Habilitacoes:Barcos") or false
            setElementData (source, "Habilitacoes:Barcos", emp)
            local emp = getAccountData(conta,"Habilitacoes:Helicopteros") or false
            setElementData (source, "Habilitacoes:Helicopteros", emp)
            local emp = getAccountData(conta,"Habilitacoes:Avioes") or false
            setElementData (source, "Habilitacoes:Avioes", emp)
            local emp = getAccountData(conta,"AirNew:AutoEscola") or false
            setElementData (source, "AirNew:AutoEscola", emp)
        end
    end    
end

--------------------------------------------------------------------------------

addEventHandler("onPlayerLogin", root,
  function( _, acc )
    setTimer(CarregarDadosHab,1000,1,acc)
  end
)

function startScript ( res )
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                CarregarDadosHab(acc)
            end
        end
    end
end
addEventHandler ( "onResourceStart", getRootElement(), startScript )

function stopScript( res )
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                SalvarDadosHab(acc)
            end
        end
    end
end 
addEventHandler ( "onResourceStop", getRootElement(), stopScript )

function sair ( quitType )
    local acc = getPlayerAccount(source)
    if not (isGuestAccount (acc)) then
        if acc then
            SalvarDadosHab(acc)
        end
    end
end
addEventHandler ( "onPlayerQuit", getRootElement(), sair )

--------------------------------------------------------------------------------

Infelizmente o Form não permite colocar o código em CODE, o mesmo é carregado e logo em seguida dá um erro, mas eu vou colocar em Spolier

Eu fiz as alterações nas linhas como o DNL informou, porém o sistema não funciona, só a primeira alteração que deu certo, as demais não.. 

Link to comment
7 hours ago, DNL291 said:

Dei uma olhada rápida e a verificação do getElementData tá certa, mas não tive a paciência pra ver toda essa gambiarra e má organização/repetição no código :bad-words:

Digite /debugscript 3 e veja se o debug mostra algum erro.

Tentei de novo e finalmente consegui, porém agora ele não tá mandando as Msg de aprovado ou não.. Vou mandar pra ti só o do carro! se puderes verificar!

eu achei esse erro tb, não consegui identificar..

Quote

[-] MTA: San Andreas :: 1/300 players :: 244 resources :: 139 fps (27)
Dxmessages) [string "?"]
[22:12:40] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:753: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
[22:13:17] SCRIPT: ~#SR.VINI|PF(viniciospfeil) set their script debug mode to 3
[22:13:31] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:278: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
[22:13:31] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:753: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
[22:13:38] WARNING: [gameplay]\car_lock\car_locks_server.lua:116: Bad argument @ 'removeElementData' [Expected element at argument 1]
[22:13:38] WARNING: [gameplay]\car_lock\car_locks_server.lua:117: Bad argument @ 'removeElementData' [Expected element at argument 1]
[22:13:38] WARNING: [gameplay]\car_lock\car_locks_server.lua:118: Bad argument @ 'removeElementData' [Expected element at argument 1]
[22:13:38] WARNING: [gameplay]\car_lock\car_locks_server.lua:119: Bad argument @ 'setVehicleLocked' [Expected element at argument 1]
[22:13:38] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:1223: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
[22:13:45] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:1482: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
[22:13:54] ADMIN: Resource '[APP]Habilitacoes' reiniciado by ~#SR.VINI|PF(viniciospfeil)
[22:13:54] Stopping [APP]Habilitacoes
[22:13:54] Starting [APP]Habilitacoes
[22:13:54] [APP]Habilitacoes restarted successfully
[22:14:04] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:753: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
[22:14:08] ERROR: [gameplay]\[APP]Habilitacoes\AirNew_s.lua:278: exports: Call to non-running server resource (Scripts_Dxmessages) [string "?"]
 

-- ( Começo ) Percurso de Carro

CarroRX, CarroRY, CarroRZ       = -270.44916, 1547.39783, 75.35938 -- Coordenadas de Respawn do Carro
CarroRotA, CarroRotB, CarroRotC = 0, 0, 135.25268554688 -- Rotação do Veiculo ao Spawnar
CarroID                         = 516 -- ID do Carro
HabValorCarro                   = 1000 -- Valor da Habilitação Categoria "Carros"
CarrosDanoParaReprovar          = 950 -- 95%

MsgCarro01 = "Prova Iniciada, Siga-os Checkpoints Para Concluir o seu Objetivo!"
MsgCarro02 = "Você Não Tem Dinheiro Suficiente!"
MsgCarro03 = "Você Ja Possui Essa Habilitação!"
MsgCarro04 = "Você Reprovou no Teste, Evite Bater na Proxima Vez!"
MsgCarro05 = "Carteira de Habilitação Categoria 'Carros' Concedida!"
MsgCarro06 = "Você Saiu do Veiculo, Por Esse Motivo o Teste foi Cancelado!"
MsgCarro07 = "Você Morreu, Por Esse Motivo o Teste foi Cancelado!"

CarroX01, CarroY01, CarroZ01 = -304.31372, 1497.35303, 75.67019
CarroX02, CarroY02, CarroZ02 = -297.91571, 1412.75647, 72.31325
CarroX03, CarroY03, CarroZ03 = -358.71982, 1398.42810, 58.37130
CarroX04, CarroY04, CarroZ04 = -383.39719, 1397.47485, 42.07113
CarroX05, CarroY05, CarroZ05 = -453.04425, 1579.76025, 36.17015
CarroX06, CarroY06, CarroZ06 = -403.00198, 1714.00647, 40.57639
CarroX07, CarroY07, CarroZ07 = -388.58905, 1880.69397, 55.31573
CarroX08, CarroY08, CarroZ08 = -429.19666, 1818.11926, 67.87206
CarroX09, CarroY09, CarroZ09 = -468.87231, 1869.95264, 82.43024
CarroX10, CarroY10, CarroZ10 = -397.42804, 2034.05908, 65.20287
CarroX11, CarroY11, CarroZ11 = -458.04187, 2028.86401, 60.53470
CarroX12, CarroY12, CarroZ12 = -541.70868, 2008.56213, 60.21884
CarroX13, CarroY13, CarroZ13 = -652.17749, 2064.89575, 60.21832
CarroX14, CarroY14, CarroZ14 = -757.40155, 2064.42749, 60.22342
CarroX15, CarroY15, CarroZ15 = -851.88013, 2019.84998, 60.22160
CarroX16, CarroY16, CarroZ16 = -912.48688, 2008.76563, 60.94514

MarkerCarro01 = createMarker ( CarroX01, CarroY01, CarroZ01 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro01 = createBlipAttachedTo ( MarkerCarro01, 0 )
setElementVisibleTo ( MarkerCarro01, root, false )
setElementVisibleTo ( BlipCarro01, root, false )

MarkerCarro02 = createMarker ( CarroX02, CarroY02, CarroZ02 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro02 = createBlipAttachedTo ( MarkerCarro02, 0 )
setElementVisibleTo ( MarkerCarro02, root, false )
setElementVisibleTo ( BlipCarro02, root, false )

MarkerCarro03 = createMarker ( CarroX03, CarroY03, CarroZ03 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro03 = createBlipAttachedTo ( MarkerCarro03, 0 )
setElementVisibleTo ( MarkerCarro03, root, false )
setElementVisibleTo ( BlipCarro03, root, false )

MarkerCarro04 = createMarker ( CarroX04, CarroY04, CarroZ04 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro04 = createBlipAttachedTo ( MarkerCarro04, 0 )
setElementVisibleTo ( MarkerCarro04, root, false )
setElementVisibleTo ( BlipCarro04, root, false )

MarkerCarro05 = createMarker ( CarroX05, CarroY05, CarroZ05 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro05 = createBlipAttachedTo ( MarkerCarro05, 0 )
setElementVisibleTo ( MarkerCarro05, root, false )
setElementVisibleTo ( BlipCarro05, root, false )

MarkerCarro06 = createMarker ( CarroX06, CarroY06, CarroZ06 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro06 = createBlipAttachedTo ( MarkerCarro06, 0 )
setElementVisibleTo ( MarkerCarro06, root, false )
setElementVisibleTo ( BlipCarro06, root, false )

MarkerCarro07 = createMarker ( CarroX07, CarroY07, CarroZ07 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro07 = createBlipAttachedTo ( MarkerCarro07, 0 )
setElementVisibleTo ( MarkerCarro07, root, false )
setElementVisibleTo ( BlipCarro07, root, false )

MarkerCarro08 = createMarker ( CarroX08, CarroY08, CarroZ08 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro08 = createBlipAttachedTo ( MarkerCarro08, 0 )
setElementVisibleTo ( MarkerCarro08, root, false )
setElementVisibleTo ( BlipCarro08, root, false )

MarkerCarro09 = createMarker ( CarroX09, CarroY09, CarroZ09 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro09 = createBlipAttachedTo ( MarkerCarro09, 0 )
setElementVisibleTo ( MarkerCarro09, root, false )
setElementVisibleTo ( BlipCarro09, root, false )

MarkerCarro10 = createMarker ( CarroX10, CarroY10, CarroZ10 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro10 = createBlipAttachedTo ( MarkerCarro10, 0 )
setElementVisibleTo ( MarkerCarro10, root, false )
setElementVisibleTo ( BlipCarro10, root, false )

MarkerCarro11 = createMarker ( CarroX11, CarroY11, CarroZ11 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro11 = createBlipAttachedTo ( MarkerCarro11, 0 )
setElementVisibleTo ( MarkerCarro11, root, false )
setElementVisibleTo ( BlipCarro11, root, false )

MarkerCarro12 = createMarker ( CarroX12, CarroY12, CarroZ12 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro12 = createBlipAttachedTo ( MarkerCarro12, 0 )
setElementVisibleTo ( MarkerCarro12, root, false )
setElementVisibleTo ( BlipCarro12, root, false )

MarkerCarro13 = createMarker ( CarroX13, CarroY13, CarroZ13 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro13 = createBlipAttachedTo ( MarkerCarro13, 0 )
setElementVisibleTo ( MarkerCarro13, root, false )
setElementVisibleTo ( BlipCarro13, root, false )

MarkerCarro14 = createMarker ( CarroX14, CarroY14, CarroZ14 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro14 = createBlipAttachedTo ( MarkerCarro14, 0 )
setElementVisibleTo ( MarkerCarro14, root, false )
setElementVisibleTo ( BlipCarro14, root, false )

MarkerCarro15 = createMarker ( CarroX15, CarroY15, CarroZ15 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro15 = createBlipAttachedTo ( MarkerCarro15, 0 )
setElementVisibleTo ( MarkerCarro15, root, false )
setElementVisibleTo ( BlipCarro15, root, false )

MarkerCarro16 = createMarker ( CarroX16, CarroY16, CarroZ16 -1, "checkpoint", 3, 255 ,0 ,0, 95)
BlipCarro16 = createBlipAttachedTo ( MarkerCarro16, 0 )
setElementVisibleTo ( MarkerCarro16, root, false )
setElementVisibleTo ( BlipCarro16, root, false )

AutoEscolaCarro = {}

function CarrosHab(entrar)
if (getElementData ( source, "PontosNacarteira" ) or 0) > 0 then
exports.Scripts_Dxmessages:outputDx(source, MsgMultas, "error") return end
if not getElementData(source, "Habilitacoes:Carros" ) == true then
if getPlayerMoney(source) >= HabValorCarro then
takePlayerMoney(source, HabValorCarro)
if AutoEscolaCarro[source] and isElement( AutoEscolaCarro[source] ) then destroyElement ( AutoEscolaCarro[source] )
AutoEscolaCarro[source] = nil
end
setElementInterior ( source, 0 )
setElementDimension ( source, 0 )
triggerClientEvent ( source, "AirNew:FecharAutoEscola", root )
AutoEscolaCarro[source] = createVehicle( CarroID, CarroRX, CarroRY, CarroRZ )
setElementRotation ( AutoEscolaCarro[source], CarroRotA, CarroRotB, CarroRotC )
setVehicleLocked ( AutoEscolaCarro[source], true )
warpPedIntoVehicle ( source, AutoEscolaCarro[source] )
setCameraTarget ( source )
setElementData ( source, "Carteira:StartCarro00", true )
setElementData ( source, "AirNew_TirandoCarta", "Sim" )
setElementVisibleTo ( MarkerCarro01, source, true )
setElementVisibleTo ( BlipCarro01, source, true )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro01, "info")
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarro02, "error")
end
else
exports.Scripts_Dxmessages:outputDx(source, MsgCarro03, "warning")
end
end
addEvent("Hab:Carro", true)
addEventHandler ( "Hab:Carro", root, CarrosHab)

function emarkerCarros(marker,md) 
	if (md) then
	  if AutoEscolaCarro[source] and isElement( AutoEscolaCarro[source] ) then
		if marker == MarkerCarro01 then
		if getElementData( source, "Carteira:StartCarro00", true ) then
        setElementVisibleTo ( MarkerCarro01, source, false )
        setElementVisibleTo ( BlipCarro01, source, false )
        setElementVisibleTo ( MarkerCarro02, source, true )
        setElementVisibleTo ( BlipCarro02, source, true )
        setElementData ( source, "Carteira:StartCarro01", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro00", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro02 then
        if getElementData( source, "Carteira:StartCarro01", true ) then
        setElementVisibleTo ( MarkerCarro02, source, false )
        setElementVisibleTo ( BlipCarro02, source, false )
        setElementVisibleTo ( MarkerCarro03, source, true )
        setElementVisibleTo ( BlipCarro03, source, true )
        setElementData ( source, "Carteira:StartCarro02", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro01", false )
        playSoundFrontEnd ( source, 43 )
		end
		end
		if marker == MarkerCarro03 then
        if getElementData( source, "Carteira:StartCarro02", true ) then
        setElementVisibleTo ( MarkerCarro03, source, false )
        setElementVisibleTo ( BlipCarro03, source, false )
        setElementVisibleTo ( MarkerCarro04, source, true )
        setElementVisibleTo ( BlipCarro04, source, true )
        setElementData ( source, "Carteira:StartCarro03", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro02", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro04 then
        if getElementData( source, "Carteira:StartCarro03", true ) then
        setElementVisibleTo ( MarkerCarro04, source, false )
        setElementVisibleTo ( BlipCarro04, source, false )
        setElementVisibleTo ( MarkerCarro05, source, true )
        setElementVisibleTo ( BlipCarro05, source, true )
        setElementData ( source, "Carteira:StartCarro04", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro03", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro05 then
        if getElementData( source, "Carteira:StartCarro04", true ) then
        setElementVisibleTo ( MarkerCarro05, source, false )
        setElementVisibleTo ( BlipCarro05, source, false )
        setElementVisibleTo ( MarkerCarro06, source, true )
        setElementVisibleTo ( BlipCarro06, source, true )
        setElementData ( source, "Carteira:StartCarro05", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro04", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro06 then
        if getElementData( source, "Carteira:StartCarro05", true ) then
        setElementVisibleTo ( MarkerCarro06, source, false )
        setElementVisibleTo ( BlipCarro06, source, false )
        setElementVisibleTo ( MarkerCarro07, source, true )
        setElementVisibleTo ( BlipCarro07, source, true )
        setElementData ( source, "Carteira:StartCarro06", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro05", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro07 then
        if getElementData( source, "Carteira:StartCarro06", true ) then
        setElementVisibleTo ( MarkerCarro07, source, false )
        setElementVisibleTo ( BlipCarro07, source, false )
        setElementVisibleTo ( MarkerCarro08, source, true )
        setElementVisibleTo ( BlipCarro08, source, true )
        setElementData ( source, "Carteira:StartCarro07", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro06", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro08 then
        if getElementData( source, "Carteira:StartCarro07", true ) then
        setElementVisibleTo ( MarkerCarro08, source, false )
        setElementVisibleTo ( BlipCarro08, source, false )
        setElementVisibleTo ( MarkerCarro09, source, true )
        setElementVisibleTo ( BlipCarro09, source, true )
        setElementData ( source, "Carteira:StartCarro08", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro07", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro09 then
        if getElementData( source, "Carteira:StartCarro08", true ) then
        setElementVisibleTo ( MarkerCarro09, source, false )
        setElementVisibleTo ( BlipCarro09, source, false )
        setElementVisibleTo ( MarkerCarro10, source, true )
        setElementVisibleTo ( BlipCarro10, source, true )
        setElementData ( source, "Carteira:StartCarro09", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro08", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro10 then
        if getElementData( source, "Carteira:StartCarro09", true ) then
        setElementVisibleTo ( MarkerCarro10, source, false )
        setElementVisibleTo ( BlipCarro10, source, false )
        setElementVisibleTo ( MarkerCarro11, source, true )
        setElementVisibleTo ( BlipCarro11, source, true )
        setElementData ( source, "Carteira:StartCarro10", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro09", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro11 then
        if getElementData( source, "Carteira:StartCarro10", true ) then
        setElementVisibleTo ( MarkerCarro11, source, false )
        setElementVisibleTo ( BlipCarro11, source, false )
        setElementVisibleTo ( MarkerCarro12, source, true )
        setElementVisibleTo ( BlipCarro12, source, true )
        setElementData ( source, "Carteira:StartCarro11", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro10", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro12 then
        if getElementData( source, "Carteira:StartCarro11", true ) then
        setElementVisibleTo ( MarkerCarro12, source, false )
        setElementVisibleTo ( BlipCarro12, source, false )
        setElementVisibleTo ( MarkerCarro13, source, true )
        setElementVisibleTo ( BlipCarro13, source, true )
        setElementData ( source, "Carteira:StartCarro12", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro11", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro13 then
        if getElementData( source, "Carteira:StartCarro12", true ) then
        setElementVisibleTo ( MarkerCarro13, source, false )
        setElementVisibleTo ( BlipCarro13, source, false )
        setElementVisibleTo ( MarkerCarro14, source, true )
        setElementVisibleTo ( BlipCarro14, source, true )
        setElementData ( source, "Carteira:StartCarro13", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro12", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro14 then
        if getElementData( source, "Carteira:StartCarro13", true ) then
        setElementVisibleTo ( MarkerCarro14, source, false )
        setElementVisibleTo ( BlipCarro14, source, false )
        setElementVisibleTo ( MarkerCarro15, source, true )
        setElementVisibleTo ( BlipCarro15, source, true )
        setElementData ( source, "Carteira:StartCarro14", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro13", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro15 then
        if getElementData( source, "Carteira:StartCarro14", true ) then
        setElementVisibleTo ( MarkerCarro15, source, false )
        setElementVisibleTo ( BlipCarro15, source, false )
        setElementVisibleTo ( MarkerCarro16, source, true )
        setElementVisibleTo ( BlipCarro16, source, true )
        setElementData ( source, "Carteira:StartCarro15", true )
        setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro14", false )
		playSoundFrontEnd ( source, 43 )
        end
		end
		if marker == MarkerCarro16 then
		if getElementData( source, "Carteira:StartCarro15", true ) then
		AutoEscolaCarroVida = getElementHealth ( AutoEscolaCarro[source] )
		if AutoEscolaCarroVida <= CarrosDanoParaReprovar then
		exports.Scripts_Dxmessages:outputDx(source, MsgCarro04, "error")
		else
		setElementData( source, "Habilitacoes:Carros", true)
		exports.Scripts_Dxmessages:outputDx(source, MsgCarro05, "success")
		end
		setTimer ( setElementData, 50, 1, source, "Carteira:StartCarro15", false )
		setElementVisibleTo ( MarkerCarro16, source, false )
		setElementVisibleTo ( BlipCarro16, source, false )
		setElementData ( source, "AirNew_TirandoCarta", "Não" )
		destroyElement ( AutoEscolaCarro[source] )
        setTimer ( setElementInterior, 400, 1, source, 3 )
        setTimer ( setElementDimension, 400, 1, source, 10 )
        setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
        setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
        fadeCamera ( source, false, 0.1, 0, 0, 0 )   
        setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
        setTimer ( setCameraTarget, 600, 1, source )
        end
		end
	  end 
	end	
end
addEventHandler("onPlayerMarkerHit",getRootElement(),emarkerCarros)

function SairDoVeiculoAutoEscolaCarro (source)
if ( AutoEscolaCarro[source] ) and isElement( AutoEscolaCarro[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarro[source] )
setElementData ( source, "Carteira:StartCarro00", false )
setElementData ( source, "Carteira:StartCarro01", false )
setElementData ( source, "Carteira:StartCarro02", false )
setElementData ( source, "Carteira:StartCarro03", false )
setElementData ( source, "Carteira:StartCarro04", false )
setElementData ( source, "Carteira:StartCarro05", false )
setElementData ( source, "Carteira:StartCarro06", false )
setElementData ( source, "Carteira:StartCarro07", false )
setElementData ( source, "Carteira:StartCarro08", false )
setElementData ( source, "Carteira:StartCarro09", false )
setElementData ( source, "Carteira:StartCarro10", false )
setElementData ( source, "Carteira:StartCarro11", false )
setElementData ( source, "Carteira:StartCarro12", false )
setElementData ( source, "Carteira:StartCarro13", false )
setElementData ( source, "Carteira:StartCarro14", false )
setElementData ( source, "Carteira:StartCarro15", false )
setElementVisibleTo ( MarkerCarro01, source, false )
setElementVisibleTo ( BlipCarro01, source, false )
setElementVisibleTo ( MarkerCarro02, source, false )
setElementVisibleTo ( BlipCarro02, source, false )
setElementVisibleTo ( MarkerCarro03, source, false )
setElementVisibleTo ( BlipCarro03, source, false )
setElementVisibleTo ( MarkerCarro04, source, false )
setElementVisibleTo ( BlipCarro04, source, false )
setElementVisibleTo ( MarkerCarro05, source, false )
setElementVisibleTo ( BlipCarro05, source, false )
setElementVisibleTo ( MarkerCarro06, source, false )
setElementVisibleTo ( BlipCarro06, source, false )
setElementVisibleTo ( MarkerCarro07, source, false )
setElementVisibleTo ( BlipCarro07, source, false )
setElementVisibleTo ( MarkerCarro08, source, false )
setElementVisibleTo ( BlipCarro08, source, false )
setElementVisibleTo ( MarkerCarro09, source, false )
setElementVisibleTo ( BlipCarro09, source, false )
setElementVisibleTo ( MarkerCarro10, source, false )
setElementVisibleTo ( BlipCarro10, source, false )
setElementVisibleTo ( MarkerCarro11, source, false )
setElementVisibleTo ( BlipCarro11, source, false )
setElementVisibleTo ( MarkerCarro12, source, false )
setElementVisibleTo ( BlipCarro12, source, false )
setElementVisibleTo ( MarkerCarro13, source, false )
setElementVisibleTo ( BlipCarro13, source, false )
setElementVisibleTo ( MarkerCarro14, source, false )
setElementVisibleTo ( BlipCarro14, source, false )
setElementVisibleTo ( MarkerCarro15, source, false )
setElementVisibleTo ( BlipCarro15, source, false )
setElementVisibleTo ( MarkerCarro16, source, false )
setElementVisibleTo ( BlipCarro16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro06, "error")
setTimer ( setElementInterior, 400, 1, source, 3 )
setTimer ( setElementDimension, 400, 1, source, 10 )
setTimer ( setElementPosition, 400, 1, source, -2029.61829, -104.51949, 1035.17188 )
setTimer ( setElementRotation, 600, 1, source, 0, 0, 180 )
fadeCamera ( source, false, 0.1, 0, 0, 0 )   
setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 600, 1, source )
end
end
addEventHandler ( "onVehicleExit", getRootElement(), SairDoVeiculoAutoEscolaCarro )

function MorrerAutoEscolaCarro ()
if ( AutoEscolaCarro[source] ) and isElement( AutoEscolaCarro[source] ) then
setElementData ( source, "AirNew_TirandoCarta", "Não" )
destroyElement ( AutoEscolaCarro[source] )
setElementData ( source, "Carteira:StartCarro00", false )
setElementData ( source, "Carteira:StartCarro01", false )
setElementData ( source, "Carteira:StartCarro02", false )
setElementData ( source, "Carteira:StartCarro03", false )
setElementData ( source, "Carteira:StartCarro04", false )
setElementData ( source, "Carteira:StartCarro05", false )
setElementData ( source, "Carteira:StartCarro06", false )
setElementData ( source, "Carteira:StartCarro07", false )
setElementData ( source, "Carteira:StartCarro08", false )
setElementData ( source, "Carteira:StartCarro09", false )
setElementData ( source, "Carteira:StartCarro10", false )
setElementData ( source, "Carteira:StartCarro11", false )
setElementData ( source, "Carteira:StartCarro12", false )
setElementData ( source, "Carteira:StartCarro13", false )
setElementData ( source, "Carteira:StartCarro14", false )
setElementData ( source, "Carteira:StartCarro15", false )
setElementVisibleTo ( MarkerCarro01, source, false )
setElementVisibleTo ( BlipCarro01, source, false )
setElementVisibleTo ( MarkerCarro02, source, false )
setElementVisibleTo ( BlipCarro02, source, false )
setElementVisibleTo ( MarkerCarro03, source, false )
setElementVisibleTo ( BlipCarro03, source, false )
setElementVisibleTo ( MarkerCarro04, source, false )
setElementVisibleTo ( BlipCarro04, source, false )
setElementVisibleTo ( MarkerCarro05, source, false )
setElementVisibleTo ( BlipCarro05, source, false )
setElementVisibleTo ( MarkerCarro06, source, false )
setElementVisibleTo ( BlipCarro06, source, false )
setElementVisibleTo ( MarkerCarro07, source, false )
setElementVisibleTo ( BlipCarro07, source, false )
setElementVisibleTo ( MarkerCarro08, source, false )
setElementVisibleTo ( BlipCarro08, source, false )
setElementVisibleTo ( MarkerCarro09, source, false )
setElementVisibleTo ( BlipCarro09, source, false )
setElementVisibleTo ( MarkerCarro10, source, false )
setElementVisibleTo ( BlipCarro10, source, false )
setElementVisibleTo ( MarkerCarro11, source, false )
setElementVisibleTo ( BlipCarro11, source, false )
setElementVisibleTo ( MarkerCarro12, source, false )
setElementVisibleTo ( BlipCarro12, source, false )
setElementVisibleTo ( MarkerCarro13, source, false )
setElementVisibleTo ( BlipCarro13, source, false )
setElementVisibleTo ( MarkerCarro14, source, false )
setElementVisibleTo ( BlipCarro14, source, false )
setElementVisibleTo ( MarkerCarro15, source, false )
setElementVisibleTo ( BlipCarro15, source, false )
setElementVisibleTo ( MarkerCarro16, source, false )
setElementVisibleTo ( BlipCarro16, source, false )
exports.Scripts_Dxmessages:outputDx(source, MsgCarro07, "error")
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorrerAutoEscolaCarro )

function SairDoServidorAutoEscolaCarro ( quitType )	
if isElement( AutoEscolaCarro[source] ) then
destroyElement ( AutoEscolaCarro[source] )
end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SairDoServidorAutoEscolaCarro )

-- ( Final ) Percurso de Carro

MUITO OBRIGADO!

Edited by Vinicios Pfeil
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...