What's new

!t 1,2,3

Status
Not open for further replies.

xxxfilipekxxx1

Advanced User
Joined
Jul 1, 2009
Messages
215
Reaction score
5
Age
32
Witam szuka?em du?o na necie tzw. komendy !t np.1 (!t 1) i wtedy gracza teleportuje do danego miejsca , ale ?eby gracz nie m?g? tylko tego u?y? jak jak w pz.
Poda? by kto? ten skrypt tutaj ?
 

Marvixx

Advanced User
Joined
Apr 26, 2009
Messages
436
Reaction score
58
Age
29
Odp: !t 1,2,3

Mo?esz zmieni? komend? /twon na !t wtedy mo?esz da? TP ale to z PZ to b?dzie trzeba g??biej poszuka?.

Zapewne chodzi ci o to jak na war ots !t 1 ?wi?tynie itp ;>


Pozdrawiam.
 

xxxfilipekxxx1

Advanced User
Joined
Jul 1, 2009
Messages
215
Reaction score
5
Age
32
Odp: !t 1,2,3

Mi chodzi ?eby gracz m?g? u?ywa? komendy !t 1 i wtedy go teleportuje do temple nr.1,
!t 2 do temple nr. 2 itd.
I ?eby gracz m?g? u?ywa? komendy tylko jak stoi w PZ.
 

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: !t 1,2,3

PHP:
-- by Sassin

function onSay(cid, words, param, channel)
	local master = false
	local playerpos = getPlayerPosition(cid)
	local pz = getTilePzInfo(playerpos)
	
	if pz == false then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not in PZ")
		return true
	end
	

	local tmp = getPlayerTown(cid)
	if(not master) then
		tmp = t[1]
		if(not tonumber(tmp)) then
			tmp = getTownId(tmp)
			if(not tmp) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
				return true
			end
		end
	end

	local pos = getTownTemplePosition(tmp, false)
	if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
		return true
	end

	pos = getClosestFreeTile(tid, pos)
	if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
		return true
	end

	tmp = getCreaturePosition(tid)
	if(doTeleportThing(tid, pos) and not isPlayerGhost(tid)) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end

	return true
end

PHP:
	<talkaction words="/t" event="script" value="plik.lua"/>

Prosz? - my?l? ?e powinno dzia?a?. I je?eli gracz napisz? /t nie podaj?c id miasta to zostanie teleportowany to pierwszego.
 
Last edited:

xxxfilipekxxx1

Advanced User
Joined
Jul 1, 2009
Messages
215
Reaction score
5
Age
32
Odp: !t 1,2,3

w rme doda?em miasta 1,2,3
i jak wpisuje na. /t 1
Wyskakuje mi, ?e cel podr??y jest niedost?pna .
"Destination not reachable."
A w tym skrypcie mo?na ustawia? pos y and x ?
Czy na czym to dok?adnie polega ?
 
Last edited:

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: !t 1,2,3

Doda?e? normalnie pozycje temple w map edytorze? Sam b??d oznacza, ?e na tej kratce co? jest na co nie da si? stan??. Nie da si? dodawa? pozycji poniewa? skrypt sam sprawdza pozycje temple, ale pierw musi by? dodana w map edytorze.

Skopiuj skrypt jeszcze raz, bo znalaz?em ma?y b??d i go poprawi?em, ale on nie wp?ywa? na to, ?e jest taki b??d.
 
Last edited:

xxxfilipekxxx1

Advanced User
Joined
Jul 1, 2009
Messages
215
Reaction score
5
Age
32
Odp: !t 1,2,3

