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

SQM wymagający dane itemy.

Poziomek

New Member
Joined
Nov 12, 2010
Messages
16
Reaction score
0
Location
Poland Jedlicze
Witam,
Mam mały problem.

ots/data/movements/scripts/questtile.lua
Code:
function onStepIn(cid, item, fromPosition, item2, toPosition)
local config = {
id1 = [B]9997[/B],
id2 = [B]9998[/B],
id3 = [B]9999[/B]
}
    if getPlayerItemCount(cid, config.id1) < 1 and getPlayerItemCount(cid, config.id2) < 1 and getPlayerItemCount(cid, config.id3) < 1 then
        doTeleportThing(cid, fromPosition)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
    end
return true
end

movements.xml
Code:
<movevent type="StepIn" actionid="[B]20000[/B]" event="script" value="questtile.lua"/>

Mam ten skrypt, ale nie działa on poprawnie. Kiedy mam itemy o id 9999, 9998, 9997 i wchodzę na sqm (actionid 20000) to mogę przejść, ale kiedy nie mam tych itemków to też mogę przejść, ale wyświetla się napis "You don't have needed items.". Wie ktoś co jest nie tak z tym skryptem? Może by ktoś po prostu to naprawił, albo zrobił tak, żeby po stanięciu na tym sqm teleportowało nas np kratkę do tyłu. Z góry dziękuję za pomoc.
 
LUA:
function onStepIn(cid, item, fromPosition, item2, toPosition)
local config = {
id1 = 9997,
id2 = 9998,
id3 = 9999
}
    if ((getPlayerItemCount(cid, config.id1) < 1) or (getPlayerItemCount(cid, config.id2)) < 1 or (getPlayerItemCount(cid, config.id3) < 1)) then
        doTeleportThing(cid, fromPosition)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
    end
return true
end
 
LUA:
local config = {
id1 = 9997,
id2 = 9998,
id3 = 9999
}
function onStepIn(cid, item, fromPosition, item2, toPosition)
    if ((getPlayerItemCount(cid, config.id1) < 1) or (getPlayerItemCount(cid, config.id2)) < 1 or (getPlayerItemCount(cid, config.id3) < 1)) then
        doTeleportThing(cid, fromPosition)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
end
return true
end
 
Dzięki. :) SzukamLaya i narko, wy wysłaliście to samo? Ten komp tak ledwo chodzi, że nie jestem w stanie przewinąć tego kodu w bok. I jeszcze mam pytanie, jeśli w id1, id2, id3 wpiszę to samo id to sqm będzie wymagał 3 takie itemy czy tylko 1?
 
Ich skrypty różnią się tylko miejscem tablicy w skrypcie.

I jeżeli wpiszesz trzy takie same id, to skrypt będzie wymagał tylko 1.

@edit:
Mój 500 post, wow.
 
Last edited:
W sumie zeby wszystko bylo ladnie to trza tak
LUA:
local config = {
id1 = 9997,
id2 = 9998,
id3 = 9999
}
function onStepIn(cid, item, fromPosition, item2, toPosition)
    if ((getPlayerItemCount(cid, config.id1) < 1) or (getPlayerItemCount(cid, config.id2)) < 1 or (getPlayerItemCount(cid, config.id3) < 1)) then
        doTeleportThing(cid, fromPosition)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
    end
    return true
end
 
To jeszcze raz dziękuję wszystkim za pomoc. Jestem mile zaskoczony tym forum. Na innym, znanym polskim, drugi dzień czekam na jakąś odpowiedź i nic, a tutaj w kilka minut od razu mi pomogliście. :)
 
Bo na tym drugim forum (zwanym potocznie tnetem) chlopaki sie zastanwiali czy na pewno dobrze wlaczyles tfs.
@dawaj repa.
 
po co stosowac tablice config w takim wypadku? Przeciez to nie ma sensu ?

LUA:
local config = { 9997, 9998, 9999 }

config[0]  config[1] config[2]
 
LUA:
local config = {
9997, 9998, 9999
}
function onStepIn(cid, item, fromPosition)
	for _, k in ipairs(config)
		if (getPlayerItemCount(k) < 1) then
			doTeleportThing(cid, fromPosition)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
			break
		end
	end
	return true
end
Mozesz se dodawac tyle itemow ile chcesz ( po przecinku )
 
Nom dzieki racja ;/
LUA:
local config = {
9997, 9998, 9999
}
function onStepIn(cid, item, fromPosition)
	for _, k in ipairs(config)
		if (getPlayerItemCount(cid, k) < 1) then
			doTeleportThing(cid, fromPosition)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
			return true
		end
	end
	return true
end
 
Nom dzieki racja ;/
LUA:
local config = {
9997, 9998, 9999
}
function onStepIn(cid, item, fromPosition)
	for _, k in ipairs(config)
		if (getPlayerItemCount(cid, k) < 1) then
			doTeleportThing(cid, fromPosition)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
			return true
		end
	end
	return true
end

Niestety nie działa, mam te 3 itemy ale nie chce mnie przepuścić, id jest dobre w 100%.



W sumie zeby wszystko bylo ladnie to trza tak
LUA:
local config = {
id1 = 9997,
id2 = 9998,
id3 = 9999
}
function onStepIn(cid, item, fromPosition, item2, toPosition)
    if ((getPlayerItemCount(cid, config.id1) < 1) or (getPlayerItemCount(cid, config.id2)) < 1 or (getPlayerItemCount(cid, config.id3) < 1)) then
        doTeleportThing(cid, fromPosition)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
    end
    return true
end
A to przepuszcza wszystkich. Co jest nie tak?
 
LUA:
local config = {
9997, 9998, 9999
}
function onStepIn(cid, item, fromPosition)
	for _, k in ipairs(config)
		if getPlayerItemCount(cid, k) < 1 then
			doTeleportThing(cid, fromPosition)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have needed items.")
		return true
		end
	end
	return true
end

LUA:
(if getPlayerItemCount(cid, k) < 1 then)

na co komu ten nawias?

Btw Poziomek z debestii?
 
Last edited:
Nawet nie wiem co to jest Debestia. ;d
btw. Jak myślisz, jak usunę ten nawias to będzie działać? Nie chcę już shutdownować serwa w ciemno bo się gracze zaczną wkurzać.
 
Back
Top