Wiki

Clone wiki

EFLC-MP LUA / onPlayerDeath

Description

This function is triggered once the player dies

Parameters

Int playerId, Int lastDamageType, Int lastDamageGiver
Int playerId

Int lastDamageType: 0: was a player, 1: was a vehicle, -1: unknown

Int lastDamageGiver: ID of the player or vehicle

Return values


Example

#!lua
function myPlayerDeath(playerid, lastDamageType, lastDamageGiver)
    print("Player " .. getPlayerName(playerid) .. "(" .. playerid .. ") died")
    if(lastDamageType == 0) then
        if(isPlayerOnline(lastDamageGiver)) then
            print(getPlayerName(lastDamageGiver) .. " killed " .. getPlayerName(playerid))
        else
            --The player is no longer online
        end
    end
end
registerEvent("myPlayerDeath", "onPlayerDeath")

Updated