ZH-CN/GetAccountsByIP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} {{New feature/item|3.0160|1.5.5|11747| This function returns a table containing all accounts that were logged onto from specified IP-address...")
 
m (Обновление информации)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
{{New feature/item|3.0160|1.5.5|11747|
{{New feature/item|3.156|1.5.5|11747|
This function returns a [[table]] containing all accounts that were logged onto from specified IP-address.
此函数返回一个[[]],其中包含从指定IP地址登录的所有帐户(查询所有用过这个IP登录的账户)
}}
}}


==Syntax==  
==语法==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table getAccountsByIP ( string ip )
table getAccountsByIP ( string ip )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP|This function is a static function underneath the Account class.|Account.getAllByIP||}}
{{OOP_ZH-CN|This function is a static function underneath the Account class.|Account.getAllByIP||}}
===Required Arguments===  
===必填参数===  
*'''ip:''' The IP to get accounts from
*'''ip:''' 要从中获取帐户的IP


===Returns===
===返回值===
Returns ''[[table]]'' containing the accounts associated with specified IP-address. Returns ''false'' if invalid arguments were specified.
返回 “[[表]]”([[table]]),其中包含与指定IP地址关联的帐户。如果指定了无效参数,则返回“false”。


==Example==  
==示例==  
This example adds command ''getAccounts'' that outputs the number of accounts a player has in the chat box.
此示例添加命令“getAccounts”,该命令输出玩家在聊天框中拥有的帐户数
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("getAccounts",  
addCommandHandler("getAccounts",  
Line 23: Line 23:
local ip = getPlayerIP(player)
local ip = getPlayerIP(player)
local accounts = getAccountsByIP(ip)
local accounts = getAccountsByIP(ip)
outputChatBox("You have " .. #accounts .. " accounts.", player)
outputChatBox("你有 " .. #accounts .. " 个账号.", player)
end)
end)
</syntaxhighlight>
</syntaxhighlight>
Line 29: Line 29:
==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}
[[en:GetAccountsByIP]]
[[ru:getAccountsByIP]]
[[zh-cn:GetAccountsByIP]]
[[zh-cn:GetAccountsByIP]]

Latest revision as of 17:11, 12 April 2021

ADDED/UPDATED IN VERSION 1.5.5 r11747:

此函数返回一个,其中包含从指定IP地址登录的所有帐户(查询所有用过这个IP登录的账户)

语法

table getAccountsByIP ( string ip )

OOP 语法 什么是OOP?

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

必填参数

  • ip: 要从中获取帐户的IP

返回值

返回 “”(table),其中包含与指定IP地址关联的帐户。如果指定了无效参数,则返回“false”。

示例

此示例添加命令“getAccounts”,该命令输出玩家在聊天框中拥有的帐户数

addCommandHandler("getAccounts", 
	function (player, cmd)
		local ip = getPlayerIP(player)
		local accounts = getAccountsByIP(ip)
		outputChatBox("你有 " .. #accounts .. " 个账号.", player)
	end)

See Also