Ir para conteúdo
  • 0

[Resolvido] [Resolvido] Editar script /ban


Wase Wiss

Pergunta

Eae Galera blz ? eu queria pedir a vocês para editar essa script de ban para min, queria que tivesse como escolher se queria fosse ban ip ou não, ae o comando ficasse assim: /ban NICKPLAYER, DIAS, NAO OU SIM(BAN IP OU NAO), MOTIVO. 

 

Script

Spoiler

function onSay(cid, words, param, channel)
local t = string.explode(param, ",")
if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias,motivo.") return true end
local name, days = t[1], tonumber(t[2])
local motivo = t[3]
local acc = getAccountIdByName(name)
if acc ~= 0 then
local tempo = days * 24 * 3600
doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por "..motivo..",por "..tempo.." !.', 0)
doBroadcastMessage("O jogador ".. getCreatureName(target).. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)
addEvent(doRemoveCreature, 3*1000, target, true)
return true
end
end

Se alguém poder min ajuda, desde já, meu muito OBRIGADO <3 

Link para o comentário
Compartilhar em outros sites

13 respostass a esta questão

Posts Recomendados

  • 0
function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]  if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true end  local acc = getAccountIdByName(name)  local player_ip = getPlayerIp(getPlayerByName(name))  if acc ~= 0 then     local player_ip, player = getPlayerIp(getPlayerByName(name)), getPlayerByNameWildcard(name)          if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then     doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")      return true     end        if tostring(boolean) == "false" then       print"ban normal"       doAddAccountBanishment(acc, target, os.time() + 3600 * 24 * days, action, 2, 'Você foi banido por: ' .. getCreatureName(cid) .. ' \nMotivo: ' .. motivo ..'. \nQuantidade de dias: '.. days, 0)        doBroadcastMessage("O jogador " .. t[1] .. " foi banido por ".. getCreatureName(cid).. ". \n Motivo:".. motivo .. ".", 25)           else                        print "ban ip"       doAddIpBanishment(player_ip)          end       if isPlayer(player) then    doRemoveCreature(player)    end   endreturn trueend

 

Editado por Nogard
Link para o comentário
Compartilhar em outros sites

  • 0

testa:

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true endlocal acc = getAccountIdByName(name)local player_ip = getPlayerIp(getPlayerByNameWildcard(name)) if acc ~= 0 then   if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then   doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")    return true   end    if tostring(boolean) == "false" then   local tempo = days * 24 * 3600   doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por "..motivo..",por "..tempo.." !.', 0)   doBroadcastMessage("O jogador ".. getCreatureName(tostring(name)).. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   else   doAddIpBanishment(player_ip)   doBroadcastMessage("O IP do jogador ".. getCreatureName(tostring(name)).. " foi banido! Autor do banimento: ".. getCreatureName(cid).. ". \n Motivo:\n"..     motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   return true   end endend

 

Link para o comentário
Compartilhar em outros sites

  • 0
32 minutos atrás, Nogard disse:

testa:

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true endlocal acc = getAccountIdByName(name)local player_ip = getPlayerIp(getPlayerByNameWildcard(name)) if acc ~= 0 then   if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then   doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")    return true   end    if tostring(boolean) == "false" then   local tempo = days * 24 * 3600   doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por "..motivo..",por "..tempo.." !.', 0)   doBroadcastMessage("O jogador ".. getCreatureName(tostring(name)).. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   else   doAddIpBanishment(player_ip)   doBroadcastMessage("O IP do jogador ".. getCreatureName(tostring(name)).. " foi banido! Autor do banimento: ".. getCreatureName(cid).. ". \n Motivo:\n"..     motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   return true   end endend

 

O mano, deu esse erro aki na distro:

Spoiler

Screenshot_12.png.d98f78991727d10c6e9aaa2df62dba8c.png

 

Screenshot_12.png.d98f78991727d10c6e9aaa2df62dba8c.png

Link para o comentário
Compartilhar em outros sites

  • 0

tenta dessa forma:

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true endlocal acc = getAccountIdByName(name)local player_ip = getPlayerIp(getPlayerByNameWildcard(name)) if acc ~= 0 then   if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then   doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")    return true   end    if tostring(boolean) == "false" then   local tempo = days * 24 * 3600   doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por "..motivo..",por "..tempo.." !.', 0)   doBroadcastMessage("O jogador ".. t[1] .. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   else   doAddIpBanishment(player_ip)   doBroadcastMessage("O IP do jogador ".. t[1].. " foi banido! Autor do banimento: ".. getCreatureName(cid).. ". \n Motivo:\n"..     motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   return true   end endend

 

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

tenta dessa forma:

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true endlocal acc = getAccountIdByName(name)local player_ip = getPlayerIp(getPlayerByNameWildcard(name)) if acc ~= 0 then   if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then   doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")    return true   end    if tostring(boolean) == "false" then   local tempo = days * 24 * 3600   doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por "..motivo..",por "..tempo.." !.', 0)   doBroadcastMessage("O jogador ".. t[1] .. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   else   doAddIpBanishment(player_ip)   doBroadcastMessage("O IP do jogador ".. t[1].. " foi banido! Autor do banimento: ".. getCreatureName(cid).. ". \n Motivo:\n"..     motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   return true   end endend

 

