• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Oldrak Bug

Bug

New Member
Joined
Jan 7, 2011
Messages
111
Reaction score
1
Hi folks i have console error in my oldrak npc.
BmC8I5FUqL.png

Script:
Code:
-- Made by Coltain and AlissonLinneker, Made it work for TFS --


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(not npcHandler:isFocused(cid)) then
return false
end

player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
playerCap = getPlayerFreeCap(cid)
item = 8293 --Hallowed Axe
itemweight = getItemWeight(item, 1)

if msgcontains(msg, 'hallowed axe') then
if isPlayer(cid) then
if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
npcHandler:say('Do you want to buy a Hallowed Axe from me?', cid)
talk_state = 1
else
npcHandler:say('You have to bring me an normal axe like everybody uses and a small few. Just 50000 gold.', cid)
talk_state = 0
end
else
npcHandler:say('You need premium to buy this axe from me.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
	if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
		if doPlayerRemoveItem(cid,2386,1)  and doPlayerRemoveMoney(cid,50000) == TRUE then
			npcHandler:say('Here you are. You can now defeat the demon oak with this axe.', cid)
			doPlayerAddItem(cid,8293,1)
			talk_state = 0
		else
			npcHandler:say('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.', cid)
			talk_state = 0
		end
	else
		npcHandler:say('Please bring an axe and enough money with you.', cid)
		talk_state = 0
	end
elseif msgcontains(msg, 'demon oak') then
if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
npcHandler:say('Did you defeat the demon oak?', cid)
talk_state = 2
else
npcHandler:say('Go defeat the demon oak.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
setPlayerStorageValue(cid,20004,1)
npcHandler:say('Good job!', cid)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
npcHandler:say('Ok thanks.', cid)
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())
 
replace:
itemweight = getItemWeight(item, 1)

with:
itemweight = getItemWeightById(item, 1)
 
Back
Top