• 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!

Item Gives Stats[HELP]

BlackList

PassingWrath.us
Joined
Aug 30, 2007
Messages
133
Reaction score
26
Hello,
Well I am just looking for an item that when used on a weapon will upgrade a certain stat. I have a base script I've been trying to use, but I am returned with an error "Item not found!"

Here is the code.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getItemWeaponType(uid) == 1 or 2 or 3 then
		doItemSetAttribute(uid,"defense",1)
	end
	return false
end

If it matters, I'm using the latest 0.3.7.
 
Ok, not sure if this works, I've just started back scripting today, after quiting for along time. But might as well give it a try, and I'm using J.Dre's idea of "teaching" by using the picture, if the script doesn't work just tell me and I'll try my best to fix it! :D

Lua:
	function onUse(cid, item, frompos, item2, topos)

if(isInArray({1, 2, 3}, getItemWeaponType(uid))) then
		doItemSetAttribute(item.uid,"defense",1)
	end
	return false
end
 
Last edited:
Lua:
if getItemWeaponType(uid) == 1, 2 or 3 then
What is this line? Because that's certainly not a lua syntax.

Correct way:

Lua:
if(isInArray({1, 2, 3}, getItemWeaponType(uid))) then
 
It's purpose was to check if item is weapon. But thanks for correcting me. I didn't realize it was wrong, then again. I don't script a lot :eek: But give me a second and I'll check it out :) Thanks for the help btw!

- - - Updated - - -

Well I am getting an error in console, different then the one I had before. I am getting onUse, Thing not found. Good try tho!
 
Back
Top