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

walkback.lua in movements

hugq

Member
Joined
Mar 17, 2010
Messages
166
Reaction score
9
I have problem with walk through chest. I set uid, aid on chest and nothing - i can walk this on fuc**nk chest :D

Its my simple script:
Lua:
local items =
{
  [5039] = {storage = 5039, reward = 2335, count = 1},
  [5040] = {storage = 5040, reward = 2336, count = 1},
  [5041] = {storage = 5041, reward = 2337, count = 1},
  [5042] = {storage = 5042, reward = 2338, count = 1},
  [5073] = {storage = 5073, reward = 2339, count = 1},
  [5074] = {storage = 5074, reward = 2340, count = 1},
  [5058] = {storage = 5058, reward = 2341, count = 1}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)

local t = items[item.uid]
  if items[item.uid] then
  if(getCreatureStorage(cid, t.storage) < 1) then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. getItemArticleById(t.reward) .. " " .. getItemNameById(t.reward) .. ".")
      doPlayerAddItem(cid, t.reward, t.count)
    doCreatureSetStorage(cid, t.storage, 1)
  else
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It's empty.")
  end
end
return TRUE
end

And my walkback.lua
Lua:
local SPECIAL_QUESTS = {2001}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid) or
		(isContainer(item.uid) and (not isInArray(SPECIAL_QUESTS, item.actionid) and item.uid > 65535) or
		getTileInfo(position).creatures <= 1)) then
			return true
	end

	if(lastPosition.x == 0) then -- player just logged in
		lastPosition = getTownTemplePosition(getPlayerTown(cid))
		doSendMagicEffect(lastPosition, CONST_ME_TELEPORT)
	end

	doTeleportThing(cid, lastPosition, true)
	return true
end

TFS 0.4
 
Try this

Lua:
local SPECIAL_QUESTS = {2001}
 
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then
		return true
	end
 
	if(isContainer(item.uid)) then
		if(not isInArray(SPECIAL_QUESTS, item.actionid) and item.uid > 65535) then
			return true
		end
	elseif(getTileInfo(position).creatures <= 1) then
		return true
	end
 
	if(fromPosition.x == 0) then -- player just logged in
		fromPosition = getTownTemplePosition(getPlayerTown(cid))
		doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
	end
 
	doTeleportThing(cid, fromPosition, true)
	return true
end
 
Back
Top Bottom