Giovany Mito Posted August 1, 2019 Posted August 1, 2019 Olá, Então, eu to fazendo uma organização no meu servidor de REPORTER, e no caso tem uma hierarquia tipo. LEVEL 4 - LIDER LEVEL 3 - SUB LIDER LEVEL 2 - REPORTER FIXO LEVEL 1 - REPORTER TEMPORARIO Eu no começo do sistema fiz 4 grupo na acl, mais assim fica muito grupo se for fazer em todas as organização do servidor, então eu tava pensando tem como eu fazer esses nivel dentro da acl ?
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 30 minutes ago, raynner said: Seja mais claro ! funciona assim na hierarquia. LEVEL 4 - LIDER = COMANDOS : /setreporter /hq /ir /tr /chatlider LEVEL 3 - SUB LIDER /ir /tr /chatsub LEVEL 2 - REPORTER FIXO /hq /noticias /chatfixo LEVEL 1 - REPORTER TEMPORARIO /hq /chattemp ai cada level tem um tipo de comando, para eu fazer essa setagem eu tenho que criar no caso 4 grupos na acl, os grupo : REPORTERLIDER, REPORTERSUB, REPORTERFIXO, REPORTERTEMP, no caso, /setreporterlider /setreportersub e assim por indiante... ai fica aquele monte de acl, oque queria saber se tem como com apenas um grupo colocar level ai faço setagem assim /setreporter NIVEL NICK exemplo: /setreporter 4 giio. ai nos comandos não sei tambem ia por para só aquele level do grupo pudsse usar
#DeltaSCR Posted August 1, 2019 Posted August 1, 2019 Cara, tu não acha que seria mais fácil fazer isso por Data's não?
Other Languages Moderators Lord Henry Posted August 1, 2019 Other Languages Moderators Posted August 1, 2019 Eu faria com setAccountData. Salvando tipo assim: setAccountData (acc, "Reporter.level", 4) -- Líder setAccountData (acc, "Reporter.level", 3) -- Sub-Líder setAccountData (acc, "Reporter.level", 2) -- Repórter setAccountData (acc, "Reporter.level", 1) -- Temporário E depois quando o cara logar, verificar essa data com getAccountData. Dependendo do número salvo na conta, ele vai ter determinado acesso aos comandos. 1
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 1 hour ago, Lord Henry said: Eu faria com setAccountData. Salvando tipo assim: setAccountData (acc, "Reporter.level", 4) -- Líder setAccountData (acc, "Reporter.level", 3) -- Sub-Líder setAccountData (acc, "Reporter.level", 2) -- Repórter setAccountData (acc, "Reporter.level", 1) -- Temporário E depois quando o cara logar, verificar essa data com getAccountData. Dependendo do número salvo na conta, ele vai ter determinado acesso aos comandos. Entendi, mais ai como eu faria para aquele nivel usar um comando tal, no caso eu estou usando assim if isObjectInACLGroup("user." .. accountname, aclGetGroup("REPORTERLIDER")) then
Other Languages Moderators Lord Henry Posted August 1, 2019 Other Languages Moderators Posted August 1, 2019 if (getAccountData (acc, "Reporter.level") == 4) then 1
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 1 minute ago, Lord Henry said: if (getAccountData (acc, "Reporter.level") == 4) then Entendi, Vou tentar desenrolar aqui, obrigado
Jonas^ Posted August 1, 2019 Posted August 1, 2019 (edited) Só pra complementar a resposta do Lord: addCommandHandler ("rights", function (thePlayer, cmd) if (getAccountData (getPlayerAccount (thePlayer), "Reporter.level") == 4) then -- Se o jogador tiver a accountData Reportar.level 4, então: outputChatBox ("Eu "..getPlayerName (thePlayer).." Sou o líder do grupo reporter!", root) else outputChatBox ("Error! Tente novamente!", thePlayer, 255, 30, 30) end end) EDIT: Em relação aos comandos é bem simples, função útil: function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end Se tiver dúvidas fique a vontade em perguntar. Edited August 1, 2019 by Jonas^ Adicionando informações extras... 1
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 1 hour ago, Jonas^ said: Só pra complementar a resposta do Lord: addCommandHandler ("rights", function (thePlayer, cmd) if (getAccountData (getPlayerAccount (thePlayer), "Reporter.level") == 4) then -- Se o jogador tiver a accountData Reportar.level 4, então: outputChatBox ("Eu "..getPlayerName (thePlayer).." Sou o líder do grupo reporter!", root) else outputChatBox ("Error! Tente novamente!", thePlayer, 255, 30, 30) end end) EDIT: Em relação aos comandos é bem simples, função útil: function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end Se tiver dúvidas fique a vontade em perguntar. Oquer seria essa ultima função no EDIT ?
Other Languages Moderators Lord Henry Posted August 1, 2019 Other Languages Moderators Posted August 1, 2019 É uma função útil que retorna o jogador que tenha um nick contendo tal string. Ela é útil quando você quer obter um jogador por comando mas não quer digitar o nome exato do jogador. Exemplo: function qualquerCoisa (thePlayer, cmd, nick) if (nick) then local jogador = getPlayerFromPartialName (nick) if (jogador) then outputChatBox ("Jogador encontrado tem nome: "..getPlayerName (jogador)) else outputChatBox ("Não foi encontrado nenhum jogador contendo '"..nick.."' no nick.") end end end addCommandHandler ("procurar", qualquerCoisa) -- Teste com /procurar SeuNick Ela faz o mesmo que o getPlayerFromName. Mas o getPlayerFromName só funciona se o nick informado for exatamente igual ao do jogador, incluindo os códigos de cores. Já o getPlayerFromPartialName funciona com uma parte do nick. -- Se por exemplo o seu nick for #00ff00Giovany, teremos os resultados: getPlayerFromName ("Giovany") -- False, não foi encontrado nenhum jogador. getPlayerFromPartialName ("Giovany") -- PlayerElement, foi encontrado o jogador. getPlayerFromName ("#00ff00Giovany") -- PlayerElement, foi encontrado o jogador. getPlayerFromPartialName ("#00ff00Giovany") -- PlayerElement, foi encontrado o jogador. 1
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 Agora entendi, no caso se meu nick for Giovany se eu digitar só gio ele ja busca o nome mais proximo disso no caso né ? tenho um script assim
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 Conseguir fazer o script mais acho q ficou muito grande kkkkkkkk function _setPlayerhlp(thePlayer, command, who, amount) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if not tonumber ( amount ) then outputChatBox("ERRO:/sethlp <player> <nivel>", thePlayer, 255, 100, 100, true) return end local receiver = getPlayerFromName(who) if not (receiver) then outputChatBox("ERRO : Player OFF/Não Existe", thePlayer, 255, 100, 100, true) return end if not(tonumber ( amount ) <= 1) and not( tonumber ( amount ) >= 4 ) then setPlayerhlpp (receiver, amount) outputChatBox(" Você setou nivel "..amount.." de helper para o "..who:gsub('#%x%x%x%x%x%x', '').."!", thePlayer, 100, 255, 100, true) else outputChatBox("Você não pode setar esse nivel.", thePlayer, 255, 100, 100, true) end end end addCommandHandler("sethlp",_setPlayerhlp) function setPlayerhlpp(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"levelhelper",tonumber(number)) end end addEventHandler("onPlayerLogin", root, function() local acc = getPlayerAccount(source) local helpset = (getAccountData(acc,"Helper") or 0) local helpset = getAccountData(acc, "Helper") or 0 setElementData(source, "levelhelper", tonumber(helpset)) end) addEventHandler("onPlayerQuit", root, function() local acc = getPlayerAccount(source) local helpset = getElementData(source, "levelhelper") or 0 setAccountData(acc, "Helper", tonumber(helpset)) end) addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(source) local helpset = getAccountData(acc, "Helper") if helpset then setElementData(player, "levelhelper", tonumber(helpset)) end end end) function getPlayerhelp(thePlayer) local data = getElementData(thePlayer, "levelhelper") thePoints = tonumber(data) return thePoints end function takePlayerhelp(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"levelhelper",getElementData(thePlayer, "levelhelper")-tonumber(number)) end end
Other Languages Moderators Lord Henry Posted August 1, 2019 Other Languages Moderators Posted August 1, 2019 Vc achou isso grande? Sabe de nada inocente, ahuahuahaua
Giovany Mito Posted August 1, 2019 Author Posted August 1, 2019 16 minutes ago, Lord Henry said: Vc achou isso grande? Sabe de nada inocente, ahuahuahaua kkkkkkk, acho q não esta faltando nada, esta ? uma outra pergunta como faço para por mais de um nivel no msm comando ? if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 1) then
brunob22 Posted August 2, 2019 Posted August 2, 2019 10 hours ago, Giovany Mito said: kkkkkkk, acho q não esta faltando nada, esta ? uma outra pergunta como faço para por mais de um nivel no msm comando ? if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 1) then if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 1) or (getAccountData (getPlayerAccount (thePlayer), "Helper") == 2) then e para evitar mt if use elseif if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 1) then xxxxxxx elseif (getAccountData (getPlayerAccount (thePlayer), "Helper") == 2) then dddddd end
Other Languages Moderators Lord Henry Posted August 2, 2019 Other Languages Moderators Posted August 2, 2019 (edited) 14 hours ago, Giovany Mito said: uma outra pergunta como faço para por mais de um nivel no msm comando ? if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 1) then local dataLevel = getAccountData (getPlayerAccount (thePlayer), "Helper") if (dataLevel) then -- Se o jogador possui essa data na conta, então: if (dataLevel >= 1) then -- Se a data da conta for 1 ou maior, então: (para permissões que funcionam para todos os 4 níveis de acesso) -- CODE... elseif (dataLevel >= 2) then -- Se a data da conta for 2 ou maior, então: (para permissões que só funcionam pro nível de Repórter em diante) -- CODE... elseif (dataLevel >= 3) then -- Se a data da conta for 3 ou maior, então: (para permissões que só funcionam pro nível de Sub-Líder em diante) -- CODE... elseif (dataLevel == 4) then -- Se a data da conta for igual a 4, então: (para permissões que funcionam somente pro nível de Líder) -- CODE... end end @Giovany Mito Creio que dessa forma funciona melhor para a lógica do seu script. Edited August 2, 2019 by Lord Henry
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