..:D&G:.. Posted January 25, 2015 Share Posted January 25, 2015 Hello guys, I wanted to make a script that sets admins into the "Staff" team when they login, here is the code: addEventHandler("onPlayerLogin", resourceRoot, function ( ) local Admins = getOnlineAdmins() if #Admins ~= 0 then for k,v in ipairs ( Admins ) do setPlayerTeam ( getPlayerName(v), "Staff") end end end ) function getOnlineAdmins() local t = {} for k,v in ipairs ( getElementsByType("player") ) do while true do local acc = getPlayerAccount(v) if not acc or isGuestAccount(acc) then break end local accName = getAccountName(acc) local isAdmin = isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) if isAdmin == true then table.insert(t,v) end break end end return t end There are no errors and it doesn't set the player in the team, anyone know what's wrong? Link to comment
.:HyPeX:. Posted January 25, 2015 Share Posted January 25, 2015 your code has absolutly no sense at all. addEventHandler("onPlayerLogin",root, function ( ) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin")) then setPlayerTeam(source, getTeamFromName("Staff")) end end ) Link to comment
..:D&G:.. Posted January 25, 2015 Author Share Posted January 25, 2015 Lol, I tried that before but it didn't work, and it was because I didn't use getTeamFromName Silly me. Thanks. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now