• 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!

Lua Problem with storage id ( simple problem ) HELP

Guxi

Developer
Joined
Mar 17, 2012
Messages
128
Reaction score
12
Location
Croatia
Theres npc that should set a storage id with value 5 to a player. Then he comes to book shell and clicks on it and he is supposed to get the item with id 1975 if he has that str~ id w/ value 5. Otherwise he just get prompted that he didn't buy the spell w/e.

Those are the codes I GET NO ERRORS IN CONSOLE And each time i click on book shelf i get the msg that i didn't buy the spell...
Npc
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local storage = 22001
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 itemgive    = "Here you go. Don don't loose it!"
local noitems        = 'You do not have eggs i need!'

npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|! Are you interested in {spells}?")

function exorigradior(cid, message, keywords, parameters, node)

	local spell = "Exori Gradior"
	
	
	
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    
	doPlayerSetStorageValue(cid, storage, 5)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Take your book from bookshelf.")	
    
end
keywordHandler:addKeyword({'spells'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Take a look at the spell menu book on my table"})

	local node3 = keywordHandler:addKeyword({'boomerang step'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy spell Boomerang Step for 75000 gold coins'})
    node3:addChildKeyword({'yes'}, exorigradior, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright..', reset = true})

npcHandler:addModule(FocusModule:new())




BOOKSHELF.LUA
Code:
local storage = 22001
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- BOOMERANG STEP ( EXORI GRADIOR )                                                                                                                         
	if(item.Uid == 1700) then
	
		
	if getPlayerStorage(cid, storage) == 5 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got the spell")
		doPlayerAddItem(cid, 1975, 1) 
	end

	else
		
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You didn't buy this spell, or you already own it!")
	end
end
 
Back
Top Bottom