Mostrou a mensagem, porém não baniu :( 

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

 

 

não baniu em qual das condições? 

O ban ip não funcionou, já o outro funcionou normal, só que quando a pessoa leva o ban e tenta logar não mostra o motivo e nem os dias que foi, mostra assim:

Spoiler

Screenshot_14.png.6a63451f68f00ed5ad71e43c003e9271.png

E quando eu tentei o ban ip, deu esse erro na distro:

Spoiler

Screenshot_13.png.2cf48dc9d23435ef8248732d43ff5a55.png

 

Quando da ban sem ser ip, o comando que agente usa aparece no chat "Channel" como se fosse outra pessoa falando, será que tem como tirar para não aparecer ?

Screenshot_13.png.2cf48dc9d23435ef8248732d43ff5a55.png

Screenshot_14.png.6a63451f68f00ed5ad71e43c003e9271.png

Link para o comentário
Compartilhar em outros sites

  • 0

beleza, testa:

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true endlocal acc = getAccountIdByName(name)local player_ip = getPlayerIp(getPlayerByName(name)) if acc ~= 0 then   if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then   doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")    return true   end    if tostring(boolean) == "false" then   local tempo = days * 24 * 3600   doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por '.. motivo ..',por '..tempo..' !.', 0)   doBroadcastMessage("O jogador ".. t[1] .. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   return true   else   doAddIpBanishment(player_ip)   doBroadcastMessage("O IP do jogador ".. t[1].. " foi banido! Autor do banimento: ".. getCreatureName(cid).. ". \n Motivo:\n"..     motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByName(name), true)   return true   end endend

 

 

Editado por Nogard
Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

beleza, testa:

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true endlocal acc = getAccountIdByName(name)local player_ip = getPlayerIp(getPlayerByName(name)) if acc ~= 0 then   if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then   doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")    return true   end    if tostring(boolean) == "false" then   local tempo = days * 24 * 3600   doAddAccountBanishment(acc, target, os.time() + tempo, 5, 2, 'Você foi banido por '.. motivo ..',por '..tempo..' !.', 0)   doBroadcastMessage("O jogador ".. t[1] .. " foi banido por ".. getCreatureName(cid).. ". Motivo:\n".. motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByNameWildcard(name), true)   else   doAddIpBanishment(player_ip)   doBroadcastMessage("O IP do jogador ".. t[1].. " foi banido! Autor do banimento: ".. getCreatureName(cid).. ". \n Motivo:\n"..     motivo .. ".", 25)   addEvent(doRemoveCreature, 3*1000, getPlayerByName(name), true)   return true   end endend

 

 

O ban ip não funcionou não, deu erro dnv, e o ban normal sem ser o ip quando a pessoa tenta logar mostra isso:

Spoiler

Screenshot_16.png.516e4226e9bafe9bdd7a1f6af382e0e1.png

Erro na distro:

Spoiler

Screenshot_15.png.6e1fb81083d8d4765488d5fe04a3f572.png

 

Screenshot_15.png.6e1fb81083d8d4765488d5fe04a3f572.png

Screenshot_16.png.516e4226e9bafe9bdd7a1f6af382e0e1.png

Link para o comentário
Compartilhar em outros sites

  • 0

aqui funcionou perfeitamente brother.

 

banacc.png

banip.png

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]  if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true end  local acc = getAccountIdByName(name)  local player_ip = getPlayerIp(getPlayerByName(name))  if acc ~= 0 then     local player_ip, player = getPlayerIp(getPlayerByName(name)), getPlayerByNameWildcard(name)          if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then     doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")      return true     end        if tostring(boolean) == "false" then       doAddAccountBanishment(acc, target, os.time() + 3600 * 24 * days, action, 2, 'Você foi banido por: '.. motivo ..'. \nQuantidade de dias: '.. days ..'.', 0)           else                        doAddIpBanishment(player_ip)          end       if isPlayer(player) then    addEvent(doRemoveCreature, 2 * 1000, player)    end   endreturn trueend

 

Editado por Nogard
Link para o comentário
Compartilhar em outros sites

  • 0
10 horas atrás, Nogard disse:

aqui funcionou perfeitamente brother.

 

banacc.png

banip.png

 

function onSay(cid, words, param, channel)local t = string.explode(param, ",")local name, days, boolean, motivo = t[1], tonumber(t[2]), t[3], t[4]  if param == '' or not days or not name or not motivo then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite /ban nome,dias, true ou false (true para IP Banishment), motivo.") return true end  local acc = getAccountIdByName(name)  local player_ip = getPlayerIp(getPlayerByName(name))  if acc ~= 0 then     local player_ip, player = getPlayerIp(getPlayerByName(name)), getPlayerByNameWildcard(name)          if tostring(boolean) ~= "true" and tostring(boolean) ~= "false" then     doPlayerSendTextMessage(cid, "O terceiro parâmetro deve ser true ou false. \n true = ban ip.\n /ban nome, dias, true ou false, motivo.")      return true     end        if tostring(boolean) == "false" then       doAddAccountBanishment(acc, target, os.time() + 3600 * 24 * days, action, 2, 'Você foi banido por: '.. motivo ..'. \nQuantidade de dias: '.. days ..'.', 0)           else                        doAddIpBanishment(player_ip)          end       if isPlayer(player) then    addEvent(doRemoveCreature, 2 * 1000, player)    end   endreturn trueend

 

Não funcionou dnv não, vou baixar um sv 8.60 e testar para vê, pode ser o meu sv que ta bugando 

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

lembrando que o jogador alvo precisa estar online, se vc observar nos seus erros eles aparecem após o logout

Putz, eu tava testando com o jogador offline KK, agora funcionou mano, deu ban certinho, a unica coisa que não mostra certo é quando agente tenta logar, não mostra o nome de quem baniu, aparece o nome Motivo

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...