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

Lua Simple Question

kapka

New Member
Joined
Aug 3, 2012
Messages
58
Reaction score
0
Hi, i have one question. i want to do some script which add to player spell when he pull pull the lever, if lever's id is 5555 (example) how i have to write this in script that only this one level will add this spell, not every lever with id 5555? i have to add uid? but how?
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 2221 and item.itemid == 1945 or item.itemid == 1946 then
		if not getPlayerLearnedInstantSpell(cid, "Death Strike") then -- just change "Death Strike" to your spell name
			doPlayerLearnInstantSpell(cid, "Death Strike")
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have learned Death Strike spell!.')
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have already learned this spell')
		end
	end
		if item.itemid == 1945 then doTransformItem(item.uid, item.itemid + 1)
		else doTransformItem(item.uid, item.itemid -1)
		end
	return TRUE
end
And in map editor click properties on lever and set UniqueID to 2221 (or other number, but if you want diff number, you have to change this: if item.uid == 2221 to your number)
 
oh thanks for all script, just was asking what about this uid, but know it. Thanks

EDIT

can u tell me yet why after item.uid and item.itemid are 2 of =? not only 1

- - - Updated - - -

upp
 
Last edited:
It means compare variables. (if var1 is the same as var2)

Correct.

The == is a comparison operator, you're comparing (to see if they are equal) a value on the left side of the == with the value on the right side of the ==, it will return true or false.
The = is an assignment operator, you're assigning a value to variable. The left side of the = is a variable in which will hold the value that is on the right side of the =.
 
Back
Top