Jeden ziomek pomógł mi zrobić to:
Lecz trzeba dodać taką funkcję, że odpowiedz "tak" lub "nie" można napisać dopiero bo napisaniu słowa "event" i dopieto np."tak" a nie od razu spamować "tak"
Macie czas?
To pomóżcie
Lecz trzeba dodać taką funkcję, że odpowiedz "tak" lub "nie" można napisać dopiero bo napisaniu słowa "event" i dopieto np."tak" a nie od razu spamować "tak"
Macie czas?
To pomóżcie
PHP:
-- ## EVENT NPC --
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) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local storage = getPlayerStorageValue(cid,5554)
local pos = {x=177,y =46,z=7}
if msgcontains(msg,'event') then
npcHandler:say('Do wejscia potrzeba 30 klow, posiadasz je?',cid)
talkState[talkUser] = 1
setPlayerStorageValue(cid,5554,1)
end
if msgcontains(msg,'nie') or msgcontains(msg,'nie') then
npcHandler:say('Nie masz smoczych klow!',cid)
end
if msgcontains(msg,'tak') or msgcontains(msg,'yes') and storage == 1 and talkState[talkUser] == 1 then
if doPlayerRemoveItem(cid,8614,40) then
npcHandler:say('Zostales przeniesiony na event!',cid)
setPlayerStorageValue(cid,5554,2)
doTeleportThing(cid,pos)
doSendMagicEffect(pos,CONST_ME_TELEPORT)
else
npcHandler:say('Wybacz nie przeniose Cie za darmo!', cid)
end
end
talkState[talkUser] = 2
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())