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

a quest issue..

Xerez

New Member
Joined
Mar 6, 2008
Messages
45
Reaction score
0
Code:
local itemList = {
     [2463] = 1,
     [2647] = 1,
     [2525] = 1,
     [5924] = 1,
     [2160] = 1
}

function onUse(cid, item, frompos, topos) 
    if getPlayerStorageValue(cid, 5669) ~= -1 then
        for itemid, count in pairs(itemList) do
            doPlayerAddItem(cid, itemid, count)
        end
        setPlayerStorageValue(cid, 5669, 1)
        doPlayerSendTextMessage(cid, 22, "Congratulations " .. getPlayerName(cid) .. ", you got your starter equipment!")
    else
        doPlayerSendTextMessage(cid, 22, "You have already got your starter equipment!")
    end
    return 1
end


This script is supposed to give all new players a set of items (at the top) but it says "you have already got your starter equipment" to everyone even totally new chars..anyone knows why?
 
Maybe the storage value was already in use...?

PHP:
local itemList = {
     [2463] = 1,
     [2647] = 1,
     [2525] = 1,
     [5924] = 1,
     [2160] = 1
}
local storageValue = 9659

function onUse(cid, item, frompos, topos) 
    if getPlayerStorageValue(cid, storageValue) ~= -1 then
        for itemid, count in pairs(itemList) do
            doPlayerAddItem(cid, itemid, count)
        end
        setPlayerStorageValue(cid, storageValue, 1)
        doPlayerSendTextMessage(cid, 22, "Congratulations " .. getPlayerName(cid) .. ", you got your starter equipment!")
    else
        doPlayerSendTextMessage(cid, 22, "You have already got your starter equipment!")
    end
    return 1
end
 
Do you mean the unique id? I set the unique id on the chest to 35001 and the same in this file and in actions.xml :P
 
Code:
function onUse(cid, item, frompos, item2, topos)

if item.uid == 35001 then
queststatus = getPlayerStorageValue(cid,35001)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have gotten your starting money.") 
doPlayerAddItem(cid,2160,1)
setPlayerStorageValue(cid,35001,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
end
return 1
end


This script works but I want it to give several items not only 1.. how do I do? anyone who can give me a working script example? :) thanks
 
Heres one from the TFS distro examples, its a movements script but you can change it.
Code:
local firstItems =
{
	2050,
	2382
}

function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) == TRUE then
		if getPlayerStorageValue(cid, 30001) == -1 then
			for i = 1, table.maxn(firstItems) do
				doPlayerAddItem(cid, firstItems[i], 1)
			end
			if getPlayerSex(cid) == 0 then
				doPlayerAddItem(cid, 2651, 1)
			else
				doPlayerAddItem(cid, 2650, 1)
			end
			local bag = doPlayerAddItem(cid, 1987, 1)
			doAddContainerItem(bag, 2674, 1)
			setPlayerStorageValue(cid, 30001, 1)
		end
	end
 	return TRUE
end
 
STiX, that's not the problem. I bet my code works, he is already using that storage value. Copy my code again! I changed the storage value -.-
 
Look, I have tried that script and the other script that you gave me but none of them work, it says you already got the reward even tho you havn't, I've tried like 5 different Unique ID's like 36001 and 9337 doesnt matter what I choose, something's wrong in there. Sorry to tell you.

Anyone have a working quest script that gives u several items from a quest box?
 
Back
Top