Dimmitry007 Posted March 12, 2015 Share Posted March 12, 2015 hello i made a script that when player join and if he's admin he must be in Admins team But it's not working here's my code function team( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then setPlayerTeam ( player, Admins ) end end Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 Is there a code that logs the player in as soon as he joined (auto login)? If not, then it's impossible that he will be logged in immediately on join. Perhaps you need to change onPlayerJoin to onPlayerLogin. Link to comment
Dimmitry007 Posted March 12, 2015 Author Share Posted March 12, 2015 hmmm okay i'll try Link to comment
Dimmitry007 Posted March 12, 2015 Author Share Posted March 12, 2015 okay i made another one i maked it with command but it's not working function Team( thePlayer ) setPlayerTeam ( thePlayer, Admins ) end addCommandHandler ( "oduty", Team ) Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 The obvious error is that Admins is not defined. Aside from that, you're missing the admin check code. function Team( thePlayer ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then setPlayerTeam ( thePlayer, Admins ) end end addCommandHandler ( "oduty", Team ) Link to comment
Dimmitry007 Posted March 12, 2015 Author Share Posted March 12, 2015 it's not working Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 I already told you, is Admins defined? Link to comment
Dimmitry007 Posted March 12, 2015 Author Share Posted March 12, 2015 no , how to defined it? Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 If the team's name is "Admins" then: function Team( thePlayer ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then setPlayerTeam ( thePlayer, getTeamFromName("Admins")) end end addCommandHandler ( "oduty", Team ) Link to comment
Dimmitry007 Posted March 12, 2015 Author Share Posted March 12, 2015 i've created team called Admins And when i set my self Admin it works ofc it works :3 but when i reconnect i find my self not in the admins team i typed /oduty still nothing Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 Do you login after reconnecting? Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 You're using 'player' instead of 'thePlayer'. function Team( thePlayer ) local acc = getPlayerAccount(thePlayer) if (isGuestAccount(acc)) then outputChatBox("You're not logged in", thePlayer) return end local accName = getAccountName(acc) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then local team = getTeamFromName("Admins") if (not team) then outputChatBox("The team doesn't exist", thePlayer) return end setPlayerTeam ( thePlayer, team) else outputChatBox("You're not an admin", thePlayer) end end addCommandHandler ( "oduty", Team ) Link to comment
Dimmitry007 Posted March 12, 2015 Author Share Posted March 12, 2015 YUP! it worked 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