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

Teleport Scroll

Collz

Pandas Go RAWR!!!
Joined
Oct 10, 2008
Messages
2,091
Reaction score
57
Location
New York
Hey, I need a script for a teleport scroll. But I want it to work so that when you click on the scroll, the text box appears and you have to write where you want to go.

For example: To the trainers
f0c9wz.jpg

And when you click ok, it teleports you to the trainers if you're not pzed. Also, if you write 'locations' and press ok, the list of teleporting locations will be messaged to you in your default chat.

Not sure if this is exactly possible, but what ever comes close to this would be great.
 
Lua:
local scroll = 1949 --paper itemid
local places = {
	['trainers'] = {x=95,y=117,z=7},
	['temple'] = {x=200,y=100,z=7},
}

function onTextEdit(cid, item, newText)
	if item.itemid ~= scroll or getPlayerItemById(cid, true, scroll).uid ~= item.uid then
		return true
	end
	
	if isPlayerPzLocked(cid) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_PLAYERISPZLOCKED)
		return true
	end
	
	if isInArray({'locations','location','place','places'},newText:lower()) then
		local i = ''
		for j, k in pairs(places) do
			i = i .. ' [' .. j .. ']'
		end
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can only write these locations to teleport: ' .. i)
		return true
	end
	
	if not places[newText:lower()] then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Invalid location, write "locations" for more info.')
		return true
	end
	
	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	doTeleportThing(cid, places[newText:lower()])
	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	return true
end
XML:
<event type="textedit" name="text" event="script" value="text.lua"/>
Lua:
registerCreatureEvent(cid, "text")

.easy
 
Ty but it still says,
Error: [CreatureEvent::configureEvent] No vaild type for creature event.textedit
Warning: [BaseEvents::loadFromXml] Can not configure event

?

:S
 
I have figured out what it meens but i cant do anything...

The event type "textedit" doesnt exist it says?
And it doesnt work if i write like "login" there instead :S
So i just wonder... What should i do?
 

Similar threads

Back
Top