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

Enter to tp => open door

Michaeel

New Member
Joined
Mar 6, 2009
Messages
272
Reaction score
1
Hey, i need script: when someone enter to special teleport then he will be able to pass by special door
thanks
 
bump
I need script, if someone enter to TP with unique/actionID then he will be able to pass door with any unique/action ID.
Thanks
 
or another way. when someone enter to tp with uid then he got storagevalue and only with this can pass by door. is it possible to do? ;/
 
You could modify your data/movements/scripts/citizen.lua:
Code:
[B][COLOR="Red"]local t = {
	-- position of teleporter, storage key, storage value
	[{x=33000, y=31000, z=7}] = {20000, 1}
}
[/COLOR][/B]
function onStepIn(cid, item, [B][COLOR="Red"]pos[/COLOR][/B], fromPosition)
	if(item.actionid > 30020 and item.actionid < 30100) then
		local townId = (item.actionid - 30020)
		doPlayerSetTown(cid, townId)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
[B][COLOR="Red"]	else
		for _pos, sk in pairs(t) do
			if pos.x == _pos.x and pos.y == _pos.y and pos.z == _pos.z then
				setPlayerStorageValue(cid, sk[1], sk[2])
				return true
			end
		end[/COLOR][/B]
	end

	return true
end
Then just set the same actionID on the door as the storage key you used in this script for that teleport.
 
Maybe im doing something wrong but it doesn't work.
I need something like that:
Code:
function onUse(cid, item, frompos, item2, topos)

   	if item.uid == 4073 then
   		queststatus = getPlayerStorageValue(cid,4072)
   		if queststatus == -1 then
   		setPlayerStorageValue(cid,4072,1)

It works - when someone USE uniqueID 4073 then he will get storagevalue4072 and he will be able to open door with aID 4072.
I need one change - when someone step in uID 4073 then he will get storagevalue4072 and he will be able to open door with aID 4072.

can someone to that?
thanks
 
Because I don't understand this script.
At first I don't know where i should put it, to movements or actions.
second- I don't want "doPlayerSetTown(cid, townId)" because.. after death he will be teleported to this place (?)
Can someone do what i wrote in 6th post? http://otland.net/706655-post6.html
 
Awesome! \o/ It works!
Code:
local t = {
	-- position of teleporter, storage key, storage value
	[{x=904, y=1236, z=6}] = {15294, 1}
}

function onStepIn(cid, item, pos, fromPosition)
	if(item.actionid > 31001 and item.actionid < 31100) then
	else
		for _pos, sk in pairs(t) do
			if pos.x == _pos.x and pos.y == _pos.y and pos.z == _pos.z then
				setPlayerStorageValue(cid, sk[1], sk[2])
				return true
			end
		end
	end

	return true
end

Now what should I do if i want script: if someone enter to 'special' tp then he will be able to enter next 'special' tp.
it works for door but not for teleport :( i tried to put on second special tp actionID 15294 but everyone can enter..
 
let me show you example for a tp(1) that you cant pass on it unless you have passed on a tp(2) before.

script for tp(2) that allow you to pass on the other one.Go to movement-->scripts then creat a file called specialtp(2).lua
Lua:
local storage = 1111    --the number that wehn ppl have he can pass on the other special tp
local pos = {x=1000,y=1000,z=7} --pos where player will be teleported when he pass on tp
function onStepIn(cid, item, position, fromPosition)
 if getPlayerStorageValue(cid,storage) == 2 then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have already passed here ")
	doTeleportThing(cid, fromPosition)
 end
 if getPlayerStorageValue(cid,storage) ~= 2 then
    setPlayerStorageValue(cid,storage,2)
    doTeleportThing(cid,pos)
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_TELEPORT)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have the power to pass on another special tp!  :) ")
 end

end

And then go to movement.xml and put this line
Lua:
---xxxx = the unique id of the special tp number 2 you put it in map
<movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>
Then
the next tp(1) <player can enter when he had passed on the other one>.Go to movement-->scripts and creat file specialtp(1).lua

Lua:
local storage = 1111    ---like the one you put in the script before
local pos = {x=1000,y=1000,z=7} --pos where player will be teleported when he pass on tp
function onStepIn(cid, item, position, fromPosition)
 if getPlayerStorageValue(cid,storage) == 2 then
    doTeleportThing(cid,pos)
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_TELEPORT)
 else
   doTeleportThing(cid, fromPosition)
   doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You cant pass! ")
 
 end
 return true
end
now go to movement.xml and put this line
Lua:
---xxxx = the unique id of the special tp number 1
<movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>

Hope you got it
 
Last edited:
let me show you example for a tp(1) that you cant pass on it unless you have passed on a tp(2) before.

script for tp(2) that allow you to pass on the other one.Go to movement-->scripts then creat a file called specialtp(2).lua
Lua:
local storage = 1111    --the number that wehn ppl have he can pass on the other special tp
local pos = {x=xxxx,y=xxxx,z=x} --pos where player will be teleported when he pass on tp
function onStepIn(cid, item, position, fromPosition)
 if isPlayer(cid) == TRUE then
    setPlayerStorageValue(cid,storage,2)
    doTeleportThing(cid,pos)
    doSendMagicEffect(getPlayerPosition(cid,CONST_ME_TELEPORT)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have the power to pass on another special tp!  :) "")
  return true
 end
end

And then go to movement.xml and put this line
Lua:
---xxxx = the unique id of the special tp number 2 you put it in map
<movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>
Then
the next tp(1) <player can enter when he had passed on the other one>.Go to movement-->scripts and creat file specialtp(1).lua

Lua:
local storage = 1111    ---like the one you put in the script before
loca pos = {x=xxxx,y=xxxx,z=x} --pos where player will be teleported when he pass on tp
function onStepIn(cid, item, position, fromPosition)
 if getPlyaerStorageValue(cid,storage) == 2 then
    doTeleportThing(cid,pos)
    doSendMagicEffect(getPlayerPosition(cid,CONST_ME_TELEPORT)
 else
   doTeleportThing(cid, fromPosition)
   doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You cant pass! "")
 return true
 end
end
now go to movement.xml and put this line
Lua:
---xxxx = the unique id of the special tp number 1
<movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>

Hope you got it

getPlyaerStorageValue

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have the power to pass on another special tp! :) " ")

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You cant pass! " ")

:p
 
Back
Top