hpmana.lua
function onSay(cid, words, param)
if(words == "!buyhp") then
local config = {hp = 10000,itemid = 12427,quanty = 1,storage = 201821}
if getPlayerStorageValue(cid, config.storage) >= 1 then
doPlayerSendCancel(cid, "Você já recebeu seus pontos de health") return true
elseif not doPlayerRemoveItem(cid, config.itemid, config.quanty) then
doPlayerSendCancel(cid, "Você precisa de "..config.quanty.." "..getItemNameById(config.itemid)) return true
end
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+config.hp)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
setPlayerStorageValue(cid,config.storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você recebeu "..config.hp.." pontos de health")
elseif(words == "!buymana") then
local config = {mana = 10000,itemid = 8189,quanty = 1,storage = 201822}
if getPlayerStorageValue(cid, config.storage) >= 1 then
doPlayerSendCancel(cid, "Você já recebeu sua mana") return true
elseif not doPlayerRemoveItem(cid, config.itemid, config.quanty) then
doPlayerSendCancel(cid, "Você precisa de "..config.quanty.." "..getItemNameById(config.itemid)) return true
end
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+config.mana)
doCreatureAddMana(cid, getCreatureMaxMana(cid))
setPlayerStorageValue(cid,config.storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você recebeu "..config.mana.." pontos de mana")
end
return TRUE
end
configuração do hp é aqui nessa tabela:
local config = {hp = 10000,itemid = 12427,quanty = 1,storage = 201821}
hp -- quanto de hp ele ira receber
itemid -- que item sera removido do player
quanty -- quantidade do itemid q sera removido
storage -- n mexa
da mana é a msm coisa
local config = {mana = 10000,itemid = 8189,quanty = 1,storage = 201822}
só muda o itemid e a storage '-'
só configurar
em talkactions.xml
<talkaction words="!buyhp;!buymana" event="script" value="hpmana.lua"/>