GetProjectileCreator: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:
function killed(killer,weapon,bodypart)
function killed(killer,weapon,bodypart)
   if (weapon == 16 or 17 or 18 or 39) then
   if (weapon == 16 or 17 or 18 or 39) then
       outputChatBox("Who killed you: "getProjectileCreator(weapon)".",100,0,0)
       outputChatBox("Who killed you: "..getProjectileCreator(weapon)".",100,0,0)
   end
   end
end
end

Revision as of 01:21, 17 November 2011

This function returns the creator of the specified projectile.

Syntax

element getProjectileCreator ( projectile theProjectile )

Required Arguments

  • theProjectile: The projectile element which creator you want to retrieve.

Returns

Returns the element which created the projectile if successful, false otherwise.

Example

This example tells the player who's the projectile creator that killed them.

function killed(killer,weapon,bodypart)
   if (weapon == 16 or 17 or 18 or 39) then
       outputChatBox("Who killed you: "..getProjectileCreator(weapon)".",100,0,0)
   end
end
addEventHandler("onClientPedWasted",getRootElement(),killed)

See also