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

Action + Movements - Passport passage

X_Anero

New Member
Joined
Apr 10, 2013
Messages
74
Reaction score
1
Location
United Kingdom

Today i would like to present a Passport script:
Tested on: TFS 0.3.6 and 0.4 Dev

setPlayerStorageValue(cid, 22201,1) - 22201 is the StorageID after using the Passport
if item.itemid == 1954 then - Passport Item ID. (1954 = Paper)

What does it do?.

The script allows a player that has used an Item (Passport) to enter the ship (Movements script).
If the player has not used the (Passport Item) then he will get a return message.
Item can be inserted in (Donation shop) on your ot, or can be available in normal inGame store.

So, lets get to the Script -

In Actions/scripts create a file called passport.lua

Lua:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 1954 then

local playerpos = getCreaturePosition(cid)

doRemoveItem(item.uid,1)
setPlayerStorageValue(cid,22201,1)

doSendMagicEffect(playerpos, 12)
doCreatureSay(cid, "Congratulation!, You have verified your passport, now you may enter selected ships!.", TALKTYPE_ORANGE_1)
end
end

In Actions.xml Add a below line
Lua:
<action itemid="1954" script="passport.lua" />


Now Movements...
In movements/scripts create a file called pasfloor.lua

Lua:
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) == TRUE then
	if getPlayerStorageValue(cid, 22120) == -1 then
		doTeleportThing(cid, fromPosition, FALSE)
		doPlayerSendTextMessage(cid,22, "You cannot enter the ship without a passport!.")
		doSendMagicEffect(getPlayerPosition(cid), 2)
		else
		doPlayerSendTextMessage(cid,22, 'Your passport has been verified, you may enter the ship!.')
		doSendMagicEffect(getPlayerPosition(cid), 22)
	end
end
	return TRUE
end

In Movements.xml add below line -
Lua:
	<movevent type="StepIn" tileitem="0" itemid="9200" event="script" value="pasfloor.lua"/>

itemid="9200" - Floor ID, Make sure you don't use it Anywhere else.


Some Images (Presentation):

Before using the Item-



Using the Item-



After the item being used.-


Credits to: X_Anero
This might come in handy for somebody
Kind Regards,
X_Anero
 
Last edited:
could we set a uniqueID instead of tile id?

Yes, you can use this:

Lua:
local config = {
	storage = 12345
}

local message = ""
function onStepIn(cid, item, position, fromPosition, toPosition)
	local k = item.actionid == 1200
	if(k and isPlayer(cid)) then
		if(getCreatureStorage(cid, config.storage) < 0) then
			doTeleportThing(cid, fromPosition, true)
			doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
			message = "You cannot enter without your passport."
		else
			message = "Your passport has been verified. Welcome aboard, " .. getCreatureName(cid) .. "."
		end
	end
	return doCreatureSay(cid, message, TALKTYPE_MONSTER), true -- If you debug, use TALKTYPE_ORANGE_1 instead.
end
 
Back
Top