• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Talkaction] !buymana !buyhp

Kekox

Well-Known Member
Joined
Apr 4, 2009
Messages
1,265
Reaction score
62
Location
Venezuela
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.
errorconsole.jpg

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
 
Back
Top