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

Action Daily Quest + Counter - player can get prize after 24 hours from the last time.

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
617
Location
Poland
Hello,
I wanna share on Otland, script - daily quest script + counter (how many times we complete the daily quest).


Description:
The prize can be taken every 24 hours. The default setting is: 1 cc.
The addition of a counter which shows how many times we took the prize.


TIP`s:
* You can set hours from 24 to ex. 5, if you want 5h not 24h;
* Time doesn't reset after server crash;
* Customizable counter;

data/actions/actions.xml :
Lua:
<action actionid="7777" event="script" value="daily.lua"/>



data/actions/scripts/daily.lua :
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local daysvalue = 1 * 24 * 60 * 60
local daily = getPlayerStorageValue(cid, 13541)
    if (daily == -1) then
            daily = 0
    end
    if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
        doPlayerAddItem(cid, 2160, 1)
        time = os.time() + daysvalue
        setPlayerStorageValue(cid, 13540, time)    
        setPlayerStorageValue(cid, 13541, daily+1)
        local daily = getPlayerStorageValue(cid, 13541)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You done your " .. daily .. " Daily Quest. You got 1 cc.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait 24 Hours to get your daily quest. Next avaiable will be at: "  .. os.date("%H:%M:%S", getPlayerStorageValue(cid, 13540)) ..  ".")
    end
    return true
end


You can copy function to other quests ex. npc tasks or something else where you want.

Regards,
Fresh.
 
Last edited:
i have this :3 it is like box on yalahar, thais, etc..

PHP:
local t = {
-- from, to, id[, count]
	{1, 36}, -- will be empty =P
	{37, 46, 2152, 80},
	{47, 55, 2152, 50},
	{56, 64, 2160, 5},
	{65, 73, 2789, 5},
	{74, 81, 7620},
	{82, 87, 7618},
	{88, 92, 9811},
	{93, 96, 9808},
	{97, 100, 2214}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if os.time() - getCreatureStorage(cid, 5) >= 86400 then
		doCreatureSetStorage(cid, 5, os.time())
		local r = math.random(100)
		for i = 1, #t do
			local k = t[i]
			if r >= k[1] and r <= k[2] then
				if k[3] then
					local id, n = k[3], k[4] or 1
					local a = getItemInfo(id)
					doPlayerAddItem(cid, id, n)
					doCreatureSay(cid, 'You found ' .. (n == 1 and ((a.article == '' and '' or a.article .. ' ') .. a.name) or n .. ' ' .. a.plural) .. '.', TALKTYPE_ORANGE_1)
				else
					doCreatureSay(cid, 'You found nothing useful.', TALKTYPE_ORANGE_1)
				end
				break
			end
		end
	else
		doCreatureSay(cid, 'You found nothing useful.', TALKTYPE_ORANGE_1)
	end
	return true
end
 
Can you make so its more then one item? like 5% donate item ,60 % other item and 35 % CC?
 
it can be Done like This :p
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local time = 86400
	local storage = 12562
	if 	exhaustion.check(cid, storage) then
		doPlayerSendCancel(cid, "You Must Wait 24 hour")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
		if isPlayer(cid) then
			doPlayerAddItem(cid, 2160, 1)
			exhaustion.set(cid, storage, time)
			doPlayerSendTextMessage(cid, 14, "You Have Got 1 cc")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
		end
		return TRUE
end
sry for posting another script here​
 
Back
Top