Jump to content

explosion no harm


Fabioxps

Recommended Posts

how can I cause an explosion that will not harm the player

local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) 
  
function shapeHit(hitPlayer, matchingDimension) 
  local pX, pY, pZ = getElementPosition ( source ) 
  createExplosion ( pX, pY, pZ, 6, hitPlayer ) 
end 
addEventHandler( 'onColShapeHit', zone, shapeHit ) 

Link to comment

-- Example 2: This will cause an explosion that will not harm the player. Wiki! 
function fakeBomb(x,y,z,d) 
    if d then --Check the players Dimension 
        if getElementDimension(getLocalPlayer()) == d then 
                        --If the players Dimension is the current dimension 
                        --Then people on other dimensions cant see this explosion 
            createExplosion(x, y, z, 0, true, -1.0, false) 
        end 
    else 
        createExplosion(x,y,z,0,true,-1.0,false) 
    end 
end 
addEvent("fakeBomb",true) 
addEventHandler("fakeBomb",getRootElement(),fakeBomb) 
Link to comment
function fakeBomb(x,y,z,d) 
    if d then --Check the players Dimension 
        if getElementDimension(getLocalPlayer()) == d then 
                        --If the players Dimension is the current dimension 
                        --Then people on other dimensions cant see this explosion 
            createExplosion(x, y, z, 0, true, -1.0, false) 
        end 
    else 
        createExplosion(x,y,z,0,true,-1.0,false) 
    end 
end 
addEvent("fakeBomb",true) 
addEventHandler("fakeBomb",getRootElement(),fakeBomb) 

local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) 
  
function shapeHit(hitPlayer, matchingDimension) 
local pX, pY, pZ = getElementPosition ( source ) 
createExplosion ( pX, pY, pZ, 6, hitPlayer, true, true, false ) 
triggerClientEvent ( "fakeBomb", getRootElement(), x, y, z, 0 ) 
end 
addEventHandler( 'onColShapeHit', zone, shapeHit ) 

Edited by Guest
Link to comment

-- client side:

function fakeBomb ( x, y, z ) 
    createExplosion ( x, y, z, 0, true, -1.0, false ) 
end 
addEvent ( "fakeBomb", true ) 
addEventHandler ( "fakeBomb", getRootElement(), fakeBomb ) 

-- server side:

local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) 
  
function shapeHit ( hitPlayer ) 
    triggerClientEvent ( root, "fakeBomb", root, getElementPosition ( hitPlayer ) ) 
end 
addEventHandler( 'onColShapeHit', zone, shapeHit ) 

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