GetClientAccount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Deprecated|getPlayerAccount|}}
This function returns the specified client's [[account]] object.
This function returns the specified client's [[account]] object.


Line 14: Line 17:


==Example==
==Example==
This example sets a client's account's 'money' value
This example sets a player's money and also stores the value is his account.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "setmoney", "setMoney" )
function setMoney ( thePlayer, key, amount )
function setMoney ( thePlayer, key, ammount )
setPlayerMoney ( thePlayer, amount )
  account = getClientAccount ( thePlayer )
account = getClientAccount ( thePlayer )
  if ( account ) then
if ( account ) then
    setAccountData ( account, "money", ammount )
setAccountData ( account, "money", amount )
  end
end
end
end
addCommandHandler ( "setmoney", setMoney )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client functions}}
{{Client functions}}

Latest revision as of 16:20, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getPlayerAccount instead.


This function returns the specified client's account object.

Syntax

account getClientAccount ( client theClient )

Required Arguments

  • theClient: The client element (player or admin) you want to get the account of.

Returns

Returns the client's account object, or false if the client passed to the function is invalid.

Example

This example sets a player's money and also stores the value is his account.

function setMoney ( thePlayer, key, amount )
	setPlayerMoney ( thePlayer, amount )
	account = getClientAccount ( thePlayer )
	if ( account ) then
		setAccountData ( account, "money", amount )
	end
end
addCommandHandler ( "setmoney", setMoney )

See Also

BEFORE VERSION 1.0 :