• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Thread Closed

Lava Titan

Developer
Joined
Jul 25, 2009
Messages
1,571
Solutions
3
Reaction score
98
Location
Portugal
Hello folks!

Using TFS: 0.3.6 pl1

I'm trying to fix this script but nothing keeps happening.

This script is based on a Weapon Upgrader.
When i use the item 8310 on a weapon:
local id = {11299, 11302, 11301}
This weapon should get 500 attack and 500 defense added on it.
But nothing happens =/


LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local id = {11299, 11302, 11301}
local item1 = getItemAttack(itemEx.uid)

for _,v in pairs(id) do
if(v == itemEx.itemid)then
if item1 <= 45000 then
setItemAttack(itemEx.uid, getItemAttack(itemEx.uid)+ 500)
setItemDefense(itemEx.uid, getItemDefense(itemEx.uid)+500)
doPlayerSendTextMessage(cid, 22, "You successfully upgraded item!")
break
else
doPlayerSendTextMessage(cid, 22, "You already used to many rich upgraders on this weapon!")
end
else
doPlayerSendTextMessage(cid, 19, "You can only upgrade Upgraded Rich Axe, Upgraded Rich Club, Upgraded Rich Sword!")
end
end

Could anyone help me fixing it?
Thanks,
Lava Titan
 
Last edited:
Code:
local id = {11299, 11302, 11301}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for _, v in ipairs(id) do
		if v == itemEx.itemid then
			local k = getItemAttribute(itemEx.uid, 'attack') or getItemInfo(itemEx.itemid).attack
			if k <= 45000 then
				doItemSetAttribute(itemEx.uid, 'attack', k + 500)
				setItemDefense(itemEx.uid, (getItemAttribute(itemEx.uid, 'defense') or getItemInfo(itemEx.itemid).defense) + 500)
				doPlayerSendTextMessage(cid, 22, "You successfully upgraded item!")
			else
				doPlayerSendTextMessage(cid, 22, "You already used to many rich upgraders on this weapon!")
			end
			return true
		end
	end
	return doPlayerSendTextMessage(cid, 19, "You can only upgrade Upgraded Rich Axe, Upgraded Rich Club, Upgraded Rich Sword!")
end
 
Back
Top