<?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=Sky</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=Sky"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Sky"/>
	<updated>2026-04-10T10:21:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TriggerLatentServerEvent&amp;diff=77589</id>
		<title>TriggerLatentServerEvent</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TriggerLatentServerEvent&amp;diff=77589"/>
		<updated>2023-09-03T22:27:30Z</updated>

		<summary type="html">&lt;p&gt;Sky: This issue has been fixed and deployed in 1.6.0 release&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function is the same as [[triggerServerEvent]] except the transmission rate of the data contained in the arguments can be limited and other network traffic is not blocked while the data is being transferred.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool triggerLatentServerEvent ( string event, [int bandwidth=5000, bool persist=false,] element theElement, [arguments...] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''event:''' The name of the event to trigger server-side. You should register this event with [[addEvent]] and add at least one event handler using [[addEventHandler]].&lt;br /&gt;
*'''theElement:''' The element that is the [[Event system#Event handlers|source]] of the event. This could be another player, or if this isn't relevant, use the root element.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''bandwidth:''' The bytes per second rate to send the data contained in the arguments.&lt;br /&gt;
*'''persist:''' A bool indicating whether the transmission should be allowed to continue even after the resource that triggered it has since stopped.&lt;br /&gt;
*'''arguments...:''' A list of arguments to trigger with the event. You can pass any Lua data type (except functions). You can also pass [[element]]s. The total amount of data should not exceed 100MB. &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event trigger has been sent, ''false'' if invalid arguments were specified.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
if fileExists(&amp;quot;text.txt&amp;quot;)&lt;br /&gt;
	file = fileOpen(&amp;quot;test.txt&amp;quot;)						--Open a file (you can create it yourself).&lt;br /&gt;
	local data = fileRead(file,100*1024*1024)				--Max 100 MB&lt;br /&gt;
	fileClose(file)								--Close File&lt;br /&gt;
	triggerLatentServerEvent(&amp;quot;onReadFile&amp;quot;,5000,false,root,data)	--trigger&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;onReadFile&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;onReadFile&amp;quot;,root,function(data)&lt;br /&gt;
	local file = fileCreate(&amp;quot;text.txt&amp;quot;)					--Save &amp;quot;data&amp;quot; into &amp;quot;text.txt&amp;quot;&lt;br /&gt;
	fileWrite(file,data)&lt;br /&gt;
	fileClose(file)&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.03772|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Sky</name></author>
	</entry>
</feed>