Jump to content

Help in Explode Player Script


^Dev-PoinT^

Recommended Posts

Hi all i have made This with Benjmex

but the error is when The Player Die he Explode right but the Players next the Player who Explode the die To i need the damge to the Player who die only :D

function onKill(ammo, killer, weapon, bodypart) 
    if killer and killer ~= source and getElementType ( killer ) == "player" then 
        local x, y, z = getElementPosition(source) 
        createExplosion (x, y, z, 10) 
        outputChatBox("You have been exploded by " .. getPlayerName(killer), getRootElement(), 255, 255, 0, true) 
    end 
end 
addEventHandler("onPlayerWasted", getRootElement(), onKill) 

Sry for My Bad english :D

Link to comment

I believe you have to create the explosion clientside only for the 'source'

--serverside 
    function onKill(ammo, killer, weapon, bodypart) 
        if killer and killer ~= source and getElementType ( killer ) == "player" then 
            local x, y, z = getElementPosition(source) 
            --createExplosion (x, y, z, 10) 
            triggerClientEvent(source, "explodeMe", source, x, y, z, 10) 
            outputChatBox("You have been exploded by " .. getPlayerName(killer), getRootElement(), 255, 255, 0, true) 
        end 
    end 
    addEventHandler("onPlayerWasted", getRootElement(), onKill) 
     
    --clientside 
    addEvent('explodeMe', true) 
    addEventHandler('explodeMe', getRootElement(), 
    function(x,y,z,type) 
        createExplosion (x, y, z, type) 
    end 
    ) 

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