<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.rage.mp/w/index.php?action=history&amp;feed=atom&amp;title=Getting_Started_with_Entity_variables</id>
	<title>Getting Started with Entity variables - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.rage.mp/w/index.php?action=history&amp;feed=atom&amp;title=Getting_Started_with_Entity_variables"/>
	<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;action=history"/>
	<updated>2026-06-04T08:33:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=20132&amp;oldid=prev</id>
		<title>SugarD-x: Fixed a typographical error.</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=20132&amp;oldid=prev"/>
		<updated>2020-11-19T22:25:37Z</updated>

		<summary type="html">&lt;p&gt;Fixed a typographical error.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:25, 19 November 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== What is entity variables? ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== What is entity variables? ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Entity variables are custom assigned data to a certain entity to identify it either locally or globally to all other clients on the server. You have the flexibility to choose &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;weather &lt;/del&gt;to keep it private or public.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Entity variables are custom assigned data to a certain entity to identify it either locally or globally to all other clients on the server. You have the flexibility to choose &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;whether &lt;/ins&gt;to keep it private or public.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Synced entity variables ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Synced entity variables ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key rmp_wiki:diff::1.12:old-20011:rev-20132 --&gt;
&lt;/table&gt;</summary>
		<author><name>SugarD-x</name></author>
	</entry>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=20011&amp;oldid=prev</id>
		<title>Almeidowski: Grammar</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=20011&amp;oldid=prev"/>
		<updated>2020-09-08T21:27:43Z</updated>

		<summary type="html">&lt;p&gt;Grammar&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:27, 8 September 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Synced entity variables ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Synced entity variables ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Synced entity variables are custom data that are assigned to the entity globally so other clients can read these data&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, but don&#039;t worry synced &lt;/del&gt;entity variables are only writable server-side &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;so &lt;/del&gt;no one can overwrite data from client-side.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Synced entity variables are custom data that are assigned to the entity globally so other clients can read these data&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Synced &lt;/ins&gt;entity variables are only writable server-side&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, which means &lt;/ins&gt;no one can overwrite data from client-side.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&#039;s say you need to keep your scoreboard updated every 3 seconds&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;and it displays every player&#039;s cash, ping, job, and etc. To keep things up to date you&#039;ll definitely need to use synced entity variables to display updated values since for example a player made an transaction then &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is &lt;/del&gt;cash is updated server-side, then the scoreboard should automatically update it in the next refresh call by getting each player&#039;s synced variable. There are many applications for entity synced variables and you can explore [https://rage.mp/files/category/3-scripts/ resources] to get to know more about it.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&#039;s say you need to keep your scoreboard updated every 3 seconds and it displays every player&#039;s cash, ping, job, and etc. To keep things up to date you&#039;ll definitely need to use synced entity variables to display updated values since for example a player made an transaction then &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;his &lt;/ins&gt;cash is updated server-side, then the scoreboard should automatically update it in the next refresh call by getting each player&#039;s synced variable. There are many applications for entity synced variables and you can explore [https://rage.mp/files/category/3-scripts/ resources] to get to know more about it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key rmp_wiki:diff::1.12:old-18872:rev-20011 --&gt;
&lt;/table&gt;</summary>
		<author><name>Almeidowski</name></author>
	</entry>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=18872&amp;oldid=prev</id>
		<title>Unknown at 10:54, 6 December 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=18872&amp;oldid=prev"/>
		<updated>2019-12-06T10:54:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:54, 6 December 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l99&quot;&gt;Line 99:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Final notes ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Final notes ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Entity variables are destroyed once the entity is no longer available in the world. Like player reconnecting or quit or vehicle delete.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Entity variables are destroyed once the entity is no longer available in the world. Like player reconnecting or quit or vehicle delete.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== See also ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{ScriptingTutorials}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Tutorials]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Tutorials]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key rmp_wiki:diff::1.12:old-18865:rev-18872 --&gt;
