GetPlayerScriptDebugLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server client function}}
{{Server function}}
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
{{New feature/item|3.0158|1.5.7|19626|
This will allow you to retrieve the player current debug script level.
This will allow you to retrieve the player current debug script level.
 
}}
==Syntax==  
==Syntax==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getPlayerScriptDebugLevel( player thePlayer )
int getPlayerScriptDebugLevel( player thePlayer )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[player]]:getScriptDebugLevel|scriptDebugLevel}}
{{OOP||[[player]]:getScriptDebugLevel|scriptDebugLevel|setPlayerScriptDebugLevel}}
===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
Line 21: Line 22:
<!-- Explain what the example is in a single sentance -->
<!-- Explain what the example is in a single sentance -->
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
This will show your debug script level on your screen.
Displays a message in the chat what is the player's debug level.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler('onClientRender', root, function()
function showdebug (player)
     dxDrawText("Debug Script Level: "..getPlayerScriptDebugLevel(localPlayer), 10, 10)
    local level = getPlayerScriptDebugLevel( player )
end)
     outputChatBox( "Your Script Debug Level: " .. level )
end
addCommandHandler ( "showdebug", showdebug )
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|1.5.7-9.19626|n/a|}}


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{Player_functions}}
{{Player_functions}}

Latest revision as of 14:15, 25 October 2020

This will allow you to retrieve the player current debug script level.

Syntax

int getPlayerScriptDebugLevel( player thePlayer )

OOP Syntax Help! I don't understand this!

Method: player:getScriptDebugLevel(...)
Variable: .scriptDebugLevel
Counterpart: setPlayerScriptDebugLevel


Required Arguments

  • thePlayer: The person whose debug script level you want

Returns

Returns an int with the player debug script level, false if the player is invalid.

Example

Displays a message in the chat what is the player's debug level.

function showdebug (player)
    local level = getPlayerScriptDebugLevel( player )
    outputChatBox( "Your Script Debug Level: " .. level )
end
addCommandHandler ( "showdebug", showdebug )

Requirements

Minimum server version 1.5.7-9.19626
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.7-9.19626" />

See Also