Jump to content

ayuda de como hacer este script


JuanM27

Recommended Posts

Posted

hola buenas noches.

estoy queriendo hacer un script para que el vehiculo no Explote.

yo lo hice asi pero no anda

function displayVehicleLoss(loss) 
   local VidaAuto = getElementHealth(getVehicleOccupant(source)) 
     outputChatBox("Le Queda de Vida " .. tonumber(VidaAuto) .. " health.", source) 
   local MiAuto = getPedOccupiedVehicle (source) 
   if tonumber(VidaAuto) <= 251 then 
        setVehicleEngineState ( MiAuto, false ) 
        else 
        setVehicleEngineState ( MiAuto, true ) 
        end 
end 
  
addEventHandler("onVehicleDamage", getRootElement(), displayVehicleLoss) 

que esta mal o que me falta?

saludos

n-560x95_FFFFFF_FFFFFF_000000_000000.png
Posted

Esta todo mal.

function displayVehicleLoss ( loss ) 
    local VidaAuto = math.floor ( tonumber ( getElementHealth ( source ) ) ) 
    local driver = getVehicleController ( source ) 
    if ( driver ) then 
        outputChatBox ( "Le queda ".. VidaAuto .."% de vida a tu vehiculo.", driver ) 
    end 
    if ( VidaAuto <= 251 ) then 
        setVehicleEngineState ( source, false ) 
    else 
        setVehicleEngineState ( source, true ) 
    end 
end 
addEventHandler ( "onVehicleDamage", getRootElement(), displayVehicleLoss ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

gracias solid

hasta aca va bien, con esto me apaga el motor del auto

setVehicleEngineState ( source, false ) 

pero lo que yo quiero hacer es que el auto no explote (lo vi en varios server, por ejemplo el cit o proyectX)

tendria que hacer que cancele el evento

OnVehicleExplode 

verdad?

n-560x95_FFFFFF_FFFFFF_000000_000000.png
Posted

No, no se puede cancelar ese evento.

En el SAUR yo lo hice asi:

setElementHealth ( source, 300 ) 
setVehicleDamageProof ( source, true ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ah no sabia que no se podia cancelar ese evento.

la verdad solid muchas gracias

siempre me ayudaste en todas mis preguntas sos un kpo

n-560x95_FFFFFF_FFFFFF_000000_000000.png
Posted

De nada.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

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