Kungenn
Veteran OT User
Hello fellas, I update our server to the latest CryingDamsonpl2 or w/e the name is.
Thing is some of our NPCs stopped working.
However here is the old script we used for people to change life crystal for a life ring.
Not good or anything but it worked as we wanted it to before.
If someone could edit it for me so it works again, I'd be more than greatful..
Thanks in advance!
Thing is some of our NPCs stopped working.
However here is the old script we used for people to change life crystal for a life ring.
Not good or anything but it worked as we wanted it to before.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
addon_need_premium = 'You need an premium account to get addons!'
addon_have_already = 'Cant u remember? U already have this addon!'
addon_have_not_items = 'I am sorry, But u have wrong items!'
addon_give = 'Congrationlations, You just received your addon!'
if msgcontains(msg, 'life crystal') then
selfSay('You really got one? I need them to stay alive. If you want to trade one for a life ring say trade.')
---------------------------------------------------------Begin addons shit--------------------------------------------------
elseif msgcontains(msg, 'trade') then
if getPlayerPremiumDays(cid) > 0 then
if getPlayerItemCount(cid,2177) >= 1 then
selfSay('Do u want to trade your life crystal for a life ring??')
talk_state = 1
else
selfSay('Your life crystal for my life ring')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerItemCount(cid,2177) >= 1 then
if doPlayerTakeItem(cid,2177,1) == 0 then
doPlayerAddItem(cid,2205,1)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
selfSay('Ok then.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If someone could edit it for me so it works again, I'd be more than greatful..
Thanks in advance!