GetProjectileCreator: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser32 (talk | contribs) No edit summary |
m (Added example) |
||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler("onClientProjectileCreation", root, function(projectile) | |||
local creator = getProjectileCreator(projectile) | |||
if (getElementType(creator) == "player") then | |||
local pName = getPlayerName(creator) | |||
local projectileID = getProjectileType(projectile) | |||
outputChatBox(pName.." created a projectile! (ID: "..projectileID..")", 255, 200, 0, false) | |||
end | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 15:59, 24 May 2012
Script Example Missing Function GetProjectileCreator needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
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
addEventHandler("onClientProjectileCreation", root, function(projectile) local creator = getProjectileCreator(projectile) if (getElementType(creator) == "player") then local pName = getPlayerName(creator) local projectileID = getProjectileType(projectile) outputChatBox(pName.." created a projectile! (ID: "..projectileID..")", 255, 200, 0, false) end end)