• 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 doSetItemText problem

SasirO

Banned User
Joined
Apr 30, 2009
Messages
559
Reaction score
0
Hello, my script isnt working well, here is it:
Code:
 function onUse(cid, item, frompos, item2, topos)

local config = {
        storage = 50012, -- change to your own storage value :)
        item = 1955, 
		

}

        if getPlayerStorageValue(cid, config.storage) == -1 then
                setPlayerStorageValue(cid, config.storage, 1)
				doPlayerSendTextMessage(cid,25,"You have found a book.")
                item = doPlayerAddItem(cid, config.item, 1) ~= -1
				doSetItemText(item,"lol")
        else
                doPlayerSendTextMessage(cid,25,"The barrel is empty.")
                end
        return TRUE
end


Im getting an error in my console:
Code:
[19/06/2009 01:02:09] Lua Script Error: [Action Interface] 
[19/06/2009 01:02:09] data/actions/scripts/quests/book1.lua:onUse

[19/06/2009 01:02:09] luaDoSetItemText(). Item not found

anyone know whats supposed to be wrong?
 
Code:
 function onUse(cid, item, frompos, item2, topos)

local config = {
        storage = 50012, -- change to your own storage value :)
        item = 1955, 
		

}

        if getPlayerStorageValue(cid, config.storage) == -1 then
                setPlayerStorageValue(cid, config.storage, 1)
				doPlayerSendTextMessage(cid,25,"You have found a book.")
                item = doPlayerAddItem(cid, config.item, 1)[COLOR="Red"] ~= -1[/COLOR]
				doSetItemText(item,"lol")
        else
                doPlayerSendTextMessage(cid,25,"The barrel is empty.")
                end
        return TRUE
end

See that red highlighted text? It most likely shouldn't be there. try the following code instead:

LUA:
 function onUse(cid, item, frompos, item2, topos)

local config = {
        storage = 50012, -- change to your own storage value :)
        item = 1955, 
		

}

        if getPlayerStorageValue(cid, config.storage) == -1 then
                setPlayerStorageValue(cid, config.storage, 1)
				doPlayerSendTextMessage(cid,25,"You have found a book.")
                item = doPlayerAddItem(cid, config.item, 1)
				doSetItemText(item,"lol")
        else
                doPlayerSendTextMessage(cid,25,"The barrel is empty.")
                end
        return TRUE
end
 
Back
Top