• 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 Help with lever script

Amare Aeternam

New Member
Joined
Aug 19, 2009
Messages
26
Reaction score
1
Location
That van outside!
Well, I've been working on a script that teleports a player only if they don't have certain items on them. (stops people from stealing game pieces) I'm not sure whats wrong so some help would be great :p

Code:
local baditems = { 
	(2638), --All the items you dont want through the door
	(2639),
	(2624),
	(2625),
	(2642),
	(2643),
	(2644),
	(2645),
	(2646),
	(2626),
	(2627),
	(2628),
	(2629),
	(2630),
	(2631)
}
local maxitems = (#baditems)
local currentitem = 1; --No Touchey
local turnbackdestination = {x=1189, y=1077, z=8} --Location where the player is teleported if he/she has a bad item
local destination = {x=1189, y=1067, z=8} -- Location to continue
local warningmessage = "Put back the game pieces :(" --Message sent to player when teleported
local baditem = 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
	while (currentitem <= maxitems)
		if((getPlayerItemCount(cid, baditems[currentitem])) > 0) then
			doTeleportThing(cid,turnbackdestination)
			doSendPlayerTextMessage(cid, MESSAGE_INFO_DESCR, warningmessage)
			return TRUE
		end
		currentitem = currentitem + 1
	end
	doTeleportThing(cid,destination)
end
 
Back
Top