Jump to content

change explosion demage


Xwad

Recommended Posts

Hi. Please help I need a script for my server that makes possible to change the explosion demage on the s.w.a.t. vehicle. I mean if I shoot the s.w.a.t. vehicle with an rpg then it will only demage 500hp becaouse I dont like that the vehicle is blowing up after 1 shoot. Thanks.

Link to comment

Is it correct? And is it server side?

  
local weapons = { 
    [36] = true, -- Heat-Seeking RPG  
    [35] = true, -- Rocket Launcher 
} 
  
function ChangeDemage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapons[weapon] and getElementModel(source) == 601 then 
    if (getElementHealth(source) < 1000) then 
            setElementHealth(source,getElementHealth(source) - 500) 
            setVehicleDamageProof(source, false) 
    end 
end 
addEventHandler("onClientVehicleDemage",getRootElement(),ChangeDemage) 
  

Link to comment

now good?

  
local weapons = { 
    [36] = true, -- Heat-Seeking RPG 
    [35] = true, -- Rocket Launcher 
} 
  
function ChangeDemage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapons[weapon] and getElementModel(source) == 601 then 
    if (getElementHealth(source) < 1000) then 
            setElementHealth(source,getElementHealth(source) - 500) 
            setVehicleDamageProof(source, false) 
    end 
end 
addEventHandler("onVehicleDemage",getRootElement(),ChangeDemage) 
  

Link to comment
  
local weaponsToDamageSwat = { 
    [36] = true,  
    [35] = true,  
     
} 
  
function handleSwatDamage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon and getElementModel(source) == 601 and loss > 0) then 
        if (weaponsToDamageSwat[weapon]) then 
               setElementHealth(source,getElementHealth(source) - 500) 
                         setVehicleDamageProof(source, false) 
                     end 
        end 
    end 
end 
addEventHandler("onClientVehicleDamage", root, handleSwatDamage) 

Link to comment
  
local weaponsToDamageSwat = { 
    [36] = true,  
    [35] = true,  
     
} 
  
function handleSwatDamage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon and getElementModel(source) == 601 and loss > 0) then 
        if (weaponsToDamageSwat[weapon]) then 
               setElementHealth(source,getElementHealth(source) - 500) 
                         setVehicleDamageProof(source, false) 
                     end 
        end 
    end 
end 
addEventHandler("onClientVehicleDamage", root, handleSwatDamage) 

Wath is the problem ?

Link to comment

Here:

local weapons = { 
    [1] = true,[22] = true,[31] = true,[42] = true,[15] = true, 
    [2] = true,[23] = true,[32] = true,[43] = true,[16] = true, 
    [3] = true,[24] = true,[33] = true,[44] = true,[17] = true, 
    [4] = true,[25] = true,[34] = true,[45] = true,[18] = true, 
    [5] = true,[26] = true,[37] = true,[46] = true, 
    [6] = true,[27] = true,[38] = true,[10] = true, 
    [7] = true,[28] = true,[39] = true,[11] = true, 
    [8] = true,[29] = true,[40] = true,[12] = true, 
    [9] = true,[30] = true,[41] = true,[14] = true, 
} 
  
function damage(attacker, weapon, loss, x, y, z, tyre) 
    if weapon and not weapons[weapon] then 
        if getElementModel(source) == 601 then 
        cancelEvent() 
        setElementHealth(source,getElementHealth(source) - 100) 
        end 
    end  
end 
addEventHandler("onClientVehicleDamage", root, damage) 

Link to comment

Use id 51 ----- It's explosion id

Eg: This will make all vehicle lose 300hp with explosive weapons like rocket laucher,rpg..., It won't explode the vehicle.

function noob(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 51 and getElementType(source) == "vehicle") then 
        setElementHealth(source,getElementHealth(source) - 300) 
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, noob) 

You can find the actual weapon id for a weapon using this

outputDebugString("Test: weaponid: " .. tostring(weapon)) 

Link to comment

i convert the script that only swat vehicle will blow after 3 shoot but it dosent work pls help!!

  
function noob(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 51 and getElementModel(source) == 601 then 
        setElementHealth(source,getElementHealth(source) - 255) 
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, noob) 
  

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