GetProjectileCreator

From Multi Theft Auto: Wiki

This function returns the creator of the specified projectile.

Syntax

element getProjectileCreator ( projectile theProjectile )

OOP Syntax Help! I don't understand this!

Method: projectile:getCreator(...)
Variable: .creator

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

Click to collapse [-]
Client

This example will output a message in the chatbox saying who created the projectile.

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