sestorme
Member
LUA:
local function isBow(uid)
uid = uid or 0
if(getItemWeaponType(uid) == WEAPON_AXE) then
return true
end
return false
end
function onSay(cid, words, param, channel)
local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
if(isBow(weapon.uid)) then
local dmg = getItemAttribute(weapon.uid, "attack")
local dmg2 = ((dmg) * 2)
doItemSetAttribute(weapon.uid, "attack", dmg2)
end
return true
end
It works, but:
It only works if item attribute:
doItemSetAttribute(weapon.uid, "attack", dmg2)
Has been previously set using straight value, not gained within a script, like:
doItemSetAttribute(weapon.uid, "attack", 123)
Otherwise it returns an error. It does work absolutely fine afterwards. Is there any chance to fix it or I need to build an array for all items?
ps. It's OnSay for testing purposes.