Mam sobie takiego świątecznego skrypciolka oł je:
.
Niestety nie dziala jak powinien:
A gdy je sobie zrobiłem:
LUA:
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
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = 6690
if(msgcontains(msg, 'quest') or msgcontains(msg, 'jajka')) then
if(getPlayerStorageValue(cid, storage) < 1) then
npcHandler:say("Hey, mam dla Ciebie zadanie. Dostan sie na wyspe z Wielkanocnymi Zajacami. Przynies mi 1 tysiac zielonych jajek a otrzymasz nagrode! Znikam o polnocy, spiesz sie!", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Znalazles je?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Sorry ale ich nie znalazles. Jestes nuub", cid)
end
elseif(msgcontains(msg, 'tak') and talkState[talkUser] == 1) then
if(doRemoveItem(cid, 6544, 1000) == TRUE) then
npcHandler:say("Dzieki! Masz ode mnie 60 punktow premium w SMS SHOPIE!", cid)
local update = db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + 60 WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
setPlayerStorageValue(cid, storage, 2)
talkState[talkUser] = 0
else
npcHandler:say("Sorry ale ich nie znalazles. Jestes nuub.", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'nie') and talkState[talkUser] > 0) then
npcHandler:say("No to nie.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Niestety nie dziala jak powinien:
Code:
08:41 Wielkanocny Boss: Siema GOD Apollo, wesolych swiat! Napisz jajka.
08:41 GOD Apollo [500]: jajka
08:41 Wielkanocny Boss: Znalazles je?
A gdy je sobie zrobiłem:
Code:
08:42 Wielkanocny Boss: Znalazles je?
08:42 GOD Apollo [500]: tak
08:42 Wielkanocny Boss: Sorry ale ich nie znalazles. Jestes nuub.