<?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=Ghost</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=Ghost"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Ghost"/>
	<updated>2026-06-09T07:16:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnResourcePreStart&amp;diff=24839</id>
		<title>OnResourcePreStart</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnResourcePreStart&amp;diff=24839"/>
		<updated>2010-12-28T08:52:45Z</updated>

		<summary type="html">&lt;p&gt;Ghost: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server event}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This event is triggered before a resource is loaded.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' If you attach this event to the root element it will called when ''any'' resource starts, not just the resource your script is running inside. As such, most of the time you will want to check that the resource passed to this event matches your resource (compare with the value returned by [[getThisResource]]) before doing anything. Alternatively you can attach the event to [[getResourceRootElement]]([[getThisResource]]()).&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
resource startingResource&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''startingResource''': The resource that is starting&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the root [[element]] in the resource that is starting.&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This code will output the name of any resource that is starting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function displayStartingRes ( res )&lt;br /&gt;
	outputChatBox ( &amp;quot;Resource &amp;quot; .. getResourceName(res) .. &amp;quot; is starting&amp;quot;, getRootElement(), 255, 255, 255 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourcePreStart&amp;quot;, getRootElement(), displayStartingRes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Resource events}}&lt;/div&gt;</summary>
		<author><name>Ghost</name></author>
	</entry>
</feed>