GetProjectileCreator: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 15: Line 15:


==Example==
==Example==
This example tells the player who's the projectile creator that killed them.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
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)
</syntaxhighlight>
</syntaxhighlight>


==See also==
==See also==
{{Client projectile functions}}
{{Client projectile functions}}
[[Category:Needs_Example]]

Revision as of 01:20, 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