RU/getGravity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with '__NOTOC__ {{RU/Server client function}} This function returns the current gravity level for the context in which it is called (server or client). ==Syntax== <syntaxhighlight lang="lua"> float …')
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{RU/Server client function}}
{{RU/Server client function}}
This function returns the current gravity level for the context in which it is called (server or client).
Эта функция показывает текущее значение уровня гравитации.


==Syntax==
==Использование==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float getGravity()
float getGravity()
</syntaxhighlight>
</syntaxhighlight>


===Returns===
===Что возвращается===
Returns a float with the current server or client (depending on where you call the function) gravity level.
Возвращается величина, показывающая значение уровня гравитации.


==Example==
==Пример==
<section name="Server" class="server" show="true">
<section name="Сервер" class="server" show="true">
This serverside command outputs the serverside gravity level.
В этом примере мы добавляем команду, которая показывает уровень гравитации со стороны сервера на данный момент.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function getGravityLevel( playerSource )
function getGravityLevel( playerSource )
Line 19: Line 19:
     outputConsole ( "The gravity is currently set to " .. gravity, playerSource )
     outputConsole ( "The gravity is currently set to " .. gravity, playerSource )
end
end
-- attach the 'getGravityLevel' function to the "gravity" command
-- привязываем функцию 'getGravityLevel' к команде "gravity"
addCommandHandler ( "gravity", getGravityLevel )
addCommandHandler ( "gravity", getGravityLevel )
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>


==Примечание==
==Смотри также==
{{RU/World functions}}
{{RU/World functions}}
[[en:getGravity]]

Latest revision as of 09:28, 8 March 2010

Эта функция показывает текущее значение уровня гравитации.

Использование

float getGravity()

Что возвращается

Возвращается величина, показывающая значение уровня гравитации.

Пример

Click to collapse [-]
Сервер

В этом примере мы добавляем команду, которая показывает уровень гравитации со стороны сервера на данный момент.

function getGravityLevel( playerSource )
    local gravity = getGravity ( )
    outputConsole ( "The gravity is currently set to " .. gravity, playerSource )
end
-- привязываем функцию 'getGravityLevel' к команде "gravity"
addCommandHandler ( "gravity", getGravityLevel )

Смотри также