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

Citizen Door Access

The Mapper

Just Imagine
Joined
Jul 22, 2009
Messages
182
Reaction score
2
I need a door that can only be opened by citizens from certain city
Thanks!
 
I didn't tested this script since i have only 1 town on my server but I think it should work.
Use for this a gate of expertise so that only 1 person can pass each time.

xxxx is the itemid of the gate of expertise.
yyyy is the uniqueid of the gate of expertise.
z is the town id.


Code:
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == xxxx and item.uid == yyyy then
        if getPlayerTown(cid) == z then
        doPlayerSendTextMessage(cid, 22, "Your text.")
        pos = getPlayerPosition(cid)
            doTransformItem(item.uid,item.itemid+1)
				playerpos = getPlayerPosition(cid)
				doorpos = {x = frompos.x, y = frompos.y, z = frompos.z, stackpos = 253}
				if playerpos.y == doorpos.y + 1 and playerpos.x == doorpos.x then
					doMoveCreature(cid, 0)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y then
					doMoveCreature(cid, 1)
				elseif playerpos.y == doorpos.y - 1 and playerpos.x == doorpos.x then
					doMoveCreature(cid, 2)
				elseif playerpos.y == doorpos.y and playerpos.x == doorpos.x + 1 then
					doMoveCreature(cid, 3)
				elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y - 1 then
					doMoveCreature(cid, 4)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y - 1 then
					doMoveCreature(cid, 5)
				elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y + 1 then
					doMoveCreature(cid, 6)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y + 1 then
					doMoveCreature(cid, 7)
				end
            else
                    doPlayerSendTextMessage(cid,22,'Your text.')
            end
        return 1
end
end

actions.xml
Code:
<action uniqueid="yyyy" script="namescript.lua" />

Edit: tested it meanwhile and it is working on TFS 0.3.6
 
Last edited:
Back
Top