GetProjectileForce: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:
Returns a [[float]] if successful, ''false'' otherwise.
Returns a [[float]] if successful, ''false'' otherwise.


==Example==
==Example==  
<section class="client" name="Client script" show="true">
'''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">
-- TODO
 
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>
</section>


==See also==
==See also==
{{Client projectile functions}}
{{Client projectile functions}}
[[it:getProjectileForce]]
[[it:getProjectileForce]]

Revision as of 09:51, 18 January 2014

Accessories-text-editor.png Script Example Missing Function GetProjectileForce needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.

This function returns the force of the specified projectile.

Syntax

float getProjectileForce ( projectile theProjectile )

Required Arguments

  • theProjectile: The projectile element which force you want to retrieve.

Returns

Returns a float if successful, false otherwise.

Example

Click to collapse [-]
Client script

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
)

See also