Speed666 Posted September 16, 2011 Share Posted September 16, 2011 Well, I made aresource with this script. And it works ok when I only add just one team. but when I add the 5 teams I need, it creates the teams, but dont adds players into them. What is wrong? Please help teamModerators = createTeam ( "Moderators", 0, 255, 0 ) function addtoteam1(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PModerators" ) ) then setPlayerTeam ( player,teamModerators ) end end function addtoteamtimer1() setTimer(addtoteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer1) teamSubAdmins = createTeam ( "Sub Admins", 0, 255, 0 ) function addtoteam2(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PSubAdmins" ) ) then setPlayerTeam ( player,teamSubAdmins ) end end function addtoteamtimer2() setTimer(addtoteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer2) teamAdmins = createTeam ( "Admins", 0, 255, 0 ) function addtoteam3(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PAdmins" ) ) then setPlayerTeam ( player,teamAdmins ) end end function addtoteamtimer3() setTimer(addtoteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer3) teamOwners = createTeam ( "Owners", 0, 255, 0 ) function addtoteam4(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "POwners" ) ) then setPlayerTeam ( player,teamOwners ) end end function addtoteamtimer4() setTimer(addtoteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer4) teamDevelopers = createTeam ( "Developers", 0, 255, 0 ) function addtoteam5(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PDevelopers" ) ) then setPlayerTeam ( player,teamDevelopers ) end end function addtoteamtimer5() setTimer(addtoteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer5) Link to comment
GTX Posted September 16, 2011 Share Posted September 16, 2011 You posted in wrong section. Next time you have to post in Scripting section, so moderator should move this topic Anyways, try this: teamModerators = createTeam ( "Moderators", 0, 255, 0 ) function addtoteam1(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PModerators" ) ) then setPlayerTeam ( player,teamModerators ) end end function addtoteamtimer1() setTimer(addtoteam1,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer1) teamSubAdmins = createTeam ( "Sub Admins", 0, 255, 0 ) function addtoteam2(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PSubAdmins" ) ) then setPlayerTeam ( player,teamSubAdmins ) end end function addtoteamtimer2() setTimer(addtoteam2,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer2) teamAdmins = createTeam ( "Admins", 0, 255, 0 ) function addtoteam3(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PAdmins" ) ) then setPlayerTeam ( player,teamAdmins ) end end function addtoteamtimer3() setTimer(addtoteam3,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer3) teamOwners = createTeam ( "Owners", 0, 255, 0 ) function addtoteam4(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "POwners" ) ) then setPlayerTeam ( player,teamOwners ) end end function addtoteamtimer4() setTimer(addtoteam4,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer4) teamDevelopers = createTeam ( "Developers", 0, 255, 0 ) function addtoteam5(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PDevelopers" ) ) then setPlayerTeam ( player,teamDevelopers ) end end function addtoteamtimer5() setTimer(addtoteam5,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer5) Link to comment
Speed666 Posted September 16, 2011 Author Share Posted September 16, 2011 You posted in wrong section. Next time you have to post in Scripting section, so moderator should move this topicAnyways, try this: Yup, sorry. please move it. BTW now it only adds players in Owners group. others not Edit: the real problem is that only ads one player. for example: when there are one developer and one owner, it only ads the first one who joined the server. Link to comment
Castillo Posted September 16, 2011 Share Posted September 16, 2011 teamModerators = createTeam ( "Moderators", 0, 255, 0 ) teamSubAdmins = createTeam ( "Sub Admins", 0, 255, 0 ) teamAdmins = createTeam ( "Admins", 0, 255, 0 ) teamOwners = createTeam ( "Owners", 0, 255, 0 ) teamDevelopers = createTeam ( "Developers", 0, 255, 0 ) function addToTeam(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PDevelopers" ) ) then setPlayerTeam ( player, teamDevelopers ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "POwners" ) ) then setPlayerTeam ( player,teamOwners ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PAdmins" ) ) then setPlayerTeam ( player,teamAdmins ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PSubAdmins" ) ) then setPlayerTeam ( player,teamSubAdmins ) elseif isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PModerators" ) ) then setPlayerTeam ( player,teamModerators ) end end function addToTeamTimer() setTimer(addToTeam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addToTeamTimer) Should work, I don't know why you used that much functions and timers. Link to comment
Speed666 Posted September 16, 2011 Author Share Posted September 16, 2011 Works! Thank u so much! 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