<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/PT-BR/getElementData?action=history&amp;feed=atom</id>
	<title>PT-BR/getElementData - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/PT-BR/getElementData?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PT-BR/getElementData&amp;action=history"/>
	<updated>2026-05-04T02:34:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PT-BR/getElementData&amp;diff=73937&amp;oldid=prev</id>
		<title>Vampire: Translation of the page 'getElementData' to Portuguese BR</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PT-BR/getElementData&amp;diff=73937&amp;oldid=prev"/>
		<updated>2022-01-31T18:31:32Z</updated>

		<summary type="html">&lt;p&gt;Translation of the page &amp;#039;getElementData&amp;#039; to Portuguese BR&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{BR/Funcao compartilhada}}&lt;br /&gt;
Esta função recupera dados de elemento anexados a um elemento em uma determinada chave.&lt;br /&gt;
&lt;br /&gt;
==Sintaxe==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;var getElementData ( element theElement, string key [, bool inherit = true] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{PT-BR/POO||[[element]]:getData||setElementData}}&lt;br /&gt;
&lt;br /&gt;
===Argumentos Obrigatórios===&lt;br /&gt;
*'''theElement:''' Este é o elemento com dados que você deseja recuperar. &lt;br /&gt;
*'''key:''' O nome da entrada de dados do elemento que você deseja recuperar. (Máximo de 31 caracteres.)&lt;br /&gt;
&lt;br /&gt;
===Argumentos Opcionai===&lt;br /&gt;
*'''inherit:''' - alterna se a função deve ou não subir na hierarquia para encontrar a chave solicitada caso o elemento especificado não a tenha.&lt;br /&gt;
&lt;br /&gt;
===Retorna===&lt;br /&gt;
Esta função retorna uma ''variável'' contendo os dados do elemento solicitado, ou ''false'' se o elemento ou os dados do elemento não existirem. Ao obter dados correspondentes a um atributo XML, isso é sempre uma ''string''.&lt;br /&gt;
&lt;br /&gt;
==Exemplo==&lt;br /&gt;
Este exemplo armazena a contagem de ticks quando um jogador entra e permite que os jogadores vejam quanto tempo eles estão conectados usando uma função 'joinTime' do console. &lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinTime ( )&lt;br /&gt;
    setElementData ( source, &amp;quot;joinTime&amp;quot;, getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime'&lt;br /&gt;
end&lt;br /&gt;
-- Make our 'joinTime' function be called when a player joins&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, joinTime )&lt;br /&gt;
&lt;br /&gt;
function showJoinTime ( source, commandName, playerName )&lt;br /&gt;
	if ( playerName ) then -- see if a player was specified&lt;br /&gt;
		thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player&lt;br /&gt;
		if ( thePlayer ) then -- if one was found...&lt;br /&gt;
			local timeOnline = (getTickCount() - getElementData ( thePlayer, &amp;quot;joinTime&amp;quot; )) / 1000 -- calculates the time since join&lt;br /&gt;
			outputChatBox ( getPlayerName ( thePlayer )..&amp;quot; joined &amp;quot;..timeOnline..&amp;quot; seconds ago&amp;quot;, source ) -- output the player's join time&lt;br /&gt;
		else&lt;br /&gt;
			outputChatBox ( &amp;quot;Couldn't find '&amp;quot; .. playerName .. &amp;quot;'&amp;quot;, source ) -- display an error&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- display when the player who used the function joined and inform how to see other people's join time&lt;br /&gt;
		local timeOnline = (getTickCount() - getElementData ( source, &amp;quot;joinTime&amp;quot; )) / 1000 -- calculate the time since join&lt;br /&gt;
		outputChatBox ( &amp;quot;You joined &amp;quot; ..timeOnline..&amp;quot; seconds ago&amp;quot;, source )&lt;br /&gt;
		outputChatBox ( &amp;quot;Use 'join_time &amp;lt;player name&amp;gt;' to see other people's join time&amp;quot;, source )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Add a console command joinTime, that takes an optional parameter of a player's name&lt;br /&gt;
addCommandHandler ( &amp;quot;joinTime&amp;quot;, showJoinTime )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:getElementData]]&lt;/div&gt;</summary>
		<author><name>Vampire</name></author>
	</entry>
</feed>