Jump to content

COMO COLOCO VARIOS SPAWN DE CARROS?


Recommended Posts

Quero por outro marcador e outro spawn de carro, pra ficar 2 spawns, mais sempre buga e fica somente 1 ou buga e fica 2 marcadores e 1 veiculo, aqui esta o script com 1 spawn de carro, eu quero colocar outro spawn


iniMarker = createMarker( 163.7912902832, 1808.8654785156, 16.640625, "cylinder", 3.5, 200,225,1,50)
destroyM = createMarker( 127.0807723999, 1809.0919189453, 16.640625, "cylinder", 3.9, 255,255,255,100)

function msg(player)
    outputChatBox("#FFD700»Você Pegou Um Carro Do #00FF00Exécito Brasileiro«", player, 255,255,255,true)
end
addEventHandler("onMarkerHit", iniMarker, msg)

veh = {}
function spawnVehicle(player)
    if isElementWithinMarker(player, iniMarker) then
        if veh[player] and isElement( veh[player] ) then destroyElement(veh[player])
            veh[player] = nil 
        end     
        veh[player] = createVehicle(490, 157.12101745605, 1822.6125488281, 17.640625)
        warpPedIntoVehicle(player, veh[player])
    end
end
addEventHandler("onMarkerHit", iniMarker, spawnVehicle)

function msgDestroy(player)
    outputChatBox("Voce Destroiu o Carro Do #00FF00Exécito Brasileiro", player, 255,255,255,true)
end
addEventHandler("onMarkerHit", destroyM, msgDestroy)


function destroy(player)
    if isElementWithinMarker(player, destroyM) then
    if isPedInVehicle(player) == true then
        destroyElement(veh[player])
        outputChatBox("", player, 255,255,255,true)
    else
        outputChatBox("", player, 255,255,255,true)
    end
end
end
addEventHandler("onMarkerHit", destroyM, destroy)  


Link to comment

Eu recomendo que você não use a função isElementWithinMarker, pois é desnecessário enquanto estiver dentro do evento onMarkerHit, pois o evento em si só funcionará se você estiver pressionando o marcador.

iniMarker = createMarker( 163.7912902832, 1808.8654785156, 16.640625, "cylinder", 3.5, 200,225,1,50) -- 1ro
destroyM = createMarker( 127.0807723999, 1809.0919189453, 16.640625, "cylinder", 3.9, 255,255,255,100)

iniMarkerX = createMarker( x, y, z, "cylinder", 3.5, 200,225,1,50) -- 2do

function msg(player)
    outputChatBox("#FFD700»Você Pegou Um Carro Do #00FF00Exécito Brasileiro«", player, 255,255,255,true)
end
addEventHandler("onMarkerHit", iniMarker, msg)

veh = {}

function spawnVehicle(player)
    if source == iniMarker or source == iniMarkerX then
        if veh[player] and isElement( veh[player] ) then destroyElement(veh[player])
            veh[player] = nil 
        end     
        veh[player] = createVehicle(490, 157.12101745605, 1822.6125488281, 17.640625)
        warpPedIntoVehicle(player, veh[player])
    end
end
addEventHandler("onMarkerHit", root, spawnVehicle)

function msgDestroy(player)
    outputChatBox("Voce Destroiu o Carro Do #00FF00Exécito Brasileiro", player, 255,255,255,true)
end
addEventHandler("onMarkerHit", destroyM, msgDestroy)


function destroy(player)
    if isElementWithinMarker(player, destroyM) then
    if isPedInVehicle(player) == true then
        destroyElement(veh[player])
        outputChatBox("", player, 255,255,255,true)
    else
        outputChatBox("", player, 255,255,255,true)
    end
end
end
addEventHandler("onMarkerHit", destroyM, destroy)  

 

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...