function givePlayerBookWithText(cid, itemid, text, originalWriter) --originalWriter is optional
local item = doPlayerAddItem(cid, itemid)
doItemSetAttribute(item, "text", text)
if originalWriter ~= nil then
doItemSetAttribute(item, "writer", originalWriter)
end
return item
end
givePlayerBookWithText(cid, 1952, "This is the story of ...")
givePlayerBookWithText(cid, 1952, "This is the story of ...", "Scarlet Ayleid")
function onUse(cid, item, frompos, item2, topos)
if item.uid == 7916 then
queststatus = getPlayerStorageValue(cid,5020027)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have found a frozen starlight.")
doPlayerAddItem(cid,2361,1)
setPlayerStorageValue(cid,5020027,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
else
return 0
end
return 1
end
local bookID = 1952
local text = "This is an example!"
local originalWriter = "Scarlet Ayleid"
local storageKey = 5020027
function onUse(cid, item, frompos, item2, topos)
if item.uid == 7916 then
queststatus = getPlayerStorageValue(cid, storageKey)
if queststatus == -1 then
doPlayerSendTextMessage(cid, 22, "You have found a book.")
givePlayerBookWithText(cid, bookID, text, originalWriter)
setPlayerStorageValue(cid, storageKey, 1)
else
doPlayerSendTextMessage(cid, 22, "It is empty.")
end
else
return 0
end
return 1
end
function onUse(cid, item, frompos, item2, topos)
if item.uid == 7916 then
queststatus = getPlayerStorageValue(cid,5020027)
if queststatus == -1 then
doSetItemText(doPlayerAddItem(cid, 1950),"This is the story of ...")
setPlayerStorageValue(cid,5020027,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
else
return 0
end
return 1
end
[02/07/2011 17:36:56] [Error - Action Interface]
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:onUse
[02/07/2011 17:36:56] Description:
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:11: attempt to call global 'givePlayerBookWithText' (a nil value)
[02/07/2011 17:36:56] stack traceback:
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:11: in function <data/actions/scripts/other/secretbook.lua:6>
doesnt work ,
now even got error on console
PHP:[02/07/2011 17:36:56] [Error - Action Interface] [02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:onUse [02/07/2011 17:36:56] Description: [02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:11: attempt to call global 'givePlayerBookWithText' (a nil value) [02/07/2011 17:36:56] stack traceback: [02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:11: in function <data/actions/scripts/other/secretbook.lua:6>
function onUse(cid, item, frompos, item2, topos)
if item.uid == 7917 then
queststatus = getPlayerStorageValue(cid,5020227)
if queststatus == -1 then
doSetItemText(doPlayerAddItem(cid, 1950),"Warfare Secret:We know one of warfare secrets! Go To Jungle And Find Hero Statue , from statue go 1 south 6 west 3 south 1 west. Here Is A Secret Passage , But we dont know where it leads cuz we dont know secret words to enter it! Find Another Secret Somewhere in Warfare City...")
setPlayerStorageValue(cid,5020227,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
else
return 0
end
return 1
end
PHP:
this is how it looks now