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

Player can't go into teleport

VirrageS

←•†ĿuĀ && ©¤¤•→
Joined
May 30, 2010
Messages
984
Reaction score
63
Location
Poland
Hello :thumbup:

I looking for script. So I player don't have storage (2000) then player can't go into teleport.
I tried to make it but don't work. Here is script:

Lua:
function onStepIn(cid, item, fromPosition, item2, toPosition)
	if (item.uniqueid == 40000) then
		if (getCreatureStorage(cid, 2000) == -1) then
			doTeleportThing(cid, fromPosition)
			doPlayerSendCancel(cid, "Sorry, You don't have required thing.")
		end
	end
end

Can someone fix it??
I will be very thankful. Rep of course.
 
Code:
function onStepIn(cid, item, fromPosition, item2, toPosition)
	if item.uniqueid == 40000 and getCreatureStorage(cid, 2000) == -1 then
			doTeleportThing(cid, fromPosition)
		else
			doPlayerSendCancel(cid, "Sorry, You don't have required thing.")
		end
	return TRUE
end
 
Last edited:
Lua:
function onStepIn(cid,item,toPostion,itemEx,fromPosition)
local s = 2000
	if getPlayerStorageValue(cid,s) > 0 then
		doTeleportThing(cid,fromPosition)
		doSendMagicEffect(getThingPos(cid),10)
		doPlayerSendCancel(cid,'You can\'t enter here with a mount.')
	end
	return true
end

works for me, TFS 0.3.6pl1, using actionid.
 
I want that player can't enter to teleport (maybe it works for tile but not for teleport).

(But I these script player can enter <_<).
 
set the uid to the tile. dont put a destination to the portal
Code:
function onStepIn(cid, item, fromPosition, item2, toPosition)
	if (item.uniqueid == 40000) and (getCreatureStorage(cid, 2000) == -1) then
			doTeleportThing(cid, fromPosition)
			doPlayerSendCancel(cid, "Sorry, You don't have required thing.")
		else
doTeleportThing(cid, {x = 750, y = 673, z = 7})
	end
end
 
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	local storage = xxxx
	if getPlayerStorageValue(cid, storage) < 0 then
		doTeleportThing(cid, fromPosition, false)
	end
	
	return true
end
 
set the uid to the tile. dont put a destination to the portal
Code:
function onStepIn(cid, item, fromPosition, item2, toPosition)
	if (item.uniqueid == 40000) and (getCreatureStorage(cid, 2000) == -1) then
			doTeleportThing(cid, fromPosition)
			doPlayerSendCancel(cid, "Sorry, You don't have required thing.")
		else
doTeleportThing(cid, {x = 750, y = 673, z = 7})
	end
end
But destination to this teleport is already set.

#JDB
Damn it isn't working. (I don't know why :( because with tile it's working perfectly).
 
Try

Lua:
local storage = 2000
local newPos = {x=95,y=114,z=7} ---- The positions were the tp will lead
function onStepIn(cid, item, pos)
if getPlayerStorageValue(cid,storage) == -1 then 
doPlayerSendCancel(cid,"You do not have the required thing")
elseif getPlayerStorageValue(cid,storage) >= 1 then 
doTeleportThing(cid, newPos)
return true
end
end

Then set an uniqueid at actions.xml
 
First, remove the destination of the teleport you want to use in RME (otherwise it will be impossible) and change its uid to '40000', then add this...

specialteleport.lua:
Code:
local newPosition = {x = EDIT, y = EDIT, z = EDIT}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(getCreatureStorage(cid, 2000) == -1) then
		doPlayerSendCancel(cid, "You do not have the required thing.")
		doTeleportThing(cid, lastPosition)
	else
		doTeleportThing(cid, newPosition)
		doSendMagicEffect(newPosition, 
CONST_ME_TELEPORT)
	end

	return true
end

In movements.xml:
Code:
	<movevent type="StepIn" uniqueid="40000" event="script" value="tele.lua"/>
 
Ok so...you want this teleport being able to be used ONLY by the player who created it?
 
Hmm yeah.

But I have script which creating teleport (with actionid or uniqueid). I'm only searching for script which will allow player (teleport's creater) to enter the teleport.
 
