Jump to content

What function do I need to?


GamerDeMTA

Recommended Posts

  • Moderators

Well no, satchel's are sharing same explosion the grenade.

But you can try something like this: (this have to be done per player because satchel positions aren't synced)

  
-- client -- 
addCommandHandler("getallSatchels", 
function () 
    local projectileTable = getElementsByType ("projectile") 
    local projectileDataTable = {} 
    for i=1, #projectileTable do 
        local projectile = projectileTable[i] 
        if getProjectileType(projectile) == 39 and getProjectileCreator (projectile) == localPlayer then 
            local x,y,z = getElementPosition(projectile) 
            projectileDataTable[#projectileDataTable+1] = {x=x,y=y,z=z} 
        end 
    end 
    if #projectileDataTable >0 then 
        triggerLatentServerEvent(localPlayer,"allSatchel",localPlayer,projectileDataTable) 
    end 
end) 
  

-- server -- 
addEvent("allSatchel",true) 
addEventHandler("allSatchel",root, 
function (projectileDataTable) 
    if isElement(source) then 
        detonateSatchels (source) -- blow the satchels -- 
        local players = getElementsbyType("player") -- get all the players 
        for p=1,#players do -- loop through all the players 
            local pX,pY,Pz = getElementPosition(players[p] 
            for X=1,#projectileDataTable do -- loop through all the satchels per player 
                local satchelPosition = projectileDataTable[X] 
                if getDistanceBetweenPoints3D ( pX,pY,Pz, satchelPosition.x, satchelPosition.y, satchelPosition.z ) < 5 then -- compare the distance 
                     
                end 
            end 
        end 
    end 
end) 

@kevenvz, first read, then answer. :idea:

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