&lt;/table&gt;</summary>
		<author><name>Unknown</name></author>
	</entry>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=18865&amp;oldid=prev</id>
		<title>Unknown at 10:14, 6 December 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=18865&amp;oldid=prev"/>
		<updated>2019-12-06T10:14:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:14, 6 December 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l99&quot;&gt;Line 99:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Final notes ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Final notes ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Entity variables are destroyed once the entity is no longer available in the world. Like player reconnecting or quit or vehicle delete.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Entity variables are destroyed once the entity is no longer available in the world. Like player reconnecting or quit or vehicle delete.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Tutorials]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key rmp_wiki:diff::1.12:old-18864:rev-18865 --&gt;
&lt;/table&gt;</summary>
		<author><name>Unknown</name></author>
	</entry>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=18864&amp;oldid=prev</id>
		<title>Unknown: Created page with &quot;== Getting Started ==  In this page you&#039;ll learn about how to use &#039;&#039;&#039;Entity&#039;&#039;&#039; variables. This is a list of functions that are related to the entity variables:  *&#039;&#039;&#039;Functions&#039;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Getting_Started_with_Entity_variables&amp;diff=18864&amp;oldid=prev"/>
		<updated>2019-12-06T09:52:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Getting Started ==  In this page you&amp;#039;ll learn about how to use &amp;#039;&amp;#039;&amp;#039;Entity&amp;#039;&amp;#039;&amp;#039; variables. This is a list of functions that are related to the entity variables:  *&amp;#039;&amp;#039;&amp;#039;Functions&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
