Blackvein Posted July 26, 2010 Share Posted July 26, 2010 Hey guys, I have this team script, but there's a problem with it I can't seem to find. Players that belong in the 'Police' ACL group aren't automatically put into the 'Police' team when they login. Can anyone help? local root = getRootElement() addEventHandler("onResourceStart", root, function() team = createTeam ("Police", 0, 0, 255) end ) function login() local taccount = getPlayerAccount ( source ) if isZarAccount(taccount) then setPlayerTeam ( source, team) outputChatBox ("Welcome to Zombie Apocalypse Rescue Squad HQ", source) spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 90, 281, team ) giveWeapon (source, 3, 1) giveWeapon (source, 24, 500) giveWeapon (source, 29, 500) giveWeapon (source, 31, 500) giveWeapon (source, 17, 50) fadeCamera (source, true) setCameraTarget (source, true) else end end addEventHandler("onPlayerLogin", root,login) function isZarAccount(account) local nick = "" local group = aclGetGroup("Police") if (account and group) then nick = string.lower(getAccountName(account) or "") for _, object in ipairs(aclGroupListObjects(group) or {}) do if (gettok(object, 1, string.byte('.')) == "user") then if (nick == string.lower(gettok(object, 2, string.byte('.')))) then return true end end end end return false end function spawn(source) spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 90, 281, team ) giveWeapon (source, 3, 1) giveWeapon (source, 24, 500) giveWeapon (source, 29, 500) giveWeapon (source, 31, 500) giveWeapon (source, 17, 500) fadeCamera (source, true) setCameraTarget (source, true) end addEventHandler("onPlayerWasted", root, function() local taccount = getPlayerAccount ( source ) if isZarAccount(taccount) then setTimer(spawn, 2000, 1, source) end end ) Link to comment
50p Posted July 26, 2010 Share Posted July 26, 2010 Why don't you use isObjectInACLGroup? You don't have to make a new function to find out if player is in the ACL group. 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