function onUse(cid, item)
local item = XXXX -- Items ID
local pPos = getPlayerPosition(cid)
if doPlayerRemoveItem(cid, item, 1) == 1 then
doPlayerSendTextMessage(cid,19, "You got 50 levels.")
doSendMagicEffect(pPos, 28)
doPlayerAddLevel(cid, 50)
end
return TRUE
end
local cfg = {
max = 100, -- Maximum Level to Use
add = 10 -- Levels to Add
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerLevel(cid) < cfg.max)then
doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid)) + cfg.add)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved ".. cfg.add .." levels.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORKS)
doRemoveItem(item.uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have exceeeded the max level to use this.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
return true
end
Code:local cfg = { max = 100, -- Maximum Level to Use add = 10 -- Levels to Add } function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerLevel(cid) < cfg.max)then doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid)) + cfg.add) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved ".. cfg.add .." levels.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORKS) doRemoveItem(item.uid) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have exceeeded the max level to use this.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end return true end
actions.xmlWhere does it say which item you shall use?
local config = {}
--// Config
config.exp = 30
config.msg = "You gained "..config.exp.." experience points."
--// Config
function onUse(cid, item, frompos, item2, topos)
doPlayerAddExperience(cid, config.exp)
doPlayerSendTextMessage(cid, 25, config.msg)
doRemoveItem(item.uid, 1)
return true
end
can't you just add a line in the script what item you use..?