GetProjectileCreator: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Added example description)
m (Removed from 'Needs Example' list)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{Needs Example}}
This function returns the creator of the specified projectile.
This function returns the creator of the specified projectile.



Revision as of 16:10, 24 May 2012

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 will output a message in the chatbox saying who created The projectile.

Click to collapse [-]
Client
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)

See also