Giovany Mito Posted July 17, 2019 Share Posted July 17, 2019 function kikarplayer (theClient, commandName, kickedName, ...) local account = getAccountName (getPlayerAccount (theClient)) if isObjectInACLGroup ("user."..account, aclGetGroup ("Admin")) then if not ... then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]",theClient,255,255,255,true) end local reason = table.concat({...}," ") local kickerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!",theClient,255,255,255,true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef" .. kickerName .. " #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!",theClient,255,255,255,true) end end addCommandHandler ( "kick", kikarplayer ) Erro ERROR: Loading script failed: [FW]Comandos/Server.Lua:4: unexpected symbol near '�' Link to comment
Other Languages Moderators androksi Posted July 17, 2019 Other Languages Moderators Share Posted July 17, 2019 function kikarplayer (theClient, commandName, kickedName, ...) local account = getAccountName (getPlayerAccount (theClient)) if isObjectInACLGroup ("user."..account, aclGetGroup ("Admin")) then local r = {...} if not r or string.len(r) < 1 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]",theClient,255,255,255,true) end local reason = table.concat(r," ") local kickerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!",theClient,255,255,255,true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef" .. kickerName .. " #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!",theClient,255,255,255,true) end end addCommandHandler ( "kick", kikarplayer ) Link to comment
Giovany Mito Posted July 17, 2019 Author Share Posted July 17, 2019 5 minutes ago, asrzkj said: function kikarplayer (theClient, commandName, kickedName, ...) local account = getAccountName (getPlayerAccount (theClient)) if isObjectInACLGroup ("user."..account, aclGetGroup ("Admin")) then local r = {...} if not r or string.len(r) < 1 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]",theClient,255,255,255,true) end local reason = table.concat(r," ") local kickerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!",theClient,255,255,255,true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef" .. kickerName .. " #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!",theClient,255,255,255,true) end end addCommandHandler ( "kick", kikarplayer ) ERROR: [FW]Comandos/Server.Lua:5: bad argument #1 to 'len' (string expected, got table) Link to comment
Other Languages Moderators androksi Posted July 17, 2019 Other Languages Moderators Share Posted July 17, 2019 Ah, desculpe. Remova o string.len(r) < 1 Não é necessário. Link to comment
Giovany Mito Posted July 17, 2019 Author Share Posted July 17, 2019 20 minutes ago, asrzkj said: Ah, desculpe. Remova o string.len(r) < 1 Não é necessário. Irei testar Se eu digitar apenas /kick era para aparecer Erro: /kick [nick] [motivo] Mais esta aparecendo isso * Erro: Player Invalido! Link to comment
Eficiencia Posted July 18, 2019 Share Posted July 18, 2019 (edited) Você deve digitar todo o nome do player ou então fazer o seguinte: Edited July 18, 2019 by Eficiencia Link to comment
Giovany Mito Posted July 18, 2019 Author Share Posted July 18, 2019 como consigo colocar mais de uma aclgroup no comando ? 9 minutes ago, Eficiencia said: function kikarplayer (theClient, commandName, kickedName, ...) local account = getAccountName (getPlayerAccount (theClient)) if isObjectInACLGroup ("user."..account, aclGetGroup ("Admin")) then local r = {...} if not r or not kickedName then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]",theClient,255,255,255,true) end local reason = table.concat(r," ") local kickerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromName(kickedName) outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef" .. kickerName .. " #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!",theClient,255,255,255,true) end end addCommandHandler ( "kick", kikarplayer ) tente assim Link to comment
Eficiencia Posted July 18, 2019 Share Posted July 18, 2019 (edited) esquece essa parte viajei legal 7 minutes ago, giovanymito said: como consigo colocar mais de uma aclgroup no comando ? adicione isso: 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 function kikarplayer (theClient, commandName, kickedName, ...) local account = getAccountName (getPlayerAccount (theClient)) if isObjectInACLGroup ("user."..account, aclGetGroup ("Admin")) then local r = {...} if not r or string.len(r) < 1 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]",theClient,255,255,255,true) end local reason = table.concat(r," ") local kickerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromPartialName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!",theClient,255,255,255,true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef" .. kickerName .. " #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!",theClient,255,255,255,true) end end addCommandHandler ( "kick", kikarplayer ) dai deixe o codigo assim e teste. pois com getPlayerFromName vc deve escrever o nome do player inteiro e de forma correta (se n me engano) e ja com getPlayerFromPartialName vc pode abreviar o nome. Edited July 18, 2019 by Eficiencia Link to comment
Giovany Mito Posted July 18, 2019 Author Share Posted July 18, 2019 acho q nao entendeu kk, digo assim como faz para por mais de um grupo para pode usar o comando /kick exemplo , Admin, Policia, Moderador etc... Link to comment
Eficiencia Posted July 18, 2019 Share Posted July 18, 2019 eu entendi no caso o script funcionou? Link to comment
Giovany Mito Posted July 18, 2019 Author Share Posted July 18, 2019 Jaja vou testar estou esperando voltar o host Link to comment
Eficiencia Posted July 18, 2019 Share Posted July 18, 2019 ok é que primeiro fui tentar ajudar a resolver o problema no script vou botar aqi no server local e testar script arrumado (obs: parte da ACL tive ajuda do DNL) function isPlayerInACL(player, acl) local accountName = getAccountName( getPlayerAccount(player) ) if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) ) end return false end function kikarplayer ( source, commandName, kickedName, ... ) if isPlayerInACL(source, "Admin") or isPlayerInACL(source, "SuperModerator") or isPlayerInACL(source, "Console") then local r = {...} if not r or not commandName or not kickedName then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]", source, 255, 255, 255, true) end local reason = table.concat(r," ") local kickerName = getPlayerName(source):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromPartialName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!", source, 255, 255, 255, true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef"..kickerName.." #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, source, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!", source, 255, 255, 255, true) end end addCommandHandler("kick", kikarplayer) Link to comment
Giovany Mito Posted July 18, 2019 Author Share Posted July 18, 2019 21 minutes ago, Eficiencia said: ok é que primeiro fui tentar ajudar a resolver o problema no script vou botar aqi no server local e testar Estou sozinho no servidor nao tem com quem ajudar a kickar kkkkkkkk Link to comment
Eficiencia Posted July 18, 2019 Share Posted July 18, 2019 da kick em vc msm (Eu fiz isso e funcionou kkkk) Link to comment
Giovany Mito Posted July 18, 2019 Author Share Posted July 18, 2019 Testei aqui, esta kickando mais agora ta kickando sem precisar usar o motivo Link to comment
DNL291 Posted July 18, 2019 Share Posted July 18, 2019 Eu faria sem obrigar o staff de colocar o motivo. De qualquer forma, Tente: function kikarplayer ( source, commandName, kickedName, ... ) if isPlayerInACL(source, "Admin") or isPlayerInACL(source, "SuperModerator") or isPlayerInACL(source, "Console") then local r = {...} if not kickedName or not r or #r == 0 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]", source, 255, 255, 255, true) end local reason = table.concat(r," ") local kickerName = getPlayerName(source):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromPartialName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!", source, 255, 255, 255, true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef"..kickerName.." #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, source, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!", source, 255, 255, 255, true) end end addCommandHandler("kick", kikarplayer) function isPlayerInACL(player, acl) local accountName = getAccountName( getPlayerAccount(player) ) if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) ) end return false end 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 EDIT: deve ser a função kickPlayer; banPlayer vai banir o jogador. Link to comment
Giovany Mito Posted July 24, 2019 Author Share Posted July 24, 2019 (edited) On 18/07/2019 at 18:10, DNL291 said: Eu faria sem obrigar o staff de colocar o motivo. De qualquer forma, Tente: function kikarplayer ( source, commandName, kickedName, ... ) if isPlayerInACL(source, "Admin") or isPlayerInACL(source, "SuperModerator") or isPlayerInACL(source, "Console") then local r = {...} if not kickedName or not r or #r == 0 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]", source, 255, 255, 255, true) end local reason = table.concat(r," ") local kickerName = getPlayerName(source):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromPartialName(kickedName) if not isElement(kickedPlayer) then outputChatBox ("#bf2e2e* Erro: Player Invalido!", source, 255, 255, 255, true) end outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef"..kickerName.." #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) banPlayer ( kickedPlayer, source, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!", source, 255, 255, 255, true) end end addCommandHandler("kick", kikarplayer) function isPlayerInACL(player, acl) local accountName = getAccountName( getPlayerAccount(player) ) if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) ) end return false end 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 EDIT: deve ser a função kickPlayer; banPlayer vai banir o jogador. Não esta aparecendo a mensagem no chat falando que foi kickado, e ta kikando sem precisar de motivo EDIT : Aparece a Mensagem Erro: /kick [nick] [motivo], MAIS o player é kickado mesmo assim Edited July 24, 2019 by giovanymito Link to comment
DNL291 Posted July 27, 2019 Share Posted July 27, 2019 kick é um comando do resource admin, vai executar ele quando usar o comando. Mude para outro nome ou remova o kick do admin. Tente isto: function kikarplayer ( source, commandName, kickedName, ... ) if isPlayerInACL(source, "Admin") or isPlayerInACL(source, "SuperModerator") or isPlayerInACL(source, "Console") then local r = {...} if not kickedName or #r == 0 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]", source, 255, 255, 255, true) end local kickerName = getPlayerName(source):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromPartialName(kickedName) if not isElement(kickedPlayer) then return outputChatBox ("#bf2e2e* Erro: Player Invalido!", source, 255, 255, 255, true) end local reason = table.concat(r," ") outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef"..kickerName.." #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) kickPlayer ( kickedPlayer, source, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!", source, 255, 255, 255, true) end end addCommandHandler("kickar", kikarplayer) function isPlayerInACL(player, acl) local accountName = getAccountName( getPlayerAccount(player) ) if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) ) end return false end 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 1 Link to comment
Giovany Mito Posted July 27, 2019 Author Share Posted July 27, 2019 2 hours ago, DNL291 said: kick é um comando do resource admin, vai executar ele quando usar o comando. Mude para outro nome ou remova o kick do admin. Tente isto: function kikarplayer ( source, commandName, kickedName, ... ) if isPlayerInACL(source, "Admin") or isPlayerInACL(source, "SuperModerator") or isPlayerInACL(source, "Console") then local r = {...} if not kickedName or #r == 0 then return outputChatBox ("#bf2e2e* Erro: /kick [nick] [motivo]", source, 255, 255, 255, true) end local kickerName = getPlayerName(source):gsub("#%x%x%x%x%x%x","") local kickedPlayer = getPlayerFromPartialName(kickedName) if not isElement(kickedPlayer) then return outputChatBox ("#bf2e2e* Erro: Player Invalido!", source, 255, 255, 255, true) end local reason = table.concat(r," ") outputChatBox ( "#c9c9c9[#1a6cefFW-INFORMA#c9c9c9]O #1a6cef"..kickerName.." #c9c9c9Kickou o Player #1a6cef" ..getPlayerName(kickedPlayer):gsub("#%x%x%x%x%x%x","").. "#c9c9c9 | Motivo #1a6cef" ..reason.. "#c9c9c9", getRootElement(), 255, 0, 0, true ) kickPlayer ( kickedPlayer, source, reason ) else outputChatBox ("#bf2e2e* Erro: Você Não tem Permissão!", source, 255, 255, 255, true) end end addCommandHandler("kickar", kikarplayer) function isPlayerInACL(player, acl) local accountName = getAccountName( getPlayerAccount(player) ) if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) ) end return false end 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 Ainda esta mesma coisa. Quando eu usava o banplayer, ele kickava e não bania, e o Erro: /kick [nick] [motivo] aparecia sem kickar o player, é um misterio kkkkkkk Link to comment
DNL291 Posted July 27, 2019 Share Posted July 27, 2019 Você só pode estar usando o comando kick como eu falei, por isso tá sempre kickando mesmo com a função banPlayer. Teste o meu código e use /kickar que vai funcionar. 1 Link to comment
Giovany Mito Posted July 29, 2019 Author Share Posted July 29, 2019 On 27/07/2019 at 10:50, DNL291 said: Você só pode estar usando o comando kick como eu falei, por isso tá sempre kickando mesmo com a função banPlayer. Teste o meu código e use /kickar que vai funcionar. Agora que fui perceber oque você disse, desculpa, então eu tirando o kick do admin, funcionaria correta mente o meu comando igual vc me Passou Obrigado 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