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

TalkAction Player Teleport (Configurable) v1.1

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
Nothing Special although my other thread was outdated. :peace:

data/talkactions/talkactions.xml
PHP:
<talkaction log="no" words="/tp" access="0" event="script" value="teleport.lua"/>

data/talkactions/scripts/teleport.lua

Premium, VIP, Level, and Cost [Configurable]
Code:
local destinations = {
	["temple"] = {p = {x=100, y=100, z=7}, l = 10, c = 100, v = 12345},
	["trainers"] = {p = {x=200, y=200, z=7}, l = 20, c = 200, v = 67891},
	["depot"] = {p = {x=300, y=300, z=7}, l = 50, c = 300, v = 23456}
}

function onSay(cid, words, param, channel)
	local tp = destinations[param]
	if(param == "") then
		doPlayerSendCancel(cid, "Command param required.")
		return true
	end
	if(getPlayerMoney(cid) < tp.c) then
		doPlayerSendCancel(cid, "You do not have enough money.")
	elseif(getPlayerLevel(cid) < tp.l) then
		doPlayerSendCancel(cid, "Your level is not high enough.")
	elseif(getPlayerStorageValue(cid, tp.v) == -1) then
		doPlayerSendCancel(cid, "You must have VIP.")
	elseif(isPlayerPzLocked(cid) == true) then
		doPlayerSendCancel(cid, "You are currently in a fight.")
	elseif(getPlayerPremiumDays(cid) < 1) then
		doPlayerSendCancel(cid, "You must have premium.")
	else
		doPlayerRemoveMoney(cid, tp.c)
		doTeleportThing(cid, tp.p)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported to ".. param ..".")
	end
	return true
end
 
Last edited:
ey kool, but what's the point of using short variable names??
 
Nothing, it just allowed to script a little faster.
Lazy :p
 
Last edited:
Idea

Code:
function onSay(cid, words, param, channel)
	local destinations = {
		["temple"] = {p = {x=100, y=100, z=7}, l = 10, c = 100, s = [COLOR="Red"]XXXX[/COLOR]},
		["trainers"] = {p = {x=200, y=200, z=7}, l = 20, c = 200, s = [COLOR="Red"]XXXX[/COLOR]},
		["depot"] = {p = {x=300, y=300, z=7}, l = 50, c = 300, s = [COLOR="Red"]XXXX[/COLOR]}
	}
	local tp = destinations[param]
        if(param == "") then
		doPlayerSendCancel(cid, "Command param required.")
                return true
        end
	if(getPlayerMoney(cid) < tp.c) then
		doPlayerSendCancel(cid, "You do not have enough money.")
        elseif(getPlayerLevel(cid) < tp.l) then
		doPlayerSendCancel(cid, "Your level is not high enough.")
        elseif(getPlayerStorageValue(cid) < tp.s) then
		doPlayerSendCancel(cid, "You aren't VIP.")
	elseif(isPlayerPzLocked(cid) == true) then
		doPlayerSendCancel(cid, "You are currently in a fight.")
	else
		doPlayerRemoveMoney(cid, tp.c)
		doTeleportThing(cid, tp.p)
		doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have successfully teleported to ".. param ..".")
	end
	return true
end

Can edit this for get X storage value. Great for VIP players with vip storage :D
 
@Up,
Yea...umm good work :thumbup:
 
Nice work JDB,can u make this script work only w/ premium accounts?
 
would be perfect like you use a doll and it tp you to temple/dp/ or whatever
but its a exahust of the doll every that allows you to be tped only every X min, and ya cant tp if your in a fight like this script, anyway nice script
 
Thanks JD i added a rep
but getting a error on console
bug1q.png

0.3.6
 
Well i dont know,its a bug but when the monster attk/ you u can teleport with battle.
I try add this:
PHP:
elseif getCreatureCondition(cid, CONDITION_INFIGHT) == 1 then 
	doPlayerSendCancel(cid, "You are currently in a fight.")

but no sucess.
 
Well i dont know,its a bug but when the monster attk/ you u can teleport with battle.
I try add this:
PHP:
elseif getCreatureCondition(cid, CONDITION_INFIGHT) == 1 then 
	doPlayerSendCancel(cid, "You are currently in a fight.")

but no sucess.
TFS version ??
If you use TFS 0.3 or newer, remove " == 1"
 
YESS! Now working fine! Thanks JDB and Cykotitan you dudes are the best helpers and scripters from otland.
 
YESS! Now working fine! Thanks JDB and Cykotitan you dudes are the best helpers and scripters from otland.
No, there are better scripters out there altough most of them aren't as helpful.
 
the script works good but 1 downside to it , when u type /tp lol and the town dousnt exist u get this

[16/09/2010 16:59:46] [Error - TalkAction Interface]
[16/09/2010 16:59:46] data/talkactions/scripts/teleport.lua:eek:nSay
[16/09/2010 16:59:46] Description:
[16/09/2010 16:59:46] data/talkactions/scripts/teleport.lua:13: attempt to index local 'tp' (a nil value)
[16/09/2010 16:59:46] stack traceback:

is there a way to get that out of there?
 
Back
Top