ABR Posted July 28, 2022 Share Posted July 28, 2022 Estou com um problema no meu código, não sei fazer tabelas e queria colocar várias ACL'S em um código só e queria que na notificação aparecesse a ACL que dominou local Dominar = createMarker(369.676, -2012.626, 7.672 -1, "cylinder", 1.2, 255, 255, 255, 100) addEventHandler("onMarkerHit", Dominar, function(source) triggerClientEvent (source, "MST.sendPlayerNotification", source, "Digite /dominar(Sigla de sua fac) para dominar o local", "success") end) addCommandHandler("dominar", function(source) local acc = getPlayerAccount ( source ) if acc and not isGuestAccount ( acc ) then local accName = getAccountName (acc) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "PCC" ) ) then triggerClientEvent (source, "MST.sendPlayerNotification", source, "Você dominou o local com sucesso", "success") triggerClientEvent (source, "MST.sendPlayerNotification", root, "(Aqui seria a fac que estpa dominando) está dominando o Jacarézinho", "warning") end end end) Link to comment
Moderators Vinyard Posted July 28, 2022 Moderators Share Posted July 28, 2022 Hi, welcome to the forums! I've moved your thread to the Portuguese scripting section so you can get better assistance in your native language. Please make sure to always use English when posting outside this section! 1 Link to comment
Pedrow Posted July 29, 2022 Share Posted July 29, 2022 (edited) E aí @ABR, para fazer isso, você pode utilizar o loop for em uma tabela armazenando as acls que serão permitidas de executar o comando, exemplo: local allowedAcls = {'PCC', 'CV', 'NH'} function isPlayerInTableAclGroup(player, groupsTable) local playerAccountName = getAccountName(getPlayerAccount(player)) for k = 1, #groupsTable do local indexedGroup = groupsTable[k] if isObjectInACLGroup('user.' .. playerAccountName, aclGetGroup(indexedGroup)) then return true end end return false end addCommandHandler('dominar', function(player) local acc = getPlayerAccount ( player ) if acc and not isGuestAccount ( acc ) then local accName = getAccountName (acc) if isPlayerInTableAclGroup(player, allowedAcls) then triggerClientEvent (player, 'MST.sendPlayerNotification', player, 'Você dominou o local com sucesso', 'success') triggerClientEvent (player, 'MST.sendPlayerNotification', root, '(Aqui seria a fac que estpa dominando) está dominando o Jacarézinho', 'warning') end end end) OBS: Atente-se a indentação do seu código, para facilitar a leitura do código, você pode ver como indentar seu código clicando aqui. Edited July 29, 2022 by Pedrow 1 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