VO

[Talk] Adc E Remover Mana/hp

Por Vodkart, 31 de jul. de 2010 em Actions e Talkactions

otserv
tibia
script
9
2.4k
VodkartV
31 de julho de 2010 às 19:46

versão testada: 8.54+

 

Comandos:

 

/addmana nome,quantidade

/delmana nome,quantidade

 

/addhp nome,quantidade

/delhp nome,quantidade

 

 

talkactions/script

 

addhpmana.lua

--[[ Script by 10% Vodkart and 90% Devilmoon ]]--
--[[ para o  Xtibia.com  ]]--

function onSay(cid, words, param)

if(words == "/addmana") then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
return
end
local player = getPlayerByName(t[1])
local quanty = t[2]
local pid = getPlayerByNameWildcard(t[1])
mana = getCreatureMana(player)+quanty
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
	return TRUE
end
setCreatureMaxMana(player, mana)
doCreatureAddMana(player, getCreatureMaxMana(player))
doPlayerSendTextMessage(player, 19, "Foram adicionados "..quanty.." de mana do seu character agora você tem " .. getCreatureMana(cid) .. "/" .. getCreatureMaxMana(cid) .. " de Mana.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você adicionou "..quanty.." de mana ao jogador " .. t[1] .. " ")

elseif(words == "/delmana") then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
return
end
local player = getPlayerByName(t[1])
local quanty = t[2]
local pid = getPlayerByNameWildcard(t[1])
mana = getCreatureMana(player)-quanty
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
	return TRUE
end
setCreatureMaxMana(player, mana)
doCreatureAddMana(player, getCreatureMaxMana(player))
doPlayerSendTextMessage(player, 19, "Foram removidos "..quanty.." de mana do seu character agora você tem " .. getCreatureMana(cid) .. "/" .. getCreatureMaxMana(cid) .. " de Mana.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Removeu "..quanty.." de mana do jogador " .. t[1] .. " ")

elseif(words == "/addhp") then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
return
end
local player = getPlayerByName(t[1])
local quanty = t[2]
local pid = getPlayerByNameWildcard(t[1])
health = getCreatureMaxHealth(player)+quanty
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
	return TRUE
end
setCreatureMaxHealth(player, health)
doCreatureAddHealth(player, getCreatureMaxHealth(player))
doPlayerSendTextMessage(player, 19, "Foram adicionados "..quanty.." de hp do seu character agora você tem " .. getCreatureHealth(cid) .. "/" .. getCreatureMaxHealth(cid) .. " de HP.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você adicionou "..quanty.." de health do jogador " .. t[1] .. " ")

elseif(words == "/delhp") then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
return
end
local player = getPlayerByName(t[1])
local quanty = t[2]
local pid = getPlayerByNameWildcard(t[1])
health = getCreatureHealth(player)-quanty
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
	return TRUE
end
setCreatureMaxHealth(player, health)
doCreatureAddHealth(player, getCreatureMaxHealth(player))
doPlayerSendTextMessage(player, 19, "Foram Removidos "..quanty.." de hp do seu character agora você tem " .. getCreatureHealth(cid) .. "/" .. getCreatureMaxHealth(cid) .. " de HP.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Removeu "..quanty.." de health do jogador " .. t[1] .. " ")
end
return TRUE
end

 

talkactions.xml

 <talkaction log="yes" words="/addmana;/delmana;/addhp;/delhp" access="5" event="script" value="addhpmana.lua"/>

Editado Março 6 por Vodkart

DevilMoonD
31 de julho de 2010 às 19:51

Hmm Muinto bom , Testei 8.50 :D Tambem Edit!! Vodkart - Otimo Professor! Kydrai tbm :D

 

Qualquer Bug , Comentem!!!!! Obrigado vodkart por postar o script!!

 

Abraços!

IgorROX2010I
31 de julho de 2010 às 23:59

Parabéns Vodkart, eh DevilMon ótimo script, não colokei no meu OTserver mais dá pra ver que é um otimo script, mais para OTservers de War

Parabén pelo script :thumbsupsmiley: :thumbsupsmiley: :thumbsupsmiley:

DevilMoonD
07 de agosto de 2010 às 10:51

Muinto Obrigado pelo Elogio , e o Script Serve , tabem para voce nao precisar ir la no sql editor , achar o nome do player , almenta ou remover :/!

 

Vlw Pelos elogios , Espero que Goste!

KydraiK
07 de agosto de 2010 às 11:11

Boa, mas da pra melhorar.

 

Se você reparar vai ver que existe uma sequência de comandos se repete varias vezes.

Muita coisa ai poderia ser colocada antes do if.

 

E faltou um return depois do "doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")".

1 ano depois...
hique86H
08 de setembro de 2011 às 19:12

Não foi minha intenção reviver o topico, mas é que estou precisando desse script mas esta com um probleminha.

 

Quando vou adicionar hp, não importa a quantidade, sempre adiciona 20000.

 

ss:

 

semttulo2fx.png

 

isso só acontece quando vou adicionar hp.

 

quando vou adicionar mana, está perfeito.

 

ss:

 

semttulo2ch.png

 

 

Da uma ajuda ae, quem souber, por favor!! valew.

 

obs: minha versão é 8.6

osbrotO
08 de setembro de 2011 às 19:48

Script legal, testei e funcionou corretamente!

hique86H
08 de setembro de 2011 às 20:49

Script legal, testei e funcionou corretamente!

 

 

Em qual versão você testou?!?

 

adicionar hp também está funcionando normal ai?!?

hique86H
14 de setembro de 2011 às 21:25

Up

 

ajuda ai pessoal, ainda não consegui concertar isso...

 

hp adiciona sempre 20k, não importa o quanto eu coloco pra adicionar!!