ConAn Edujawa
Member
- Joined
- Feb 23, 2015
- Messages
- 457
- Reaction score
- 17
hello guys im use 0.4
and i use this script and want add items check
want make this script work with items for knights only
i make this script add 4 hp for knight items and 2 for mage items and 3 for paladin items
all i need code to check if items register in movements for knight return true if not return false
and i use this script and want add items check
want make this script work with items for knights only
i make this script add 4 hp for knight items and 2 for mage items and 3 for paladin items
all i need code to check if items register in movements for knight return true if not return false
Lua:
local conf = {
maxSlotCount = 2,
perecent = {min = 1, max = 10}, -- od ile % do ilu % ma dawac bonusu
ignoredIds = {}
}
function choose(...) --- Function by mock.
local arg = {...}
return arg[math.random(1,#arg)]
end
function isArmor(uid) -- Function by Mock the bear.
if getItemInfo(uid.itemid).armor ~= 0 and getItemWeaponType(uid.uid) == 0 then
return true
end
return false
end
function getSlotCount(nam)
local c = 0
for _ in nam:gmatch('%[(.-)%]') do
c = c + 1
end
return c
end
function onUse(cid, item, fromPosition, itemEx, toPosition) -- Script by mock the bear (MTB)
if not checkExhausted(cid, 429, 1) then
return true
elseif item.uid == 0 or item.itemid == 0 then
return false
elseif isInArray(conf.ignoredIds, itemEx.itemid) or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5)
or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx))
or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then
doPlayerSendTextMessage(cid, 24, "You can\'t open a slot on this item.")
return true
elseif isCreature(itemEx.uid) then
return false
end
local nam = getItemName(itemEx.uid)
if getSlotCount(nam) < conf.maxSlotCount then
local l = choose('hp', 'mp', 'ml', 'cas')
local p = math.random(conf.perecent.min, conf.perecent.max)
doSendMagicEffect(toPosition, 30)
nam = nam..' ['..l..'.+'..p..'%]'
doSendAnimatedText(toPosition, l..' '..p..'%', 120)
doItemSetAttribute(itemEx.uid, 'name', nam)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, 24, "You cant open a slot on this item.")
end
return true
end
Last edited: