• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Błąd w addevent

Seminari

Banned User
Joined
Dec 13, 2009
Messages
1,496
Reaction score
34
Location
Poland
Oto część mojego skryptu:
(wykonawcza)

Code:
function onStepIn(cid, item, position, fromPosition)
	
	function kickEvent(cid, item, position, fromPosition) 
		local m={}
			for x=k.from.x, k.to.x do
				for y=k.from.y, k.to.y do
					local v=getTopCreature({x=x, y=y, z=k.from.z}).uid
					if v ~= 0 then
						if isPlayer(v) then
							if getPlayerStorageValue(cid, 3333) > 0 then
							doTeleportThing(cid, k.ogien_pos, true)
							doCreatureSay(cid, 'Dostales kicka.', TALKTYPE_ORANGE_1, false, cid)
							end
						end
						
					end
				end
			end
			
	
	end 
	
	if isPlayer(cid) then
		local k=t[item.uid]
		if getPlayerStorageValue(cid, k.task_storage) ~= 2 then
		doCreatureSay(cid, 'You haven\'t got acces to use this teleport.', TALKTYPE_ORANGE_1, false, cid)
		doTeleportThing(cid, fromPosition, true)
		elseif getPlayerStorageValue(cid, k.task_storage) == 2 then
			local m={}
			for x=k.from.x, k.to.x do
				for y=k.from.y, k.to.y do
					local v=getTopCreature({x=x, y=y, z=k.from.z}).uid
					if v ~= 0 then
						if isPlayer(v) then
							doTeleportThing(cid, fromPosition, true)
							doCreatureSay(cid, 'Someone else is in the room.', TALKTYPE_ORANGE_1, false, cid)
							return
						elseif isMonster(v) then
							table.insert(m, v)
						end
					end
				end
			end
			for i=1, #m do
				doRemoveCreature(m[i])
			end
			doTeleportThing(cid, k.tp)
			doSendMagicEffect(position, CONST_ME_TELEPORT)
			doSendMagicEffect(k.tp, CONST_ME_TELEPORT)
			doCreateMonster(k[1][math.random(#k[1])], k.spawn)
			doSendMagicEffect(k.spawn, CONST_ME_TELEPORT)
			pauseKick = addEvent(kickEvent, c.czas * 1000, cid, k) 
				if c.czas >= (1*60) then
				ile = c.czas / 60
					if c.czas < (2*60) then
					minu = 'minute'
					elseif c.czas < (5*60) then
					minu = 'minuty'
					elseif c.czas >= (5*60) then
					minu = 'minut'
					end
				elseif c.czas < (1*60) then
				ile = c.czas
				minu = 'sekund'
				end
				doCreatureSay(cid, 'Masz ' .. ile ..' ' .. minu .. ' na pokonanie bossa, po tym czasie zostaniesz wyrzucony z areny i stracisz mozliwosc ponownej walki.', TALKTYPE_ORANGE_1, false, cid)
			return
		end
	end
	
	
	
end


No i w błędzie wychodzi, że nie może się w funkcji addevent gdy już jest wywowały czyli po 10 sekundach odwołać do indeksu "k"


Jak poprawnie to poustawiać?


//edit:

Dokładny błąd z consoli:

Code:
[Error - MoveEvents Interface]
In a timer event called from:
data/movements/scripts/task/tp_bossy_new.lua:onStepIn
Description:
data/movements/scripts/task/tp_bossy_new.lua:43: attempt to index global 'k' (a nil value)
stack traceback:
 data/movements/scripts/task/tp_bossy_new.lua:43: in function <data/movements/scripts/task/tp_bossy_new.lua:41>
 
napisz na gg to pomoge

-- edit
@down
pierze, gotuje, sprzata.. sznorowki wiaze.. i usowa ciaze ;)
 
Last edited:
Napisz co to robi, to też pomogę.
 
Dzięki, przy twojej pomocy się udało :)
Przy okazji nauczyłem się poprawnie robić te addeventy ;p
 
Back
Top