Sooo here you are (it's MOD made by me (isn't complete in 100% but working :p)):
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Portal_config" version="1.0" author="VirrageS" contact="otland.net" enabled="yes">

	<config name="Portal_config"><![CDATA[
		setup = {[1] = {level = 1, premium = "false", souls = 0, levelMagic = 0, castTime = 10, portalClosing = "true", portalTime = 10, money = 5, effectType = 45, storage = 20044},
				 [2] = {level = 1, premium = "false", souls = 0, levelMagic = 0, castTime = 10, portalClosing = "true", portalTime = 10, money = 5, effectType = 45, storage = 20044},
				 [3] = {level = 1, premium = "false", souls = 0, levelMagic = 0, castTime = 10, portalClosing = "true", portalTime = 10, money = 5, effectType = 45, storage = 20044},
				 [4] = {level = 1, premium = "false", souls = 0, levelMagic = 0, castTime = 10, portalClosing = "true", portalTime = 10, money = 5, effectType = 45, storage = 20044}}

		dest = {["temple"] = {x = 95, y = 120, z = 7},
				["other"] = {x = 96, y = 125, z = 7},
				["hello"] = {x = 96, y = 125, z = 7}}

		actiid = 500
		unquid = 20000
	]]></config>

	<talkaction words="!portal" event="script"><![CDATA[
		domodlib("Portal_config")
		
		local countdownEvent = {}
		
		function onSay(cid, words, param)

			param = param.explode(param, ',')
			local voc = setup[getPlayerVocation(cid)]

			
			if (param[1] == "info") then
				local tutorialText = '¤ How to create a portal? ¤\n      !portal destination, number of players / closed\n\n          - closed - you can only go into portal\n          - number of player - which can go into portal'
				local destiText = '\n\n\n¤ You can choose one of this destinations: ¤\n    [1] - temple\n    [2] - other\n    [3] - hello'
				local vocaText = '\n\n¤ Your vocation require: ¤\n    - Level: '.. voc.level ..'\n    - Magic Level: '.. voc.levelMagic ..'\n    - Souls: '.. voc.souls ..'\n    - Money: '.. voc.money ..'\n    - Premium: \"'.. voc.premium ..'\"'
				local abilityText = '\n\n¤ Abilities: ¤\n    - Cast portal: '.. voc.castTime .. '\n    - Portal\'s time '.. voc.portalTime ..'\n    - Closing portal: \"'.. voc.portalClosing ..'\"'
				
				local totalText = tutorialText .. destiText .. vocaText .. abilityText
				doPlayerPopupFYI(cid, '                              [ Portal Info ] \n\n' .. totalText)
				
				doCreatureSay(cid, words .. ' ' .. param[1], TALKTYPE_ORANGE_1)
			elseif (param[1] ~= nil and param[2] ~= nil) then
				if not voc then
					doPlayerSendCancel(cid, 'You don\'t have the required vocation!')
					return true
				end

				if (getPlayerLevel(cid) < voc.level) then
					doPlayerSendCancel(cid, 'You don\'t have the required level!')
					return true
				end

				if (getCreatureStorage(cid, voc.storage) ~= -1) then
					doPlayerSendCancel(cid, 'You\'ve already created a portal!')
					return true
				end

				if (getPlayerMagLevel(cid) < voc.levelMagic) then
					doPlayerSendCancel(cid, 'You don\'t have the required magic level!')
					return true
				end
				
				if (countdownEvent[cid] == nil or countdownEvent[cid] == 0) then
					if (getPlayerMoney(cid) >= voc.money) then
						doPlayerRemoveMoney(cid, voc.money)
					else
						doPlayerSendCancel(cid, 'You don\'t have enough money! You should to have: '.. voc.money ..' golds')
						return false
					end
					
					if (getPlayerSoul(cid) >= voc.souls) then
						doPlayerAddSoul(cid, - voc.souls)
					else
						doPlayerSendCancel(cid, 'You don\'t have enough mana to create portal! You should to have: '.. voc.souls ..'')
						return false
					end
					
					function finalCountdown(cid, countLeft, playerPos)
						if (not isPlayer(cid) or countLeft == 0) then
							if isPlayer(cid) then
								doPlayerSendTextMessage(cid, 19, 'You have created teleport.')
								teleport = doCreateTeleport(1387, dest[param[1]], playerPos)
								doSendMagicEffect(playerPos, voc.effectType)
								doCreatureSetStorage(cid, voc.storage, 1)
								
								function deleteTeleport()
								local teleport = getTileItemById(playerPos, 1387).uid
									if(teleport > 0) then
										doRemoveItem(teleport)
										doCreatureSetStorage(cid, voc.storage, -1)
										doPlayerSendTextMessage(cid, 19, 'Your teleport have outed of energy and colapsed.')
										doSendMagicEffect(playerPos, CONST_ME_POFF)
									end
								end

								if (param[2] == 'closed') then
									doItemSetAttribute(teleport, 'description', 'Go into to this portal only can '.. getCreatureName(cid) ..'.')
									doItemSetAttribute(teleport, 'aid', 1500)
								else
									doItemSetAttribute(teleport, 'description', 'The portal may enter '.. param[2] ..' people left.')
									doItemSetAttribute(teleport, 'aid', actiid + param[2])
								end

								addEvent(deleteTeleport, voc.portalTime * 1000)
							end
							countdownEvent[cid] = 0
							return
						end

						local tmpPos = getCreaturePosition(cid)
						if((tmpPos.x == playerPos.x) and (tmpPos.y == playerPos.y) and (tmpPos.z == tmpPos.z) and (not isPlayerPzLocked(cid))) then
							doSendAnimatedText(getCreaturePosition(cid), 'Count: '.. countLeft ..'', 11)
							local eventId = addEvent(finalCountdown, 1000, cid, countLeft - 1, playerPos)
							countdownEvent[cid] = eventId
						else
							doPlayerSendCancel(cid,'You moved or start fight. You can\'t logout.')
							countdownEvent[cid] = 0
						end
					end
					
					local eventId = addEvent(finalCountdown, 0, cid, voc.castTime, getCreaturePosition(cid))
					countdownEvent[cid] = eventId
				else
					doPlayerSendCancel(cid,'You\'re already casting teleport.')
					return true
				end				
				doCreatureSay(cid, words .. ' ' .. param[1] .. ', ' .. param[2], TALKTYPE_ORANGE_1)
			else
				doPlayerSendCancel(cid, 'You must set param!')
			end
			return true
		end
	]]></talkaction>

	<movement type="StepIn" itemid="1387" event="script"><![CDATA[
		domodlib("Portal_config")

		function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
			--[[if (item.actionid > actiid) then
				doItemSetAttribute(item.uid, 'description', 'The portal may enter '.. (item.actionid - actiid - 1) ..' people left.')
				doItemSetAttribute(item.uid, 'aid', item.actionid - 1)
				if ((item.actionid - actiid) == 1) then
					doPlayerSendTextMessage(cid, 19, 'Your teleport have outed of energy and colapsed.')
					doSendMagicEffect(fromPosition, 53)
					doCreatureSetStorage(cid, voc.storage, -1)
					doRemoveItem(item.uid, 1)
			end]]--
			if (item.actionid == 1500 and getCreatureStorage(cid, 20044) < 0) then
				doTeleportThing(cid, fromPosition)
				doPlayerSendCancel(cid,'You can\'t enter here with a mount.')
			end
			return true			
		end
	]]></movement>

</mod>
 
Last edited:
Ok. In this case I recommend you use 'doCreateItem(1387, 1, playerPos)' instead of 'doCreateTeleport(1387, dest[param[1]], playerPos)'. There are a few more things to change, I'm still checking the script.
 
Ok. In this case I recommend you use 'doCreateItem(1387, 1, playerPos)' instead of 'doCreateTeleport(1387, dest[param[1]], playerPos)'. There are a few more things to change, I'm still checking the script.

That's dumb advice. That function works fine. The script is just shit.
 
Back
Top