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 idt = (getPlayerStorageValue (cid, 3543105) + getPlayerStorageValue (cid, 3543103) + getPlayerStorageValue (cid, 3543104) + getPlayerStorageValue (cid, 3543102) + getPlayerStorageValue (cid, 3543101) + getPlayerStorageValue (cid, 3543100) + getPlayerStorageValue (cid, 3543099) + getPlayerStorageValue (cid, 3543098) + getPlayerStorageValue (cid, 3543097) + getPlayerStorageValue (cid, 3543096) + getPlayerStorageValue (cid, 3543094) + getPlayerStorageValue (cid, 3543095) + getPlayerStorageValue (cid, 3543093) + getPlayerStorageValue (cid, 3543092) + getPlayerStorageValue (cid, 3543091) + getPlayerStorageValue (cid, 3543090) + getPlayerStorageValue (cid, 3543089) + getPlayerStorageValue (cid, 3543086) + getPlayerStorageValue (cid, 3543087) + getPlayerStorageValue (cid, 3543088) + getPlayerStorageValue (cid, 3543085) + getPlayerStorageValue (cid, 3543084) + getPlayerStorageValue (cid, 3543083) + getPlayerStorageValue (cid, 3543081) + getPlayerStorageValue (cid, 3543082) + getPlayerStorageValue (cid, 3543080) + getPlayerStorageValue (cid, 3543077) + getPlayerStorageValue (cid, 3543078) + getPlayerStorageValue (cid, 3543079) + getPlayerStorageValue (cid, 3543075) + getPlayerStorageValue (cid, 3543076) + getPlayerStorageValue (cid, 3543074) + getPlayerStorageValue (cid, 3543070) + getPlayerStorageValue (cid, 3543071) + getPlayerStorageValue (cid, 3543072) + getPlayerStorageValue (cid, 3543073) + getPlayerStorageValue (cid, 3543069) + getPlayerStorageValue (cid, 3543068) + getPlayerStorageValue (cid, 3543067) + getPlayerStorageValue (cid, 3543066) + getPlayerStorageValue (cid, 3543064) + getPlayerStorageValue (cid, 3543065) + getPlayerStorageValue (cid, 3543035) + getPlayerStorageValue (cid, 3543036) + getPlayerStorageValue (cid,3543037) + getPlayerStorageValue (cid, 3543038) + getPlayerStorageValue (cid, 3543039) + getPlayerStorageValue (cid, 3543040) + getPlayerStorageValue (cid, 3543041) + getPlayerStorageValue (cid, 3543042) + getPlayerStorageValue (cid, 3543043) + getPlayerStorageValue (cid, 3543044) + getPlayerStorageValue (cid, 3543045) + getPlayerStorageValue (cid, 3543047) + getPlayerStorageValue (cid, 3543046) + getPlayerStorageValue (cid, 3543048) + getPlayerStorageValue (cid, 3543049) + getPlayerStorageValue (cid, 3543050) + getPlayerStorageValue (cid, 3543059) + getPlayerStorageValue (cid, 3543056) + getPlayerStorageValue (cid, 3543053) + getPlayerStorageValue (cid, 3543052) + getPlayerStorageValue (cid, 3543063) + getPlayerStorageValue (cid, 3543062))
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
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)
if(msgcontains(msg, 'tasks')) then
npcHandler:say("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)
elseif(msgcontains(msg, 'premium points')) then
if (idt >= 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"))
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) .. ";")
money = money+config.points
setPlayerStorageValue(cid, 35001, 1)
elseif (t1 == 1 and t2 == -1) then
npcHandler:say("You have already claimed reward!", cid)
elseif (idt <= 9) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 20 taskow
if (idt >= 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 idt <= 19) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 30 taskow
if (idt >= 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 idt <= 29) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 40 taskow
if (idt >= 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 idt <= 39) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 50 tasks
if (idt >= 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 idt <= 39) then
npcHandler:say("U do not have enough tasks to claim reward!", cid)
end
-- // 60 tasks
if (idt >= 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 idt <= 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())