Jump to content

Bombas


Arsilex

Recommended Posts

Como hacer para que cuando ponga la bomba se ponga en el coche que estoy y cuando entro que explote y no exploten otros coches osea solo 1 vez :S

function blowVehicleEnterr ( thePlayer, seat, jacked ) 
    if seat == 0 then 
        blowVehicle ( source ) 
        cancelEvent() 
  
    end 
end 
  
function bomba11() 
addEventHandler ( "onVehicleEnter", getRootElement(), blowVehicleEnterr ) 
end 
addEvent( "onBomba1", true ) 
addEventHandler( "onBomba1", getRootElement(), bomba11) 
  
function blowVehicleEnter ( thePlayer, seat, jacked ) 
    if seat == 0 then 
        setTimer ( 
            function (thePlayer) 
                blowVehicle ( source ) 
            end 
            ,6000,1 
        ) 
    end 
end 
  
function bomba22() 
addEventHandler ( "onVehicleEnter", getRootElement(), blowVehicleEnter ) 
end 
addEvent( "onBomba2", true ) 
addEventHandler( "onBomba2", getRootElement(), bomba22) 

Link to comment
bombVehicles = { } 
  
function bomba11 ( ) 
    local vehicle = getPedOccupiedVehicle ( source ) 
    if ( vehicle ) then 
        bombVehicles [ vehicle ] = true 
    end 
end 
addEvent ( "onBomba1", true ) 
addEventHandler ( "onBomba1", getRootElement(), bomba11 ) 
  
function blowVehicleEnter ( thePlayer, seat, jacked ) 
    if ( seat == 0 and bombVehicles [ source ] ) then 
        setTimer ( 
            function ( ) 
                blowVehicle ( source ) 
            end 
            ,6000, 1 
        ) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), blowVehicleEnter ) 
  
function bomba22 ( ) 
    local vehicle = getPedOccupiedVehicle ( source ) 
    if ( vehicle ) then 
        bombVehicles [ vehicle ] = true 
    end 
end 
addEvent ( "onBomba2", true ) 
addEventHandler ( "onBomba2", getRootElement(), bomba22 ) 

Link to comment
si no explotan pero tampoco explota el coche que tiene la bomba :S

Si no me equivoco, quieres que explote solo un auto especifico?

Puedes intentar así:

local auto = createVehicle(argumentos) --no me tomare el tiempo de ponerlos, sabes que va ahí. 
  
function blowVehicleEnterr ( thePlayer, seat, jacked ) 
    if seat == 0 and source == auto then --compruebas si el auto es 'auto' 
        blowVehicle ( source ) 
        cancelEvent() 
  
    end 
end 

Link to comment
No es para mi role en role el createVehicle da error en getElement y lo borra automatico lo que quiero es que tengo un panel presiona el boton de comprar bomba y se ponga me salgo dejo el caro donde quiero y quien se suba que aga boom

Puedes usar los element data, al pulsarse el botón, deja el element data del vehículo en true, al subir, compruebas si es true, si es así, BOOM.

Link to comment

Bueno mira tengo solucionado lo de que no explota pero ahora tengo otra duda

function bomba22 ( ) 
    local vehicle = getPedOccupiedVehicle ( source ) 
    if ( vehicle ) then 
        bombVehicles [ vehicle ] = true 
        setTimer ( 
            function ( ) 
                addEventHandler ( "onVehicleEnter", getRootElement(), blowVehicleEnterr ) 
            end 
            ,6000,1 
        ) 
    end 
end 
addEvent ( "onBomba2", true ) 
addEventHandler ( "onBomba2", getRootElement(), bomba22 ) 
  
function blowVehicleEnterr ( thePlayer, seat, jacked ) 
    if ( seat == 0 and bombVehicles [ source ] ) then 
                blowVehicle ( source ) 
    end 
end 
  

Como es posible hacer que explote en 10 segundos ?

Link to comment
Bueno mira tengo solucionado lo de que no explota pero ahora tengo otra duda
function bomba22 ( ) 
    local vehicle = getPedOccupiedVehicle ( source ) 
    if ( vehicle ) then 
        bombVehicles [ vehicle ] = true 
        setTimer ( 
            function ( ) 
                addEventHandler ( "onVehicleEnter", getRootElement(), blowVehicleEnterr ) 
            end 
            ,6000,1 
        ) 
    end 
end 
addEvent ( "onBomba2", true ) 
addEventHandler ( "onBomba2", getRootElement(), bomba22 ) 
  
function blowVehicleEnterr ( thePlayer, seat, jacked ) 
    if ( seat == 0 and bombVehicles [ source ] ) then 
                blowVehicle ( source ) 
    end 
end 
  

Como es posible hacer que explote en 10 segundos ?

Pon un setTimer en el 'blowVehicle'.

Link to comment
function bomba22 ( ) 
    local vehicle = getPedOccupiedVehicle ( source ) 
    if ( vehicle ) then 
        bombVehicles [ vehicle ] = true 
  
    end 
end 
addEvent ( "onBomba2", true ) 
addEventHandler ( "onBomba2", getRootElement(), bomba22 ) 
  
function blowVehicleEnterr ( thePlayer, seat, jacked ) 
    if ( seat == 0 and bombVehicles [ source ] ) then 
        setTimer ( 
            function ( ) 
                blowVehicle ( source ) 
            end 
            ,6000,1 
        ) 
    end 
end 
 addEventHandler ( "onVehicleEnter", getRootElement(), blowVehicleEnterr ) 

Link to comment
  • Recently Browsing   0 members

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