Obsdark
Member
- Joined
- Sep 25, 2011
- Messages
- 213
- Reaction score
- 9
Code:
local FOODS = {XXXX, YYYY} -- Here put the ID of the food item/s--
local Total_Max = 100 -- Here adjust the total --
local Barrier_Level = 20 -- Here adjust the level --
local text = "You've reached your limit of "..Total_Max.." "..getItemNameById(fot).."." -- Here adjust the message --
local function fot(cid)
if getPlayerLevel(cid) <= 20 then
fot = FOODS[1]
elseif getPlayerLevel(cid) > 20 then
fot = FOODS[2]
end
return fot
end
function onCastSpell(cid, var)
if getPlayerItemCount(cid, fot) < Total_Max then
if getPlayerLevel(cid) <= Barrier_Level then
doPlayerAddItem(uid,fot,(Total_Max - getPlayerItemCount(cid, fot)))
doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_GREEN)
elseif getPlayerLevel(cid) > Barrier_Level then
doPlayerAddItem(uid,fot,(Total_Max - getPlayerItemCount(cid, fot)))
doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_GREEN)
end
else
doSendAnimatedText(getPlayerPosition(cid), "..text..", 1)
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
end
return true
end
This spell basicly create certain(s) kind of item depending of your level and the stock of this item already in your backpack, ¡Could be everything!, from food/potions/arrows/etc...
Of course, is usefull to gave the player the chance of create groups of stuff, without the need of basicaly full him/her inventory.