ZH-CN/GetAccountsByData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP_ZH-CN|This function is a static function underneath the Account class.|Account.getAllByData||}}
{{OOP_ZH-CN|This function is a static function underneath the Account class.|Account.getAllByData||}}
===Required Arguments===  
===必填参数===  
*'''dataName:''' 数据的名称
*'''dataName:''' 数据的名称
*'''value:''' The value the dataName should have
*'''value:''' The value the dataName should have


===Returns===
===返回值===
Returns ''[[table]]'' containing the accounts associated with specified value at dataName. Returns ''false'' if invalid arguments were specified.
返回一个 ''[[table]]'' ,其中包括了账号在 dataName 所关联的值。返回 ''false'' 如果参数有误。


==示例==  
==示例==  
Line 30: Line 30:
==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}
[[zh-cn:GetAccountsByData]]
[[en:GetAccountsByData]]

Revision as of 06:56, 5 February 2021

此函数返回一个,其中包含具有指定dataName和value的所有帐户(使用setAccountData设置).

语法

table getAccountsByData ( string dataName, string value )

OOP 语法 什么是OOP?

提示: This function is a static function underneath the Account class.
方法: Account.getAllByData(...)

必填参数

  • dataName: 数据的名称
  • value: The value the dataName should have

返回值

返回一个 table ,其中包括了账号在 dataName 所关联的值。返回 false 如果参数有误。

示例

用一个无用的例子来说明它是如何工作的.

addCommandHandler("accountsbydata", function (player)
   local account = getPlayerAccount(player)
   setAccountData(account, "test", "hello")
   local accounts = getAccountsByData("test", "hello")
   outputChatBox(getAccountName(accounts[1]), player)                
end)

See Also