Yes, it'll be more efficient.
local killers = { }
addEventHandler ( "onPlayerWasted", getRootElement(),
function ( totalammo, killer, killerWeapon, bodypart )
if isElementWithinColShape ( source, arena ) then
local detection = isElementWithinColShape ( source, arena )
local detectionKiller = isElementWithinColShape ( killer, arena )
if detection then
local x, y, z = unpack ( ( close == 1 and randspawn [ math.random ( #randspawn ) ] ) or { 577.92224121094, -2621.6677246094, 1378.0678710938 } )
setTimer (
function ( thePlayer, dx, dy, dz )
if ( isElement ( thePlayer ) ) then
setElementPosition ( thePlayer, dx, dy, dz )
setPedRotation ( thePlayer, 180 )
end
end
,5000, source, x, y, z
)
killers [ source ] = killer
end
end
end
)
addEventHandler ( "onPlayerSpawn", root,
function ( )
if ( isElement ( killers [ source ] ) ) then
setElementHealth ( killers [ source ], 200 )
end
killers [ source ] = nil
end
)
Not tested.