GetProjectileForce: Difference between revisions
Jump to navigation
Jump to search
(Created page with '__NOTOC__ {{Client function}} This function returns the force of the specified projectile. ==Syntax== <syntaxhighlight lang="lua"> int getProjectileForce ( projectile theProjectile ) </syntaxhighlight> …') |
(Added OOP syntax) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float getProjectileForce ( projectile theProjectile ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[projectile]]:getForce|force}} | |||
==Required Arguments== | ===Required Arguments=== | ||
*'''theProjectile:''' The [[projectiles| projectile]] element which force you want to retrieve. | *'''theProjectile:''' The [[projectiles| projectile]] element which force you want to retrieve. | ||
Line 14: | Line 15: | ||
Returns a [[float]] if successful, ''false'' otherwise. | Returns a [[float]] if successful, ''false'' otherwise. | ||
==Example== | ==Example== | ||
'''Example 1:''' This example would outputs the force of the projectile on 1-100 scale. This function just works with projectiles which you throw so just grenades, satchel charge etc | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | |||
addEventHandler("onClientProjectileCreation", getRootElement(), | |||
--The source of this event is the projectile that was created. | |||
function () | |||
local getForce = getProjectileForce(source) | |||
outputChatBox(getForce*100) -- outputs the force of the projectile on 1-100 scale | |||
end | |||
) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{Client projectile functions}} | {{Client projectile functions}} | ||
[[ | [[it:getProjectileForce]] |
Latest revision as of 17:41, 26 November 2014
This function returns the force of the specified projectile.
Syntax
float getProjectileForce ( projectile theProjectile )
OOP Syntax Help! I don't understand this!
- Method: projectile:getForce(...)
- Variable: .force
Required Arguments
- theProjectile: The projectile element which force you want to retrieve.
Returns
Returns a float if successful, false otherwise.
Example
Example 1: This example would outputs the force of the projectile on 1-100 scale. This function just works with projectiles which you throw so just grenades, satchel charge etc
addEventHandler("onClientProjectileCreation", getRootElement(), --The source of this event is the projectile that was created. function () local getForce = getProjectileForce(source) outputChatBox(getForce*100) -- outputs the force of the projectile on 1-100 scale end )