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

TalkAction [Easy Configurable] Player Teleport to configurable cities/house for cash w/exhaustio

Nubaza

LUA Scripter
Joined
Jun 5, 2011
Messages
330
Solutions
1
Reaction score
21
Location
New Zeland
Hello otLand.net!
I'm chavoz and i'm presenting a script... well, the title say all :p


This script is for the players, with the command !tp or another, the player can teleport to configurable places or his house... Also u can configure the cash needed and the time of exhaustion (in seconds)!
Is really easy configurable, well, let's see it:



Add this tag to talkactions.xml:

Code:
	<talkaction words="!tp" event="script" value="tpAllCitys.lua"/>

Later create a LUA file called tpAllCitys.lua, put this inside:

Lua:
-- script made by chavoz --
----- otLand.net -----


local cash = 10000 -- u can modify the prize (actual 1cc)
local cdtele = 900 -- the seconds of cooldown (900=15min)
local etele = 9499 -- isn't necessary to change

local config = {
premium = false, -- if is needed be premium to use this teleport (true or false)
battle = true	-- if is needed be without battle to use (true or false)
}

local places = {
[1] = {name = "Enigma", id = 1},
[2] = {name = "Infernium", id = 2},
[3] = {name = "Desert", id = 3},
[4] = {name = "Ice", id = 4},
[5] = {name = "Thais", id = 5},
}

function onSay(cid, words, param)

   
	if exhaustion.get(cid, etele) and exhaustion.get(cid, etele) > 0 then
	tempo = (exhaustion.get(cid, etele)) / 60
	min = math.floor(tempo)
doPlayerSendTextMessage(cid,27,"You have to wait more "..min.." minutes.")
	return true
	end

	if config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendTextMessage(cid,27,"You can't teleport with fight.")
	return true
	end

	if (param == '') then
		local str = ""
		str = str .. "Existent places: \n\nHouse\n"
			for a = 1, #places do
				str = str..""..places[a].name.."\n"
			end
		doShowTextDialog(cid, 2333, str)
	return true
	end

	local lastppos = getThingPos(cid)
	local telepos = {}
	local myplace = ""
	local townid = 0

	if string.lower(param) == "house" then

		if not getHouseByPlayerGUID(getPlayerGUID(cid)) then
			doPlayerSendTextMessage(cid,27, "You don't own a house.")
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		return true
		end

		telepos = getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid)))
		myplace = "house"
           effect = CONST_ME_TELEPORT

	else
effect = CONST_ME_TELEPORT

		for x = 1, #places do
			if string.find(string.lower(places[x].name), string.lower(param)) then
				townid = places[x].id
				myplace = places[x].name
			end
		end

		if myplace == "" then
doPlayerSendTextMessage(cid,27,"Sorry, this place don't exist.")
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		return true
		end

	end

	if myplace ~= "" and townid > 0 then
		telepos = getTownTemplePosition(townid)
	end

if doPlayerRemoveMoney(cid, cash) == TRUE then

	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)

	doTeleportThing(cid, telepos, false)

	local pos2 = getClosestFreeTile(cid, getPosByDir(getThingPos(cid), SOUTH))

	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)

	doCreatureSay(cid, "Teleport to "..myplace.."!", TALKTYPE_MONSTER)
doPlayerSendTextMessage(cid,27,"You have teleported to "..myplace.." for "..cash.." gps!")
doPlayerSendTextMessage(cid,27,"To use again wait "..cdtele.." seconds.")

	doCreatureSetLookDir(cid, SOUTH)

	exhaustion.set(cid, etele, cdtele)

else
doPlayerSendTextMessage(cid,27,"You haven't enough money ("..cash.." gps)!")
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

return true
end

Easy Configuration:

Lua:
-- script made by chavoz --
----- otLand.net -----


local cash = 10000 -- u can modify the prize (actual 1cc)
local cdtele = 900 -- the seconds of cooldown (900=15min)
local etele = 9499 -- isn't necessary to change

local config = {
premium = false, -- if is needed be premium to use this teleport (true or false)
battle = true	-- if is needed be without battle to use (true or false)
}

local places = {
[1] = {name = "Enigma", id = 1},
[2] = {name = "Infernium", id = 2},
[3] = {name = "Desert", id = 3},
[4] = {name = "Ice", id = 4},
[5] = {name = "Thais", id = 5},
}
Well, to edit the places u can see the cities of your server in the Remeres Map Editor, press Ctrl+T and it will show you all the towns of your server and the TOwn ID...
To add 1+ place u can add this:
Code:
[6] = {name = "Your town name", id = TOWN ID},

Credits:
chavoz (me) 70%
brun123 (xtibia.com) 30% (he created the base script for a pokemon server)
 
Last edited:
you can put to save the location where the player uses the command "!teleport back" so he came back, the place where he used to command.

+++Rep you!
 
@Elsab3 search for that line:
Lua:
battle = true -- if is needed be without battle to use (true or false)
}
U can configure it.. xd
 
help me, you can put to save the location where the player uses the command "!teleport back" so he came back, the place where he used to command.
 
can anyone answer me?

Lua:
local config = {
premium = false, -- if is needed be premium to use this teleport (true or false)
battle = true -- if is needed be without battle to use (true or false)
}

You can choose so you cant use the command when you are in battle. But it wont check if you are in PZ
 
Lua:
local config = {
premium = false, -- if is needed be premium to use this teleport (true or false)
battle = true -- if is needed be without battle to use (true or false)
}

You can choose so you cant use the command when you are in battle. But it wont check if you are in PZ
I thought so, but I was not sure and I do not have access to TFS now to check it out. You know the Function which will check if the player stand in Protection Zone? ^_^
 
I thought so, but I was not sure and I do not have access to TFS now to check it out. You know the Function which will check if the player stand in Protection Zone? ^_^

try something like:

Lua:
getTilePzInfo(pos)
getTileZoneInfo(pos)

Idk really ;p
 
Ok, thanks ;) I'll probably start new thread in Request, maybe someone will be able to help me.
 
Back
Top