• 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 Question Sote in Game

xshaggyx

New Member
Joined
Feb 20, 2016
Messages
42
Reaction score
2
If I wanted to sell an access within the game for example to dijin as it should be the line to add it inside the game store
 
I would assume you would want to give them a storage value for the djinn quest.
 
Code:
local questdoll = {ID OF THE ITEM YOU WANT TO SELL}
function onUse(cid, item, frompos, item2, topos)

   
        if getPlayerStorageValue(cid,STORAGE NUMBER) == -1 then
            doPlayerSendTextMessage(cid,19,"MSG WHEN USE THE ITEM")
            setPlayerStorageValue(cid,STORAGE NUMBER,1)
            doPlayerRemoveItem(cid, questdoll, 1)
        else
            doPlayerSendTextMessage(cid,19,"You already done this quest..")
        end
   
    end
    return TRUE
end

Create a file questdoll.lua -> put in actions/scripts
Open actions.xml -> put <action itemid="ID F THE ITEM YOU WANT TO SELL" event="script" value="questdoll.lua" />
 
this is wht i have but dont work


local questdoll = {9019}
function onUse(cid, item, frompos, item2, topos)


if getPlayerStorageValue(cid,12139) == -1 then
doPlayerSendTextMessage(cid,19,"shaggy es pro")
setPlayerStorageValue(cid,12139,1)
doPlayerRemoveItem(cid, questdoll, 1)
else
doPlayerSendTextMessage(cid,19,"You already done this quest..")
end

end
return TRUE
end
 
My bad.
Now i tested and it is running fine.

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


if getPlayerStorageValue(cid,12139) == -1 then
doPlayerSendTextMessage(cid,19,"shaggy es pro")
setPlayerStorageValue(cid,12139,1)
doRemoveItem(item.uid)
else
doPlayerSendTextMessage(cid,19,"You already done this quest..")
end


return TRUE
end
Actions.xml -> <action itemid="8982" event="script" value="questdoll.lua" />
 
this is wht i have but dont work


local questdoll = {9019}
function onUse(cid, item, frompos, item2, topos)


if getPlayerStorageValue(cid,12139) == -1 then
doPlayerSendTextMessage(cid,19,"shaggy es pro")
setPlayerStorageValue(cid,12139,1)
doPlayerRemoveItem(cid, questdoll, 1)
else
doPlayerSendTextMessage(cid,19,"You already done this quest..")
end

end
return TRUE
end
that means u are not pro
 
Code:
<action itemid="xxxx" script="djin.lua" /> -- xxxx = id of the item, preferably something that can be put in your bp

make a file and name it djin.lua (or change it to w/e u want)

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local storage = player:getStorageValue(xxxx) -- Put your own storage value instead of xxxx
    if storage == -1 then
        player:setStorageValue(xxxx, 1) -- change xxxx again
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You can now access the djin tower.')
        item:remove(1)
    elseif storage == 1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You already have this quest')
    return true
    end
end

Tested it on tfs 1.2 and it works
 
Back
Top