• 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!

TalkAction BUY MORE MAXMANAS TO YOUR CHARACHTER using takaction

Sirion_Mido

Experienced Member
Joined
Jul 22, 2012
Messages
579
Reaction score
43
Location
E-G-Y-P-T
i decided to make that script , might be helpful for some people , this script adding max mana like if i have mana 1000 when i type !addmana it will cost x amount and add x mana you want follow next steps to install it:

Here we are:

in your talkactions folder , open talkactions.xml and post the following code:
XML:
<talkaction words="!addmana" event="script" value="addmana.lua"/>

and now go to your talkactions/scripts make file name addmana.lua and post the following code:
Lua:
function onSay(cid, words, param)
 
local cost = 10000 -- how much it cost
local mana = 100 -- how many manas to add
local msg = "You have bought more 100 mana to your maxmana" -- the text which send when buy function onSay(cid, words, param)
local cancel = "To do this action you need 10000 Gold Coin." -- the cancel message if you no have enough mone
local maxmana = 10000 -- if you have more than 10000 mana you can't add more manas
local manacancel = "you can not add more than 10000 manas" -- this cancel message if you have more than 10000 manas
 
if getPlayerMoney(cid) < cost then
doPlayerSendCancel(cid,cancel)
end
if getPlayerMana(cid) >= maxmana then
  doPlayerSendCancel(cid,manacancel)
	doSendMagicEffect(getPlayerPosition(cid),2)
else
doPlayerRemoveMoney(cid,cost)
setCreatureMaxMana(cid, mana)
doCreatureAddMana(cid, mana)
doPlayerSendTextMessage(cid,22,msg)
doSendMagicEffect(getPlayerPosition(cid),65)
 
 end
         end
   return true
end

else if you want me to edit it add health too , or add health only , just reply here and i will make one for your request.

and if you want it to buy more manas pay items reply to me too :p

and if there any errors reply to me here because i didn't test it


Rep++ If It Helpful For You..
 
Last edited:
and getCreatureMaxMana(cid) >= maxmana then

and getCreatureMaxMana(cid) <= maxmana then

- - - Updated - - -

Code:
function onSay(cid, words, param)
 
local cost = 10000 -- how much it cost
local mana = 100 -- how many manas to add
local msg = "You have bought more 100 mana to your maxmana" -- the text which send when buy more manas
local cancel = "To do this action costs 10000 Golds." -- the cancel message if you no have enough mone
local maxmana = 10000 -- if you have more than 10000 mana you can't add more manas
local manacancel = "you can not add more than 10000 manas" -- this cancel message if you have more than 10000 manas
 
if getPlayerMoney(cid) < cost then
doPlayerSendCancel(cid,cancel)
end
if getPlayerMana(cid) >= maxmana then
  doPlayerSendCancel(cid,manacancel)
	doSendMagicEffect(getPlayerPosition(cid),2)
else
doPlayerRemoveMoney(cid,10000)
setCreatureMaxMana(cid, mana)
doCreatureAddMana(cid, mana)
doPlayerSendTextMessage(cid,22,msg)
doSendMagicEffect(getPlayerPosition(cid),65)
   
 end
         end
   return true
end
 
Last edited:
Sirion_Mido, Elexonic is correct, your script only works if you have more than 10000 mana.
You need to either flip the signs (> to <) or use Elexonic's script.
 
Sirion_Mido, Elexonic is correct, your script only works if you have more than 10000 mana.
You need to either flip the signs (> to <) or use Elexonic's script.

opa i am so sorry really this script was from like 1 or 2 months so i was sound like noob :pPP
i edited in main post :)
 
move variables that don't require parameters out of the main function, tho doesn't make much difference with memory usage
scripts should be optimal when possible
 
Back
Top