GetEffectSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{New items|4.0132|1.4 r6208|
{{New items|3.014|1.4 r6208|
This function gets the speed the effect.
This function gets the speed of a specified [[effect]].
}}
}}


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float   getEffectSpeed(effect)
float getEffectSpeed ( effect theEffect )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[effect]]:getSpeed|speed|setEffectSpeed}}


===Required Arguments===  
===Required Arguments===  
*'''effect:''' The name of the [[Element/Effect#Effects_list|effect]].
*'''theEffect:''' The [[effect]] to get the speed of.
 
===Returns===
Returns [[float]] containing the effect's speed, ''false'' if invalid arguments were specified.


===Example===
===Example===
<section name="Client" class="client" show="true">
This example adds command ''ges'' that creates crate explosion effect at the player's position and outputs its speed to the chatbox.
<syntaxhighlight lang="lua">[Lua]
<syntaxhighlight lang="lua">
addCommandHandler("ges",  
addCommandHandler("ges",  
function (cmd)
function (cmd)
   local x, y, z = getElementPosition (localPlayer)
   local x, y, z = getElementPosition(localPlayer)
   local effect = createEffect ("explosion_crate", x, y, z)
   local effect = createEffect("explosion_crate", x, y, z)
   getEffectSpeed (effect) -- The default get 1.0
   outputChatBox("The speed: " .. tostring(getEffectSpeed(effect)))
end)
end)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See also==
==See also==
{{Client_Effects_functions}}
{{Client_Effects_functions}}
[[ru:getEffectSpeed]]
[[ru:getEffectSpeed]]

Latest revision as of 13:55, 7 May 2017

This function gets the speed of a specified effect.

Syntax

float getEffectSpeed ( effect theEffect )

OOP Syntax Help! I don't understand this!

Method: effect:getSpeed(...)
Variable: .speed
Counterpart: setEffectSpeed


Required Arguments

  • theEffect: The effect to get the speed of.

Returns

Returns float containing the effect's speed, false if invalid arguments were specified.

Example

This example adds command ges that creates crate explosion effect at the player's position and outputs its speed to the chatbox.

addCommandHandler("ges", 
function (cmd)
   local x, y, z = getElementPosition(localPlayer)
   local effect = createEffect("explosion_crate", x, y, z)
   outputChatBox("The speed: " .. tostring(getEffectSpeed(effect)))
end)

See also