SetPlayerScriptDebugLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server client function}} <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> This will set player's debug lev...")
 
(Remove obsolete Requirements section)
 
(7 intermediate revisions by 5 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 set player's debug level, equivalent to [[Debugging|debugscript <level>]].
This will set player's debug level, equivalent to [[Debugging|debugscript <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 -->
Line 9: Line 10:
bool setPlayerScriptDebugLevel ( player thePlayer, int level )
bool setPlayerScriptDebugLevel ( player thePlayer, int level )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[player]]:setScriptDebugLevel|getScriptDebugLevel}}
{{OOP||[[player]]:setScriptDebugLevel|scriptDebugLevel|getPlayerScriptDebugLevel}}
===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 23: Line 24:
This code will set joining players debug level to (3), (It is no recommended to use it in production, specially if you have sensitive data in your logs).
This code will set joining players debug level to (3), (It is no recommended to use it in production, specially if you have sensitive data in your logs).
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler('onPlayerJoin', root, function()
function setPlayerDebug (player)
     setPlayerScriptDebugLevel(source, 3)
     setPlayerScriptDebugLevel(player, 3)
end)
    outputChatBox("You set debug script level to 3", player)
end  
addCommandHandler("setdebug", setPlayerDebug)  
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
Line 31: Line 34:
==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|server}}

Latest revision as of 17:18, 7 November 2024

This will set player's debug level, equivalent to debugscript <level>.

Syntax

bool setPlayerScriptDebugLevel ( player thePlayer, int level )

OOP Syntax Help! I don't understand this!

Method: player:setScriptDebugLevel(...)
Variable: .scriptDebugLevel
Counterpart: getPlayerScriptDebugLevel


Required Arguments

  • thePlayer: The player whose debug level you wish to change
  • level: 0: close debug console, 1: only errors, 2: errors and warnings, 3: errors, warnings and info messages

Returns

Returns true if successful, false otherwise.

Example

Click to collapse [-]
Server

This code will set joining players debug level to (3), (It is no recommended to use it in production, specially if you have sensitive data in your logs).

function setPlayerDebug (player)
    setPlayerScriptDebugLevel(player, 3)
    outputChatBox("You set debug script level to 3", player)
end 
addCommandHandler("setdebug", setPlayerDebug) 

See Also