Amare Aeternam
New Member
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
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