<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Callum+Dawson</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Callum+Dawson"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Callum_Dawson"/>
	<updated>2026-04-10T13:15:22Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientDebugMessage&amp;diff=26901</id>
		<title>OnClientDebugMessage</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientDebugMessage&amp;diff=26901"/>
		<updated>2011-08-26T22:13:49Z</updated>

		<summary type="html">&lt;p&gt;Callum Dawson: Added an example.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when client-side debug messages (for instance errors or warnings) would appear in the debug window. This event doesn't require the debug window to be enabled to trigger, however.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string message, int level, string file, int line&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''message''': The message which was outputted in the server console, without details like file, line etc&lt;br /&gt;
*'''level''': The type of debug message which was outputted&lt;br /&gt;
**'''0:''' &amp;quot;Custom&amp;quot; message&lt;br /&gt;
**'''1:''' Error message&lt;br /&gt;
**'''2:''' Warning message&lt;br /&gt;
**'''3:''' Information message&lt;br /&gt;
*'''file''': The file from which the debug message was outputted&lt;br /&gt;
**'''Note:''' May return [[nil]] when the source could not be found&lt;br /&gt;
*'''line''': The line in file '''file''' where the debug message was outputted&lt;br /&gt;
**'''Note:''' May return [[nil]] when the source could not be found&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Examples== &lt;br /&gt;
This (easy) example outputs the debug message in the console, so you don't need to open debugscript 3 :D&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler (&amp;quot;onClientDebugMessage&amp;quot;,getRootElement(),&lt;br /&gt;
function(message,level,file,line)&lt;br /&gt;
  outputConsole (message,getLocalPlayer())&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example tells players that they missed a debug message, if they don't have debugscript enabled.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function newDebug() -- Since we don't need any of the parameters, we can optimize the code and exclude them&lt;br /&gt;
	if not isDebugViewActive() then -- If their debug view is not active&lt;br /&gt;
		outputChatBox(&amp;quot;* You just missed a debug message. Use the \'/debugscript\' command to view it.&amp;quot;,255,0,0) -- Output to them that they missed a debug message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientDebugMessage&amp;quot;,root,newDebug) -- When we get a new client debug message, call the newDebug function&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Other client events===&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Callum Dawson</name></author>
	</entry>
</feed>