I need a bit of help here, since I don't want to change the script drastically, I need to know if theres any alternative that I don't know.
The error I'm getting is:
Any type of help is appreciated!
PS: I need to know if my function is okay too, Im new at creating functions at LUA
Lua:
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 isShield(uid) -- Function by Mock the bear.
uid = uid or 0
if getItemWeaponType(uid) == 4 then
return true
end
return false
end
function isBow(uid) -- Function by Mock the bear.
uid = uid or 0
if getItemWeaponType(uid) == 5 and not isItemStackable(uid) then
return true
end
return false
end
function Santirox() -- function by Santi
local t = {
[1] = '10%',
[2] = '20%',
[3] = '30%',
[4] = '40%',
[5] = '50%'
}
for k, v in pairs(t) do
if getPlayerStorageValue(getItemIdByName(itemEx.uid)) == k then
if getPlayerStorageValue(getItemIdByName(itemEx.uid)) < 2 then
return doItemSetAttribute(itemEx.uid, 'description', "Tu arma ha sido upgraded " .. k .. " vez, con un total de " .. v[1] .. "")
else
return doItemSetAttribute(itemEx.uid, 'description', "Tu arma ha sido upgraded " .. k .. " veces, con un total de " .. v[1] .. "")
end
elseif getPlayerStorageValue(getItemIdByName(itemEx.uid)) > 5 then
return doItemSetAttribute(itemEx.uid, 'description', "Tu arma ha sido upgraded " .. k .. " veces, con un total de " .. v[1] .. ", y ha llegado a su maximo")
end
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray({1,2,3},getItemWeaponType(itemEx.uid)) then
doItemSetAttribute(itemEx.uid, 'attack', (getItemInfo(itemEx.itemid).attack*10)/100)
setPlayerStorageValue(cid, getItemIdByName(itemEx.uid), getPlayerStorageValue(getItemIdByName(itemEx.uid))+1)
doRemoveItem(item.uid, 1)
Santirox()
elseif isArmor(itemEx) or isShield(itemEx.uid) then
doItemSetAttribute(itemEx.uid, 'defense', (getItemInfo(itemEx.itemid).defense*10)/100)
setPlayerStorageValue(cid, getItemIdByName(itemEx.uid), getPlayerStorageValue(getItemIdByName(itemEx.uid))+1)
doRemoveItem(item.uid, 1)
Santirox()
elseif isPlayer(itemEx.uid) 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
return doPlayerSendCancel(cid, "Sorry not possible")
end
return true
end
The error I'm getting is:
Code:
[19/01/2011 13:55:54] [Error - Action Interface]
[19/01/2011 13:55:54] data/actions/scripts/other/Upgrade system.lua:-OnUse
[19/01/2011 13:55:54] Description:
[19/01/2011 13:55:54] data/actions/scripts/other/Upgrade system.lua:47: attempt to perform arithmetic on a boolean value
[19/01/2011 13:55:54] stack traceback:
[19/01/2011 13:55:54] data/actions/scripts/other/Upgrade system.lua:47: in function <data/actions/scripts/other/Upgrade system.lua:44>
Any type of help is appreciated!
PS: I need to know if my function is okay too, Im new at creating functions at LUA