Jullul7000 Posted January 22, 2014 Share Posted January 22, 2014 local staff = createTeam("Staff", 126, 0, 145) local staff = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) else if isObjectInACLGroup("user."..accName, aclGetGroup("Default")) then setPlayerTeam(source, Regular) end end Link to comment
Alexs Posted January 22, 2014 Share Posted January 22, 2014 (edited) local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) --fixed :I addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. setPlayerTeam(source, Regular) end end ACL Edited January 22, 2014 by Guest Link to comment
Bonsai Posted January 22, 2014 Share Posted January 22, 2014 Whats your question?! You overwrite the Staff team in line 2. Link to comment
Gallardo9944 Posted January 22, 2014 Share Posted January 22, 2014 Well, in this case, the 'elseif' statemenet might be remade to a usual 'else'. Link to comment
Saml1er Posted January 24, 2014 Share Posted January 24, 2014 local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. setPlayerTeam(source, Regular) end end This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here: local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) else -- If you want to know that if the player is in Moderator or any other group then you can use elseif. setPlayerTeam(source, Regular) end end Link to comment
xXMADEXx Posted January 24, 2014 Share Posted January 24, 2014 local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. setPlayerTeam(source, Regular) end end It's not a requirement, but doesn't mean it can't be there. This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here: local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) else -- If you want to know that if the player is in Moderator or any other group then you can use elseif. setPlayerTeam(source, Regular) end end Link to comment
Saml1er Posted January 24, 2014 Share Posted January 24, 2014 local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. setPlayerTeam(source, Regular) end end It's not a requirement, but doesn't mean it can't be there. This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here: local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) else -- If you want to know that if the player is in Moderator or any other group then you can use elseif. setPlayerTeam(source, Regular) end end I understand that but it will confuse people new to lua. I mean they'll think that else and elseif are same. I'm saying this because there was time when I couldn't understand how lua works for mta and such things got me more confused. Link to comment
Alexs Posted January 24, 2014 Share Posted January 24, 2014 This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here: local staff = createTeam("Staff", 126, 0, 145) local Regular = createTeam("Regular", 169,169,169) addEventHandler("onPlayerLogin", root, function(_, acc) local accName = getAccountName(acc) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, staff) else -- If you want to know that if the player is in Moderator or any other group then you can use elseif. setPlayerTeam(source, Regular) end end Uhm... yes, my error. 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