[Talk] Adc E Remover Mana/hp

Vodkart
em Actions e Talkactions

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

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"/>

bossisg.png

DevilMoon

@leonartei
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/01/10Posts: 706Gênero: MasculinoChar no Tibia: Bakwin

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!

Contato: DevilMoon@Xtibia.com

IgorROX2010

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/07/10Posts: 20Char no Tibia: Torei Sua Mãe !

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:

DevilMoon

@leonartei
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/01/10Posts: 706Gênero: MasculinoChar no Tibia: Bakwin

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!

Contato: DevilMoon@Xtibia.com

Kydrai

"Keep Your Mind Wide Open"
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 21/08/06Posts: 250

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.")".

~ Kydrai
Programador / Scripter

 

sign.png

hique86

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/09/08Posts: 62

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

Meus trabalhos:

Minha Galeria

Fazendo Suas Próprias Looktype

Teleportes, Saindo Do Basico!

 

 

Te ajudei?!? dá REP+ não custa nada =D

osbrot

Acesse www.osbrot.com.br e conheça um bom OTserver
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 11/05/11Posts: 34Char no Tibia: ADM Fernando

Script legal, testei e funcionou corretamente!

Conheça um bom OTserver OSBR-OT 24hrs on-line com você!

Acesse www.osbrot.com.br e conheça!