:( Dalej nie dzia?a :(

W rme doda?em 3 Towns o nazwie 1 , 2 , 3

pos"y sprawdza?em czy s? dobre z 5 razy.

W??czy?em silnik wpisa?em /t 1
Wyskoczy?o mi : "Destination not reachable."

i w silniku:
[24/11/2010 15:20:29] [Error - TalkAction Interface]
[24/11/2010 15:20:29] data/talkactions/scripts/!t.lua:eek:nSay
[24/11/2010 15:20:29] Description:
[24/11/2010 15:20:29] (luaGetClosestFreeTile) Creature not found
 

xxxfilipekxxx1

Advanced User
Joined
Jul 1, 2009
Messages
215
Reaction score
5
Age
32
Odp: !t 1,2,3

And :(
[24/11/2010 16:11:16] [Error - TalkAction Interface]
[24/11/2010 16:11:16] data/talkactions/scripts/!t.lua:eek:nSay
[24/11/2010 16:11:16] Description:
[24/11/2010 16:11:16] data/talkactions/scripts/!t.lua:16: attempt to index global 't' (a nil value)
[24/11/2010 16:11:16] stack traceback:
[24/11/2010 16:11:16] data/talkactions/scripts/!t.lua:16: in function <data/talkactions/scripts/!t.lua:3>
^ Teraz wyskakuje ;/
 

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: !t 1,2,3

PHP:
local config = {
	city1pos = {x=453, y=496, z=7, stackpos=1},
	city2pos = {x=1211, y=1221, z=7, stackpos=1}
}
function onSay(cid, words, param)

local playerpos = getPlayerPosition(cid)
local pz = getTilePzInfo(playerpos)

	if pz == true then
		if (param == "1") then
			doTeleportThing(cid, config.city1pos)
			doSendMagicEffect(playerpos,config.effect)
			doSendMagicEffect(config.city1pos,config.effect)

		elseif (param == "2") then
			doTeleportThing(cid, config.city2pos)
			doSendMagicEffect(playerpos,config.effect)
			doSendMagicEffect(config.city2pos,config.effect)
		else
			doPlayerSendCancel(cid,"Not in PZ")
		end
	end
end


PHP:
	<talkaction words="/t" event="script" value="plik.lua"/>

Masz nowy - jak czego? nie ?apiesz to daj zna?, ale ten musi dzia?a? - tu niestety sam musisz podawa? pozycje do skryptu
param == "1"
1 to, to co b?dziesz pisa? po /t
czyli np. /t 1, jak dasz tam g?wno to b?dzie /t g?wno
 

xxxfilipekxxx1

Advanced User
Joined
Jul 1, 2009
Messages
215
Reaction score
5
Age
32
Odp: !t 1,2,3

Ok Dzia?a ;DDD
Tylko napiszesz mi jeszcze jak doda? nast?pn? pozycje ?
Bo co? mi nie idzie ...
 

Sassin

Forum friend
Joined
Jun 13, 2009
Messages
1,281
Reaction score
107
Odp: !t 1,2,3

Dodajesz do kodu pod ostatnim wy?wietlaniem efektu:

PHP:
		elseif (param == "2") then
			doTeleportThing(cid, config.city2pos)
			doSendMagicEffect(playerpos,config.effect)
			doSendMagicEffect(config.city2pos,config.effect)

Parametr ustawiasz sobie jaki chcesz - wed?ug wzoru b?dzie to 3 i potem masz funkcje to po prostu, w ka?dej zmieniasz city2pos na nast?pne odniesienie do tablicy i wed?ug wzoru to b?dzie city3pos

Potem dodajesz do tablicy:

PHP:
city2pos = {x=1211, y=1221, z=7, stackpos=1}

Tu pami?taj, ?eby da? przecinek na ko?cu wszystkich linijek w tablicy pr?cz ostatniej.

zmieniasz zmienn? z city2pos na najlepiej city3pos itd jak b?dziesz dodawa? wi?cej ni? jedno.
 

Unass

Active User
Joined
Jul 21, 2010
Messages
123
Reaction score
22
Odp: !t 1,2,3

lol :) xxxfilipekxxx1 lap latwiejszy skrypt i latwiutko bedziesz mogl sobie ustawic temple position.. Tez go uzywalem na warotsie

data/talkactions/tptotemplex.lua
wklej to
function onSay(cid, words, param, channel)
local posInfo = getTileInfo(getCreaturePosition(cid))
if not posInfo.protection or posInfo.nologout then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can teleport only when you are in depo/temple.")
return TRUE
end
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return TRUE
end
if(tonumber(param) >= 1 and tonumber(param) <= #pozycja) then
doTeleportThing(cid, pozycja[tonumber(param)], TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Temple IDs are from 1 to " .. #pozycja)
end

return TRUE
end

talkactions.xml
<talkaction words="!t" event="script" value="tptotemplex.lua"/>

Potem wejdz do data/lib stworz sobie plik o nazwie war.lua
i dodaj do niego

pozycja = {
{x=1369,y=1235,z=7},
{x=1362,y=1210,z=6},
{x=1334,y=1199,z=6},
{x=1326,y=1232,z=7},
{x=1335,y=1263,z=7},
{x=1383,y=1249,z=6},
{x=1426,y=1265,z=7},
{x=1431,y=1204,z=7},
{x=1429,y=1172,z=7},
{x=1384,y=1174,z=7},
{x=1402,y=1192,z=6},
{x=1379,y=1239,z=7}
}
dp_pos = {x=1098,y=1217,z=8}

oczywiscie tu wpisujesz juz swoje pozycje :)
 
Status
Not open for further replies.
Top