getProjectileTarget | Multi Theft Auto: Wiki Skip to content

getProjectileTarget

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function returns the target of the specified projectile.

Syntax

getProjectileTarget ( )

Code Examples

client

This example allows a player to send projectiles at other players.

function projectileCreating(command,targetPlayer)
local x,y,z = getElementPosition(getLocalPlayer()) -- Get the position of the player
local target = getPlayerFromName(targetPlayer) or nil -- Get the target, or set it to nil if no target specified
local theProjectile = createProjectile(getLocalPlayer(),20,x,y,z+50,1.0,target)
if (target) then
outputChatBox("Created projectile's target: "..getPlayerName(getProjectileTarget(theProjectile)))
else
outputChatBox("Created projectile with no target")
end
end
addCommandHandler("rocket",projectileCreating) -- Bind the 'rocket' command to projectileCreating function