Im trying to make an script, when you say:
!buymana amount of mana you wanna buy
or
!buyhp amount of healthpoints you wanna buy
but it doesnt work I dont know why. someone can help me?..
Also I want that each healthpoint or manapoint have a cost of 15gp.. If he wanna buy 200 hp then 200*15 = 3000 so, 200 hp have a cost of 3k.
!buymana amount of mana you wanna buy
or
!buyhp amount of healthpoints you wanna buy
but it doesnt work I dont know why. someone can help me?..
Also I want that each healthpoint or manapoint have a cost of 15gp.. If he wanna buy 200 hp then 200*15 = 3000 so, 200 hp have a cost of 3k.
LUA:
function onSay(cid, words, param)
local manaprice = 15
local hpprice = 15
if words == "!buymana" and param ~= nil then
if getPlayerMoney(cid) >= manaprice*param then
doPlayerRemoveMoney(cid, manaprice*param)
doPlayerAddMana(cid, param)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "You do not have enough money")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
elseif words == "!buyhp" and param ~= nil then
if getPlayerMoney(cid) >= hpprice*param then
doPlayerRemoveMoney(cid, hpprice*param)
doCreatureAddHealth(cid, param)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
else
doPlayerSendCancel(cid, "You do not have enough money")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
return TRUE
end