function CheckPlayer( Player )
local Group = aclGetGroup( "VIP" )
if ( Group ) then
local PlayerAccount = getPlayerAccount( Player )
if ( not isGuestAccount( PlayerAccount ) ) then
local Object, Boolean = "user."..getAccountName( PlayerAccount ), getElementData( Player, "PoliceKing" )
local Exists = isObjectInACLGroup( Object, Group )
if ( Boolean and not Exists or not Boolean and Exists ) then
( Boolean and aclGroupAddObject or aclGroupRemoveObject )( Group, Object )
end
end
end
end
for _, Player in ipairs( getElementsByType( "player" ) ) do CheckPlayer( Player ) end
addEventHandler( "onElementDataChange", root,
function( DataName )
if ( DataName == "PoliceKing" and getElementType( source ) == "player" ) then
CheckPlayer( source )
end
end )
setTimer(function(plrName)
if getElementData(plrName, "PoliceKing") ~= true then aclGroupRemoveObject(aclGetGroup("VIP"),"user."..getAccountName((getPlayerAccount(plrName))) ) end
end,10*500,0)