• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Use Object and Teleport

Status
Not open for further replies.

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
This script is simple, and is usefull for BIG Rpg maps.
I hope they help somebody. :thumbup:


Action:
Lua:
<action uniqueid="1000" event="script" value="teleport.lua"/>

Script:
Lua:
local cfg = {location = {x=100, y=100, z=7}, vipStatus = 12345}
function onUse(cid, item, fromPos, item2, toPos)
local vipAccess = getPlayerStorageValue(cid, cfg.vipStatus)
local playerPos = getPlayerPosition(cid)
    if vipAccess == 1 then
	doTeleportThing(cid, cfg.location)
	doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been teleported.")
    else
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be a VIP to use this teleport.")
    end
    return TRUE
end
 
Last edited:
nice, keep learning! ;)

A bit more configurable version ;P
Code:
local teleportItems = {
	[1000] = {position = {x=100, y=100, z=7}, message = "Welcome in city!"},
	[1001] = {position = {x=200, y=200, z=7}, message = "Welcome somewhere!"}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local teleport = teleportItems[item.uid]
	if(not teleport) then
		return FALSE
	end

	doTeleportThing(cid, teleport.position)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	if(teleport.message) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.message)
	end
	return TRUE
end
 
I am sure somebody used this...
Reply?
 
Nice!

But why this:
Lua:
local playerPos = getCreaturePosition(cid)
 
@Up,

I had that on there to send a message,
I guess you don't need it anymore,
edited.
 
Updated version, with timer, so you can be automatically teleported back after x seconds.

Code:
local teleportItems = {
	[1000] = {
		position =	{x=100, y=100, z=7},
		backPosition =	{x=100, y=100, z=7},
		message =	"Welcome in city!"},
		backMessage =	"Your visit has been finished!"},
		timer = 	30 * 60 * 1000
	},
	[1001] =
		position =	{x=100, y=100, z=7},
		backPosition =	{x=100, y=100, z=7},
		message =	"Welcome somewhere!"},
		backMessage =	"Your visit has been finished!"},
		timer = 	30 * 60 * 1000
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local teleport = teleportItems[item.uid]
	if(not teleport) then
		return FALSE
	end

	doTeleportThing(cid, teleport.position)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	if(teleport.message) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.message)
	end

	if(teleport.timer) then
		addEvent(teleportBack, teleport.timer, cid, item.uid)
	end
	return TRUE
end

function teleportBack(cid, id)
	if(isPlayer(cid) == FALSE) then
		return
	end

	local teleport = teleportItems[id]

	doTeleportThing(cid, teleport.position)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

	if(teleport.backMessage) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.backMessage)
	end
end
 
Nice I guess...
Kinda weird.

Cool.
 
I wrote this very basic script,
for people to use in a "teleport" server.

Just to get back to the temple, or w/e...
 
add two actions?

Hello,be possible to add three more actions, and only one player? thank you very much
PHP:
local teleportItems = {
	[1000] = {
		position =	{x=100, y=100, z=7},
		backPosition =	{x=100, y=100, z=7},
		message =	"You have ten minutes to kill and loot this boss,else you will lose that change and will be kicked out!"},
		backMessage =	"Your time has been finished!"},
		backMessage1 =	"is empty"},
		timer = 	10 * 60 * 1000
		storage =	6789	-- passes if you have the storage --
		storage1 =	7777    -- if you have the storage you said that you check the quest return backposition --
	},
	[1001] =
		position =	{x=100, y=100, z=7},
		backPosition =	{x=100, y=100, z=7},
		message =	"You have ten minutes to kill and loot this boss,else you will lose that change and will be kicked out!"},
		backMessage =	"Your time has been finished!"},
		backMessage1 =	"is empty"},
		timer = 	10 * 60 * 1000
		storage =	1234	-- passes if you have the storage --
		storage1 =	6666    -- if you have the storage you said that you check the quest return backposition --
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local teleport = teleportItems[item.uid]
	if(not teleport) then
		return FALSE
	end

	doTeleportThing(cid, teleport.position)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	if(teleport.message) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.message)
		setPlayerStorageValue(cid, storage, 1)
		setPlayerStorageValue(cid, storage1, 1)


	end

	if(teleport.timer) then
		addEvent(teleportBack, teleport.timer, cid, item.uid)
	end
	return TRUE
end

function teleportBack(cid, id)
	if(isPlayer(cid) == FALSE) then
		return
	end

	local teleport = teleportItems[id]

	doTeleportThing(cid, teleport.position)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

	if(teleport.backMessage) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.backMessage)
	end
end
 
Last edited:
Status
Not open for further replies.
Back
Top