Jump to content

Help in Explode Player Script


^Dev-PoinT^

Recommended Posts

Posted

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

Posted

i do, you don't. because you can't script for shit.

just wait for someone to figure that out for you, i'm not doing it. just passing by.

Posted

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 
    ) 

Posted

I prevented it because any other player would not be aware of the explosion except the source of the onPlayerWasted (to whom I'm triggering the event to create an explosion to)

You need to understand the difference between clientside and serverside before you learn anymore of scripting

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