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

[TFS 0.3.6] My own quest system script

wesoly136

Member
Joined
Jul 30, 2009
Messages
562
Reaction score
9
Hi!
I tried to do my own script for quests as shortly as I can and I have a problem
LUA:
function onUse(cid, item, frompos, item2, topos)
local h = {
[2160] = {2160, 2},
[2345] = {2345, 1},
[2344] = {2344, 1}
}
local id = h[item.uid]
if getPlayerStorageValue(cid, id) ~= 1 then
doPlayerAddItem(cid, id[1],id[2])
setPlayerStorageValue(cid, id,1)
doPlayerSendTextMessage(cid, 22, "You have found "..getItemArticleById(id[1]).." "..getItemNameById(id[1])..".")
else
doPlayerSendCancel(cid,"It's empty.")
end
return 1
end
[2160]--storage-- = {2160--prize id--, 2--count--},
The problem is that, that the 'storage' isn't working... :/
Thanks in advance!
 
Last edited:
remove [ after id at if getPlayerStorage~
Code:
function onUse(cid, item, frompos, item2, topos)
local h = {
	[2160] = {2160, 2},
	[2345] = {2345, 1},
	[2344] = {2344, 1}
}
	local id = h[item.uid]
	if getPlayerStorageValue(cid, id) ~= 1 then
		doPlayerAddItem(cid, id[1],id[2])
		setPlayerStorageValue(cid, id,1)
		doPlayerSendTextMessage(cid, 22, "You have found "..getItemArticleById(id[1]).." "..getItemNameById(id[1])..".")
	else
		doPlayerSendCancel(cid,"It's empty.")
	end
	return true
end
 
Oh, it was my mistake, I tried to do it for all ways what I know :P

Effect:
Script gives me storage for all these chests, it is something about 8000, I thnik it was 2160+2345+2344 :/
So when I take one prize I can't take other
 
Code:
local quests = {
	-- [uid] = {{item, count}}
	[8000] = {{2160, 100}, {2400, 1}, {2152}}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local quest = quests[item.uid]
	if(quest) then
		if(getPlayerStorageValue(cid, quest) == -1) then
			for _, item in ipairs(quest) do
				doPlayerAddItem(cid, item[1], item[2] or 1)
			end
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You did it!")
			setPlayerStorageValue(cid, quest, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		end
	end
	return true
end

Ummm...
 
Chojrak my script is shorter and in my solved script(it isn't here) there you can also set custom storage value, in your script uid = storage ? :P
 
Back
Top