X_Anero
New Member
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.
Last edited: