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 :
data/actions/scripts/daily.lua :
You can copy function to other quests ex. npc tasks or something else where you want.
Regards,
Fresh.
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: