Não existe uma função que retire levels do jogador. Acho que dá até para fazer com querys na database, mas aí teria que ficar kickando o jogador se ele matasse um multiclient dele. ![]()
info
Group: Lenda
Joined: 03/10/06
Posts: 2.6k
Reputation: +309
Gender: Masculino
Tibia Character: Knight Orion

Como disse o oneshot, não existe função que retire level, mas teste meu script que vai adicionar 100% da exp do level, só que negativo (tipo -1600 para level 8 (4200) ao 7 (2600))
Fiz baseado em alguns scripts que eu vi, não tive como testar. Deve funcionar no TFS mais recente...
Em globalevents\scripts\antimckill.lua:
function onKill(cid, target)
if (isPlayer(cid) and isPlayer(target)) then
if (getIPByName(getPlayerNameByGUID(cid)) == getIPByName(getPlayerNameByGUID(target))) then
exp_perdida = getExpForLevel(getPlayerLevel())-getExpForLevel(getPlayerLevel()-1)
doPlayerAddExp(cid, exp_perdida)
return true
end
end
end
Em globalevents\globalevents.xml:
<event type="kill" name="antimckill" event="script" value="antimckill.lua"/>
Edited Maio 28 by Lordfire
info
Group: Barão
Joined: 24/01/11
Posts: 245
Reputation: +10

Como disse o oneshot, não existe função que retire level, mas teste meu script que vai adicionar 100% da exp do level, só que negativo (tipo -1600 para level 8 (4200) ao 7 (2600))
Fiz baseado em alguns scripts que eu vi, não tive como testar. Deve funcionar no TFS mais recente...
Em globalevents\scripts\antimckill.lua:
function onKill(cid, target) if (isPlayer(cid) and isPlayer(target)) then if (getIPByName(getPlayerNameByGUID(cid)) == getIPByName(getPlayerNameByGUID(target))) then exp_perdida = getExpForLevel(getPlayerLevel())-getExpForLevel(getPlayerLevel()-1) doPlayerAddExp(cid, exp_perdida) return true end end end
Em globalevents\globalevents.xml:
<event type="kill" name="antimckill" event="script" value="antimckill.lua"/>
testei e não deu nada tenho que mudar alguma coisa?
por um motivo n funcionou
va no creaturescript/script/login.lua
e colocque isto antes do ultimo "return TRUE" (n tem aspas)
registerCreatureEvent(cid, "antimckill")
e troque o script que o lordfire passo por esse(tinha um pequeno errinho, ia addiona exp inves de tira)
function onKill(cid, target) if (isPlayer(cid) and isPlayer(target)) then if (getIPByName(getPlayerNameByGUID(cid)) == getIPByName(getPlayerNameByGUID(target))) then exp_perdida = getExpForLevel(getPlayerLevel())-getExpForLevel(getPlayerLevel()-1) doPlayerAddExp(cid, -(exp_perdida)) return true end end end
@lordfire
esqueceu de negativa o valor e de fala pra ele por o registre
info
Group: Lenda
Joined: 03/10/06
Posts: 2.6k
Reputation: +309
Gender: Masculino
Tibia Character: Knight Orion

Verdade, tinha esquecido do register. Quanto aos levels, eu fiz certo e errei porque fiz ao contrário, era pra pegar a exp do level-1 e tirar a do level pra ficar negativo, coloquei ao contrário. Obrigado por ajustar ![]()
info
Group: Barão
Joined: 24/01/11
Posts: 245
Reputation: +10

Dei +REP pro lord por dar o script e amanhã darei seu +REP lordbug99
Por ter ajustado vou testar quando eu ver que deu certo vou postar aqui e reportar o topico...
@ Edit Bom Ainda Não Deu CERTO :S Matei Um MC Meu e Não Retirou nada :S algum erro alguma coisa que eu tenha que editar?
Edited Maio 28 by FriikoPall
Acho que essa tentativa de adicionar pontos de experiência negativos foi uma teoria que não deu certo. Ou seja só com query.
function onKill(cid, target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerIp(cid) == getPlayerIp(target) then
local pid, level = getPlayerGUID(cid), getPlayerLevel(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = ".. level - 1 .." WHERE `id` = ".. pid ..";")
end
end
return true
end
O jogador que matou o multiclient então será kickado e quando voltar a entrar no jogo, terá um level a menos.
info
Group: Lenda
Joined: 03/10/06
Posts: 2.6k
Reputation: +309
Gender: Masculino
Tibia Character: Knight Orion

Oneshot, não vai ter problema de o player experiência suficiente pra avançar esse level retirado?
info
Group: Barão
Joined: 24/01/11
Posts: 245
Reputation: +10

onde coloco? isto?
Acho que essa tentativa de adicionar pontos de experiência negativos foi uma teoria que não deu certo. Ou seja só com query.
function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then if getPlayerIp(cid) == getPlayerIp(target) then local pid, level = getPlayerGUID(cid), getPlayerLevel(cid) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level` = ".. level - 1 .." WHERE `id` = ".. pid ..";") end end return true end
O jogador que matou o multiclient então será kickado e quando voltar a entrar no jogo, terá um level a menos.
Oneshot, não vai ter problema de o player experiência suficiente pra avançar esse level retirado?
Acho que não, andei testando essa query aqui e ao entrar no jogo, o campo experience é atualizado para o valor da experiência ao ter atingido o level.
Ao criador do tópico, isso é um creaturescript, siga o mesmo procedimento de instalação passado acima.
info
Group: Barão
Joined: 24/01/11
Posts: 245
Reputation: +10

Funcionou +REP pra voce Oneshot Topico REPORTADO para moverem...
info
Group: Conde
Joined: 12/11/08
Posts: 520
Reputation: +73
Gender: Masculino

Tópico resolvido.








info
Group: Barão
Joined: 24/01/11
Posts: 245
Reputation: +10
Quero Um Sistema Que Se Eu Matar um MC Perdo Um Lvl Tornando Assim Impossivel Fazer FREE EXP em Ot De WAR
+REP a Quem Ajudar ;]