OutputServerLog: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
{{Server function}}
__NOTOC__
This outputs a line of text to the server's log. This could be useful for debugging.
This outputs a line of text to the server's log. This could be useful for debugging.


Line 16: Line 17:
This example outputs client logins to the server log.
This example outputs client logins to the server log.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onClientLogin", getRootElement(), "logClientLogin" )
function logClientLogin ( previous_account, current_account )
function logClientLogin ( previous_account, current_account )
outputServerLog ( "Client "..getClientName ( source ).." logged in as "..getAccountName ( current_account ) )
outputServerLog ( "Client " .. getClientName ( source ) .. " logged in as " .. getAccountName ( current_account ) )
end
end
addEventHandler ( "onClientLogin", getRootElement(), logClientLogin )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Server functions}}
{{Server functions}}

Revision as of 18:33, 16 August 2007

This outputs a line of text to the server's log. This could be useful for debugging.

Syntax

bool outputServerLog ( string text )              

Required Arguments

  • text: The text to be output to the log.

Returns

Returns true if successful, false otherwise.

Example

This example outputs client logins to the server log.

function logClientLogin ( previous_account, current_account )
	outputServerLog ( "Client " .. getClientName ( source ) .. " logged in as " .. getAccountName ( current_account ) )
end
addEventHandler ( "onClientLogin", getRootElement(), logClientLogin )

See Also