Revision Difference
Player:GetPData#518028
<function name="GetPData" parent="Player" type="classfunc">
<description>
Returns a **P**layer **Data** key-value pair from the SQL database. (sv.db when called on server, cl.db when called on client)
Internally uses the <page>sql</page>.
<warning>This function internally uses <page>Player:UniqueID</page>, which can cause collisions (two or more players sharing the same PData entry). It's recommended that you don't use it. See the related wiki page for more information.</warning>
<note>PData is not networked from servers to clients!</note>
</description>
<realm>Shared</realm>
<file line="159-L171">lua/includes/extensions/player.lua</file>
<args>
<arg name="key" type="string">Name of the PData key</arg>
<arg name="default" type="any" default="nil">Default value if PData key doesn't exist.</arg>
<arg name="default" type="any" default="nil">Default value if PData key doesn't exist.</arg>
</args>
<rets>
<ret name="" type="string">The data in the SQL database or the default value given.</ret>
</rets>
</function>
<example>
<description>Reads the key "money" from player 1's PData</description>
<code>player.GetByID( 1 ):GetPData( "money", 0 )</code>
</example>