local config = {maxlvl = 250, trys = 50}
function onUse(cid, item, fromPosition, itemEx, toPosition)
function getPlayerWeaponType(cid)
local weapon = getPlayerWeapon(cid, true)
if weapon and weapon.uid > 0 then
return getItemWeaponType(weapon.uid)
end
return WEAPON_NONE
end
if getPlayerLevel(cid) <= config.maxlvl and getPlayerWeaponType(cid) == WEAPON_SWORD then
doPlayerAddSkill(cid, SKILL_SWORD, 1)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,TALKTYPE_BROADCAST, "CONGRATULATIONS! You gained ".. config.trys .." SKILL TRYS from the SKILL SCROLL!.")
elseif getPlayerLevel(cid) <= config.maxlvl and getPlayerWeaponType(cid) == WEAPON_AXE then
doPlayerAddSkill(cid, SKILL_AXE, 1)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,TALKTYPE_BROADCAST, "CONGRATULATIONS! You gained ".. config.trys .." SKILL TRYS from the SKILL SCROLL!.")
elseif getPlayerLevel(cid) <= config.maxlvl and getPlayerWeaponType(cid) == WEAPON_CLUB then
doPlayerAddSkill(cid, SKILL_CLUB, 1)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,TALKTYPE_BROADCAST, "CONGRATULATIONS! You gained ".. config.trys .." SKILL TRYS from the SKILL SCROLL!.")
elseif getPlayerLevel(cid) <= config.maxlvl and getPlayerWeaponType(cid) == WEAPON_DISTANCE then
doPlayerAddSkill(cid, SKILL_DISTANCE, 1)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid,TALKTYPE_BROADCAST, "CONGRATULATIONS! You gained ".. config.trys .." SKILL TRYS from the SKILL SCROLL!.")
elseif getPlayerLevel(cid) >= config.maxlvl then
doPlayerSendCancel(cid, "Your level is too high.")
end
return TRUE
end