IsPlayerInACL: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "== Code == <syntaxhighlight lang="lua"> function isPlayerInACL(player,acl) local account = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..account,aclGetGroup(acl))) t...")
 
Line 1: Line 1:
This code will return true, if the given player is in the given ACL group. If the given player isn't in the given ACL group, it will return false.
== Code ==
== Code ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Revision as of 04:07, 15 April 2013

This code will return true, if the given player is in the given ACL group. If the given player isn't in the given ACL group, it will return false.

Code

function isPlayerInACL(player,acl)
	local account = getAccountName(getPlayerAccount(player))
	if(isObjectInACLGroup("user."..account,aclGetGroup(acl))) then
		return true
	else
		return false
	end
end

Usage:

function playerLogin()
	if (isPlayerInACL(source,"Admin")==true) then
		outputChatBox(getPlayerName(source).." has logged in!", root, 0, 255, 0)
	end
end
addEventHandler("onPlayerLogin",root,playerLogin)

Code by xXMADEXx