GetClientAccount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (addCommandHandler placed after function declaration. Second argument changed from string to function pointer.)
Line 16: Line 16:
This example sets a client's account's 'money' value
This example sets a client's account's 'money' value
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "setmoney", "setMoney" )
function setMoney ( thePlayer, key, amount )
function setMoney ( thePlayer, key, ammount )
account = getClientAccount ( thePlayer )
  account = getClientAccount ( thePlayer )
if ( account ) then
  if ( account ) then
setAccountData ( account, "money", amount )
    setAccountData ( account, "money", ammount )
end
  end
end
end
addCommandHandler ( "setmoney", setMoney )
</syntaxhighlight>
</syntaxhighlight>


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

Revision as of 14:17, 15 August 2007

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 client's account's 'money' value

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

See Also

BEFORE VERSION 1.0 :