In this page you&amp;#039;ll learn about how to use &amp;#039;&amp;#039;&amp;#039;Entity&amp;#039;&amp;#039;&amp;#039; variables. This is a list of functions that are related to the entity variables:&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Functions&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
**[[Entity::getVariable|getVariable]]&lt;br /&gt;
**[[Entity::setVariable|setVariable]]&lt;br /&gt;
**[[Events::addDataHandler|addDataHandler]]&lt;br /&gt;
&lt;br /&gt;
== What is entity variables? ==&lt;br /&gt;
&lt;br /&gt;
Entity variables are custom assigned data to a certain entity to identify it either locally or globally to all other clients on the server. You have the flexibility to choose weather to keep it private or public.&lt;br /&gt;
&lt;br /&gt;
== Synced entity variables ==&lt;br /&gt;
Synced entity variables are custom data that are assigned to the entity globally so other clients can read these data, but don&amp;#039;t worry synced entity variables are only writable server-side so no one can overwrite data from client-side. &lt;br /&gt;
Let&amp;#039;s say you need to keep your scoreboard updated every 3 seconds, and it displays every player&amp;#039;s cash, ping, job, and etc. To keep things up to date you&amp;#039;ll definitely need to use synced entity variables to display updated values since for example a player made an transaction then is cash is updated server-side, then the scoreboard should automatically update it in the next refresh call by getting each player&amp;#039;s synced variable. There are many applications for entity synced variables and you can explore [https://rage.mp/files/category/3-scripts/ resources] to get to know more about it.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
We&amp;#039;ll do a short example about money HUD and how it works with entity synced variables.&lt;br /&gt;
&lt;br /&gt;
Firstly we&amp;#039;ll setup our server-side simple money API&lt;br /&gt;
&lt;br /&gt;
In server-side we did a small manager that accepts withdrawal/deposit money and updates the synced entity variable of the player that requested the operation.&lt;br /&gt;
{{ServersideCode|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mp.events.add({&lt;br /&gt;
    &amp;#039;playerReady&amp;#039;: (player) =&amp;gt; {&lt;br /&gt;
        if (player) {&lt;br /&gt;
            /*&lt;br /&gt;
             * Setting our start cash value by 0&lt;br /&gt;
             * You can sync it via Database if you got one.&lt;br /&gt;
             * player.data.cash = 0 can work too &lt;br /&gt;
             */&lt;br /&gt;
            player.setVariable(&amp;#039;cash&amp;#039;, 0);&lt;br /&gt;
            // player.data.cash = 0&lt;br /&gt;
        }&lt;br /&gt;
    },&lt;br /&gt;
    &amp;#039;withdraw&amp;#039;: (player, amount) =&amp;gt; {&lt;br /&gt;
        let currentMoney = player.getVariable(&amp;#039;cash&amp;#039;); // Getting base cash from entity.&lt;br /&gt;
        if (currentMoney &amp;amp;&amp;amp; currentMoney &amp;gt;= 0 &amp;amp;&amp;amp; amount &amp;gt; 0) {&lt;br /&gt;
            currentMoney += amount;&lt;br /&gt;
            player.setVariable(&amp;#039;cash&amp;#039;, currentMoney); // Setting base cash of entity to new value.&lt;br /&gt;
        }&lt;br /&gt;
    },&lt;br /&gt;
    &amp;#039;deposit&amp;#039;: (player, amount) =&amp;gt; {&lt;br /&gt;
        let currentMoney = player.getVariable(&amp;#039;cash&amp;#039;); // Getting base cash from entity.&lt;br /&gt;
        if (currentMoney &amp;amp;&amp;amp; currentMoney &amp;gt;= 0 &amp;amp;&amp;amp; currentMoney &amp;gt;= amount) {&lt;br /&gt;
            currentMoney -= amount;&lt;br /&gt;
            player.setVariable(&amp;#039;cash&amp;#039;, currentMoney); // Setting base cash of entity to new value.&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Now on client-side we should do a small money HUD that&amp;#039;ll display the cash and update once an operation has been made.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE&amp;#039;&amp;#039;&amp;#039;: [[Events::addDataHandler|addDataHandler]] triggers on all clients when one entity updates its synced variable, so make sure to specify your scope if its per player operation.&lt;br /&gt;
{{ClientsideCode|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const localPlayer = mp.players.local;&lt;br /&gt;
let currentMoney;&lt;br /&gt;
&lt;br /&gt;
mp.events.add(&amp;#039;render&amp;#039;, () =&amp;gt; {&lt;br /&gt;
    if (currentMoney) { // Draws money HUD only if currentMoney is initalized&lt;br /&gt;
        mp.game.graphics.drawText(&amp;#039;$&amp;#039; + currentMoney, [0.85, 0.1], { &lt;br /&gt;
            font: 7, &lt;br /&gt;
            color: [133, 187, 101, 185], &lt;br /&gt;
            scale: [0.8, 0.8], &lt;br /&gt;
            outline: true&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
mp.events.addDataHandler(&amp;#039;cash&amp;#039;, (entity, newCash, oldCash) =&amp;gt; {&lt;br /&gt;
    if (entity &amp;amp;&amp;amp; entity.remoteId === localPlayer.remoteId &amp;amp;&amp;amp; newCash !== oldCash) { // Make sure the money update is for the money operation requester since addDataHandler triggers on any entity synced variable change&lt;br /&gt;
        currentMoney = newCash;&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Local Entity variables ==&lt;br /&gt;
You can also set variables to entities for local scope like on server-side or client-side only to help protect sensitive data from public if needed.&lt;br /&gt;
{{ServersideCode|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mp.events.add(&amp;#039;playerReady&amp;#039;, (player) =&amp;gt; {&lt;br /&gt;
  player.whatever = &amp;#039;something&amp;#039;; // that initializes an object property to player that can be used serverside only&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{ClientsideCode|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  mp.gui.chat.push(&amp;#039;Scope Test: &amp;#039; mp.players.local.whatever); // Displays: &amp;quot;Scope Test: undefined&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Final notes ==&lt;br /&gt;
Entity variables are destroyed once the entity is no longer available in the world. Like player reconnecting or quit or vehicle delete.&lt;/div&gt;</summary>
		<author><name>Unknown</name></author>
	</entry>
</feed>