local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local storageKey = 343 -- // storage z taskow
local taski = 10 -- // ilosc taskow
local config = {
points=5,
storage=2500,
}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local str = getPlayerStorageValue(cid, 2364234)
local storageKey = 2364234
local hard = getPlayerStorageValue(cid, storageKey)
local t1 = getPlayerStorageValue(cid, 35001)
local t2 = getPlayerStorageValue(cid, 35002)
local t3 = getPlayerStorageValue(cid, 35003)
local t4 = getPlayerStorageValue(cid, 35004)
local t5 = getPlayerStorageValue(cid, 35005)
local t6 = getPlayerStorageValue(cid, 35006)
if(msgcontains(msg, 'tasks')) then
npcHandler:say("You have done " .. hard .. " tasks. If you want to get premium points, you need to do 10 task first. For every 10 tasks I can give you {premium points}.", cid)
local n = 0 -- liczba tasków
for x = 3543105,3543103,3543104,3543102,3543101,3543100,3543099,3543098,3543097,3543096,3543094,3543095,3543093,3543092,3543091,3543090,3543089,3543086,3543087,3543088,3543085,3543084,3543083,3543081,3543082,3543080,3543077,3543078,3543079,3543075,3543076,3543074,3543070,3543071,3543072,3543073,3543069,3543068,3543067,3543066,3543064,3543065,3543035,3543036,3543037,3543038,3543039,3543040,3543041,3543042,3543043,3543044,3543045,3543047,3543046,3543048,3543049,3543050,3543059,3543056,3543053,3543052,3543063,3543062 do
if getPlayerStorageValue(cid, x) >= 1 then
n = n + 1
end
end
elseif(msgcontains(msg, 'premium points')) then
if (n >= 10 and t1 == -1) then
--local result_plr = db.getResult("SELECT * FROM accounts WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
--local money = tonumber(result_plr:getDataInt("premium_points"))
-- money = money+config.points
npcHandler:say("Awesome! I gave you " .. config.points .. " for your 10 tasks.", cid)
--db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid, 35001, 1)
elseif (t1 == 1 and t2 == -1) then
npcHandler:say("You have already claimed reward for 10 tasks!", cid)
elseif (str <= 9) then
npcHandler:say("U do not have enough tasks to claim reward for 20 tasks!", cid)
end
-- // 20 taskow
if (n >= 20 and t2 == -1 and t1 == 1) then
npcHandler:say("Awesome! I gave you " .. config.points .. " for your 20 tasks.", cid)
--db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid, 35002, 1)
elseif (t2 == 1 and t3 == -1) then
npcHandler:say("You have already claimed reward!", cid)
elseif (t1 == 1 and str <= 19) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 30 taskow
if (n >= 30 and t3 == -1 and t2 == 1) then
npcHandler:say("Awesome! I gave you " .. config.points .. " for your 30 tasks.", cid)
--db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid, 35003, 1)
elseif (t3 == 1) then
npcHandler:say("You have already claimed reward!", cid)
elseif (t1 == 1 and t2 == 1 and str <= 29) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 40 taskow
if (n >= 40 and t4 == -1 and t3 == 1) then
npcHandler:say("Awesome! I gave you " .. config.points .. " for your 40 tasks.", cid)
--db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid, 35004, 1)
elseif (t4 == 1) then
npcHandler:say("You have already claimed reward!", cid)
elseif (t1 == 1 and t2 == 1 and t3 == 1 and str <= 39) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 50 tasks
if (n >= 50 and t5 == -1 and t4 == 1) then
npcHandler:say("Awesome! I gave you " .. config.points .. " for your 40 tasks.", cid)
--db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid, 35005, 1)
elseif (t5 == 1) then
npcHandler:say("You have already claimed reward!", cid)
elseif (t1 == 1 and t2 == 1 and t3 == 1 and t4 == 1 and str <= 39) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 60 tasks
if (n >= 60 and t6 == -1 and t5 == 1) then
npcHandler:say("Awesome! I gave you " .. config.points .. " for your 40 tasks.", cid)
--db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid, 35006, 1)
elseif (t6 == 1) then
npcHandler:say("You have already claimed reward!", cid)
elseif (t1 == 1 and t2 == 1 and t3 == 1 and t4 == 1 and t5 == 1 and str <= 39) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // kurwa
if(t1 == 10) then
talkState[talkUser] = 1
end
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
else
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())