GetAccountsByIP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{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.
This function returns a [[table]] containing all accounts that were logged onto from specified IP-address.
}}


==Syntax==  
==Syntax==  
Line 12: Line 14:


===Returns===
===Returns===
Returns ''[[table]]'' containing the accounts associated with specified ip. Returns ''false'' if invalid arguments were specified.
Returns ''[[table]]'' containing the accounts associated with specified IP-address. Returns ''false'' if invalid arguments were specified.


==Example==  
==Example==  
Line 27: Line 29:
==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}
[[zh-cn:GetAccountsByIP]]

Revision as of 05:17, 4 February 2021

This function returns a table containing all accounts that were logged onto from specified IP-address.

Syntax

table getAccountsByIP ( string ip )

OOP Syntax Help! I don't understand this!

Note: This function is a static function underneath the Account class.
Method: Account.getAllByIP(...)


Required Arguments

  • ip: The IP to get accounts from

Returns

Returns table containing the accounts associated with specified IP-address. Returns false if invalid arguments were specified.

Example

This example adds command getAccounts that outputs the number of accounts a player has in the chat box.

addCommandHandler("getAccounts", 
	function (player, cmd)
		local ip = getPlayerIP(player)
		local accounts = getAccountsByIP(ip)
		outputChatBox("You have " .. #accounts .. " accounts.", player)
	end)

See Also