Witam wszystkich. Od pewnego czasu posiadam skrypt polegaj?cy na teleportacji postaci jak i celu w pewne miejsce, jednak?e w silniku pojawiaj? si? b??dy i skrypt ten nie dzia?a tak jak powinien. Zak?adaj?c ten temat licze, ?e uda znale?? mi si? jakie? rozwi?zanie. By?bym naprawd? wdzi?czny za pomoc z Waszej strony.
Skrypt i b??dy podaj? poni?ej.
Skrypt wygl?da tak:
B??dy po u?yciu spella:
Pozdrawiam.
Skrypt i b??dy podaj? poni?ej.
Skrypt wygl?da tak:
Code:
function onCastSpell(cid, words, param)
local waittime = 5 -- exhaust time
local storage = 5560
local pos = getCreaturePosition(cid)
from = {x=pos.x, y=pos.y, z=pos.z}
to = {x = 1235, y = 772, z = 7} -- where tp (players)
to1 = {x = 1235, y = 773, z = 7} -- where tp(caster)
area1 = {x = 1231, y = 769, z = 7} -- top edge
area2 = {x = 1239, y = 775, z = 7} -- lower edge
level = 10 -- Level needed
ppos = getCreaturePosition(cid)
pl1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}
pl2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, "U need lvl.")
return true
end
function back(cid)
if isInArea(getCreaturePosition(cid), area1, area2) then
doTeleportThing(cid, from)
end
end
function go(cid)
if isInArea(getCreaturePosition(cid), pl1, pl2) then
doTeleportThing(cid, to)
end
end
function gos(cid)
if isInArea(getCreaturePosition(cid), from, from) then
doTeleportThing(cid, to1)
end
end
if exhaustion.check(cid, storage) == false then
for _, pid in ipairs(getPlayersOnline()) do
addEvent(back, 5000, pid) -- time to return to the place that used spell
addEvent(go, 200, pid)
addEvent(gos, 1, pid)
doSendMagicEffect(getCreaturePosition(pid), 63)
doCreatureSay(pid, "now u telep!", TALKTYPE_MONSTER) --- Mensagem
addEvent(setPlayerStorageValue, 10000, pid, 1634, -1)
end
exhaustion.set(cid, storage, waittime)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "you must wait " .. exhaustion.get(cid, storage) .. " second to use it again.")
end
return true
end
B??dy po u?yciu spella:
Code:
[18/11/2014 19:43:53] [Error - Spell Interface]
[18/11/2014 19:43:53] In a timer event called from:
[18/11/2014 19:43:53] data/spells/scripts/attack/tp.lua:onCastSpell
[18/11/2014 19:43:53] Description:
[18/11/2014 19:43:53] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[18/11/2014 19:43:53] stack traceback:
[18/11/2014 19:43:53] data/lib/032-position.lua:2: in function 'isInArea'
[18/11/2014 19:43:53] data/spells/scripts/attack/tp.lua:34: in function <data/spells/scripts/attack/tp.lua:33>
[18/11/2014 19:43:53] [Error - Spell Interface]
[18/11/2014 19:43:53] In a timer event called from:
[18/11/2014 19:43:53] data/spells/scripts/attack/tp.lua:onCastSpell
[18/11/2014 19:43:53] Description:
[18/11/2014 19:43:53] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[18/11/2014 19:43:53] stack traceback:
[18/11/2014 19:43:53] data/lib/032-position.lua:2: in function 'isInArea'
[18/11/2014 19:43:53] data/spells/scripts/attack/tp.lua:28: in function <data/spells/scripts/attack/tp.lua:27>
[18/11/2014 19:43:58] [Error - Spell Interface]
[18/11/2014 19:43:58] In a timer event called from:
[18/11/2014 19:43:58] data/spells/scripts/attack/tp.lua:onCastSpell
[18/11/2014 19:43:58] Description:
[18/11/2014 19:43:58] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[18/11/2014 19:43:58] stack traceback:
[18/11/2014 19:43:58] data/lib/032-position.lua:2: in function 'isInArea'
[18/11/2014 19:43:58] data/spells/scripts/attack/tp.lua:22: in function <data/spells/scripts/attack/tp.lua:21>
Pozdrawiam.