#DaNiLiN Posted May 17, 2018 Share Posted May 17, 2018 Como eu adiciono varias Team Com ACL ? sem bugar Link to comment
Other Languages Moderators Lord Henry Posted May 18, 2018 Other Languages Moderators Share Posted May 18, 2018 (edited) Só vc criar as Teams no script e adicionar uma função que coloca os players no Team correto quando eles logam no servidor dependendo da ACL Group que eles estiverem. createTeam (cria o time) onPlayerLogin (executa o evento quando alguém faz login) isObjectInACLGroup (verifica se um objeto está em determinada ACL Group) setPlayerTeam (coloca alguém em determinado Team) Para evitar o bug, vc pode fazer uma verificação ao iniciar o resource, para que ele coloque os players que já estão logados nos times corretos. Dai vc precisa obter todos os players online, verificar quais deles estão logados e verificar se eles estão na ACL Group correta. onResourceStart (executa o evento quando um resource é iniciado) getElementsByType (obtém todos os elementos do servidor daquele tipo, neste caso use o tipo "player" e ele vai obter todos os jogadores online) isGuestAccount (verifica se uma conta é Guest ou não, usa-se isso para verificar se um player está logado ou não.) Outra coisa que vc deve fazer, é tirar os jogadores do Team se eles deslogarem (sem sair do servidor). Dai basta setar Team nulo neles quando eles fizerem logout. onPlayerLogout (executa o evento quando alguém faz logout) setPlayerTeam (coloca alguém em determinado Team, neste caso coloque nil, no parâmetro do Team para remover o jogador de um Team.) Edited May 18, 2018 by Lord Henry 1 Link to comment
#DaNiLiN Posted May 19, 2018 Author Share Posted May 19, 2018 (edited) function createAdminTeamOnStart () AdminTeam = createTeam ( "[BOPE]Batalhão De Operações Especiais", 0, 0, 0 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("BOPE")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler ---2 function createAdminTeamOnStart () AdminTeam = createTeam ( "[ROTA]Ronda Ostensiva Tobias De Aguiar", 169, 169, 169 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("ROTA")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler --- 3 function createAdminTeamOnStart () AdminTeam = createTeam ( "[PMERJ]Policia Militar Rio de Janeiro", 0, 187, 255 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("PMERJ")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler ---4 function createAdminTeamOnStart () AdminTeam = createTeam ( "[FT]Força Tatica", 255, 0, 0 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("FT")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler ai, eu fiz assim ne add a função addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler Mais ta bugando, todos dessa mesma team só cai na time ft Edited May 19, 2018 by danilin Link to comment
Other Languages Moderators Lord Henry Posted May 19, 2018 Other Languages Moderators Share Posted May 19, 2018 (edited) Já lhe avisamos mais de 3 vezes que vc precisa usar o botão <> quando for postar código. Se colar direto como texto, não consigo interpretar o código. Não posso lhe ajudar enquanto não postar da maneira legível o código. https://prntscr.com/itiqv9 Edited May 19, 2018 by Lord Henry 1 Link to comment
#DaNiLiN Posted May 19, 2018 Author Share Posted May 19, 2018 function createAdminTeamOnStart () AdminTeam = createTeam ( "[BOPE]Batalhão De Operações Especiais", 0, 0, 0 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("BOPE")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler ---2 function createAdminTeamOnStart () AdminTeam = createTeam ( "[ROTA]Ronda Ostensiva Tobias De Aguiar", 169, 169, 169 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("ROTA")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler --- 3 function createAdminTeamOnStart () AdminTeam = createTeam ( "[PMERJ]Policia Militar Rio de Janeiro", 0, 187, 255 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("PMERJ")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler ---4 function createAdminTeamOnStart () AdminTeam = createTeam ( "[FT]Força Tatica", 255, 0, 0 )-- create a new team and name it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("FT")) then -- if he is admin setPlayerTeam(source, AdminTeam) -- set him to admin team end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler addEventHandler("onResourceStart", getRootElement(), setAdminTeam) -- add an event handler Link to comment
Other Languages Moderators Lord Henry Posted May 20, 2018 Other Languages Moderators Share Posted May 20, 2018 Vc criou várias funções com o mesmo nome, isso não pode. No evento onResourceStart, vc não deve usar getRootElement() como elemento ativador, pois irá executar quando qualquer resource for iniciado, não só este. Na Wiki ele diz qual o elemento ativador usar para que só ative ao iniciar este resource. Só saber ler o início da página. 1 Link to comment
#DaNiLiN Posted May 21, 2018 Author Share Posted May 21, 2018 ---BOPE local bope = createTeam ("[BOPE]Batalhão De Operações Especiais", 0, 0, 0 ) setTeamFriendlyFire ( bope, false ) function conecta () local conta = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user." .. conta, aclGetGroup("BOPE")) then setPlayerTeam ( source, bope ) end end addEventHandler( 'onPlayerLogin', root, conecta ) ---- ROTA local rota = createTeam("[ROTA]Ronda Ostensiva Tobias De Aguiar", 169, 169, 169 ) setTeamFriendlyFire ( rota, false ) function conecta () local conta = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user." .. conta, aclGetGroup("ROTA")) then setPlayerTeam ( source, rota ) end end addEventHandler( 'onPlayerLogin', root, conecta ) ---- mais uma vez obrigado. Link to comment
Other Languages Moderators Lord Henry Posted May 21, 2018 Other Languages Moderators Share Posted May 21, 2018 Em vez de usar duas funções com o mesmo nome, vc deveria colocar as duas condições na mesma função. function conecta () local conta = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup ("user." .. conta, aclGetGroup("BOPE")) then setPlayerTeam (source, bope) elseif isObjectInACLGroup ("user." .. conta, aclGetGroup("ROTA")) then setPlayerTeam (source, rota) end end addEventHandler ("onPlayerLogin", root, conecta) E também faltou a função que tira o jogador do team quando ele desloga. function conecta () setPlayerTeam (source, nil) end addEventHandler ("onPlayerLogout", root, desconecta) 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