<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/User:Gamesnert?action=history&amp;feed=atom</id>
	<title>User:Gamesnert - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/User:Gamesnert?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Gamesnert&amp;action=history"/>
	<updated>2026-10-02T22:29:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.1</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Gamesnert&amp;diff=23015&amp;oldid=prev</id>
		<title>Gamesnert: Created page with &#039;==Resources==  ===CStream=== ----  &quot;CStream&quot; (for the lack of a better name, suggestions are welcome) is a resource to load client-side scripts instead of storing it on the clien…&#039;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Gamesnert&amp;diff=23015&amp;oldid=prev"/>
		<updated>2010-04-24T11:56:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;==Resources==  ===CStream=== ----  &amp;quot;CStream&amp;quot; (for the lack of a better name, suggestions are welcome) is a resource to load client-side scripts instead of storing it on the clien…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Resources==&lt;br /&gt;
&lt;br /&gt;
===CStream===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;quot;CStream&amp;quot; (for the lack of a better name, suggestions are welcome) is a resource to load client-side scripts instead of storing it on the client&amp;#039;s harddisk. Because the scripts aren&amp;#039;t on the client&amp;#039;s harddisk, they can&amp;#039;t simply open their resources folder to see your scripts. This makes your scripts a lot harder to steal.&lt;br /&gt;
&lt;br /&gt;
This is not all, however. CStream also provides scripts with a &amp;quot;streamFile&amp;quot; function, which allows them to only send scripts to the client if they actually need it. For instance, if you have a custom admin resource at the moment with client-side scripts, the scripts are also sent to players who aren&amp;#039;t admins. This, of course, is not desirable.&lt;br /&gt;
&lt;br /&gt;
====Usage====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
* Place the CStream resource into your server resources folder&lt;br /&gt;
* Copy the &amp;quot;cstreaminject.lua&amp;quot; file from CStream into your resource&lt;br /&gt;
* Add the script file you just copied to the meta.xml file in your resource, by typing:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;script src=&amp;quot;cstreaminject.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, add all of the scripts you want to stream using the following syntax:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;cstream src=&amp;quot;script_file.lua&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Add CStream as an include in your resource, by adding:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;include resource=&amp;quot;cstream&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Start your resource&lt;br /&gt;
&lt;br /&gt;
====Streaming using &amp;quot;streamFile&amp;quot;====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As mentioned before, streamFile can be used to delay sending of script files. This requires a few steps:&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;cstream/&amp;gt; tag automatically sends the script to the client. To disable this, add &amp;#039;&amp;#039;&amp;#039;sos=&amp;quot;false&amp;quot;&amp;#039;&amp;#039;&amp;#039; to the &amp;lt;cstream/&amp;gt; tag.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; sos stands for &amp;quot;stream on start&amp;quot; in this case, not &amp;quot;save our souls&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;cstream src=&amp;quot;script_file.lua&amp;quot; sos=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a server-side script, you can then do:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;  exports.cstream:streamFile ( string filePath [, player target = getRootElement() ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;filePath:&amp;#039;&amp;#039;&amp;#039; Location of the file to be streamed. If you do not add the resource to the [[filepath]], it will automatically be added by CStream&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;target:&amp;#039;&amp;#039;&amp;#039; Player who should receive the file. If not specified, it will be sent to all players on the server.&lt;br /&gt;
&lt;br /&gt;
Function &amp;quot;onStart&amp;quot; is triggered for files streamed using streamFile.&lt;br /&gt;
&lt;br /&gt;
====Changelog====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;v 0.1&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** First released version&lt;br /&gt;
&lt;br /&gt;
====Known issues====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
* Line numbers and file names in errors or warnings might not be 100% correct. Because of the way CStream works, I kind of had to try and hack around it.&lt;br /&gt;
* onClientResourceStart will trigger twice. Once to indicate the resource started, and once for all streamed files to be started. Make sure your resources don&amp;#039;t break when onClientResourceStart is triggered twice.&lt;br /&gt;
* There&amp;#039;s no check if files are sent to the client already. This means that doing streamFile twice will also result in the same script running twice&lt;br /&gt;
* CStream needs admin rights, because it &amp;quot;modifies other resources&amp;quot;. (aka, loading files from other resources)&lt;br /&gt;
* CStream does not work on compiled scripts&lt;br /&gt;
&lt;br /&gt;
====Download====&lt;br /&gt;
----&lt;br /&gt;
[http://dl.dropbox.com/u/4504893/cstream/0.1/cstream.zip Download version 0.1]&lt;br /&gt;
&lt;br /&gt;
====Problems?====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Please report any problems on the [[User_talk:Gamesnert|discussion page]], or contact me through IRC. (Host: irc.gtanet.com; Name: Gamesnert; Channels: #mta, #mta.dutch, #mta.scripting)&lt;/div&gt;</summary>
		<author><name>Gamesnert</name></author>
	</entry>
</feed>