• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [TFS 1.0] House market (buy/sell)

I have an idea about more player interaction:

Lets say you have a shop, then I'll buy something from you @zbizu
If you are online, you get a message like "Eldin has just Purchased/Bought X Item from your Shop".

In that way, you can thank the player if you want or atleast see some live action about your shop.
Just a simple idea, love the script loads, keep up the awesome work mate. :)

Kind Regards,
Eldin.
 
I'm posting with my android device so I'll make an simple example only(could be explained better but typing that manually sucks). Just place that in correct line and modify that a bit.

if getPlayerByName(target) then
doPlayerSendTextMessage(getPlayerByName(target), MESSAGE_INFO_DESCR, "example " .. cid .. " message " .. target .. ".")
end

@EldinWorld
 
@zbizu - Is the system still critical or does it work for TFS 1.+ as it should now?
Im just about to add it and play with it. :)

Kind Regards,
Eldin
.
 
Offline house market.
Lets you trade your items without losing their attributes.
Do not post that script on other forums without my permission

YOU NEED NEWEST TFS OR PLAYERS MAY STEAL YOUR MARKET

Screenshots:
1z64183.png

hx7pf4.png

kf5wnn.png


To create your own market:
1. place a basket on house edge
2. put container with items you want to sell
3. put an item which handles textfields inside a basket and type something like that:

*Sell means item you SELL, Buy means item you want to BUY

To do: limit of items player wants to buy, "child" containers support


add to /data/creaturescripts/scripts/login.lua(above return true):
Code:
  home_market_spend = 0
   home_market_items = {}
   home_market_items_msg = ""

   for i = 1, 30 do
   -- don't let them send milions of trash and then get it at once!
      local a = db.storeQuery("SELECT * FROM `onlogin_sendtoinbox` WHERE `player_id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
      if a then
       local it_id = Player(cid):getInbox():addItem(result.getDataInt(a, "itemtype"), result.getDataInt(a, "count"), true, 1)
       it_id:setAttribute(1, result.getDataInt(a, "actionid"))
       it_id:setAttribute(4, result.getDataString(a, "description"))
       it_id:setAttribute(8, result.getDataString(a, "text"))
       it_id:setAttribute(32, getPlayerNameByGUID(result.getDataInt(a, "writer_guid")))
       it_id:setAttribute(16, getPlayerNameByGUID(result.getDataInt(a, "written_at")))
       home_market_spend = home_market_spend + result.getDataInt(a, "price")
       table.insert(home_market_items, {getItemName(result.getDataInt(a, "itemtype")), result.getDataInt(a, "count")})
       db.query("DELETE FROM `onlogin_sendtoinbox` WHERE `player_id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
      else
       break
      end
   end

   if #home_market_items > 0 then
     for i = 1, #home_market_items do
       home_market_items_msg = home_market_items_msg .. i_ar(home_market_items[i][1], home_market_items[i][2]) .. " " .. i_n(home_market_items[i][1], home_market_items[i][2])
       if #home_market_items ~= 1 and i ~= #home_market_items then
         home_market_items_msg = home_market_items_msg .. ", "
       end
     end

     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: During your absence, players sold you " .. #home_market_items .. " item(s) for " .. home_market_spend .. " gold coins in total.")
     if #home_market_items < 31 then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: Items you bought: " .. home_market_items_msg)
     else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: Check your inbox to see items you received.")
     end
   end
hello Friend
I tried to spend your script item 1.2 TFS house market and gives me this error in login.lua, this script is compatible with TFS 1.2?
thanks for reading and greetings


Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/login.lua:eek:nLogin
data/creaturescripts/scripts/others/login.lua:97: attempt to concatenate a boolean value
stack traceback:
  [C]: in function '__concat'
  data/creaturescripts/scripts/others/login.lua:97: in function <data/creaturescript
s/scripts/others/login.lua:48>
this is the login.lua after modify
Code:
-- ordered as in creaturescripts.xml
local events = {
    'TutorialCockroach',
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'BigfootBurdenWarzone',
    'BigfootBurdenWeeper',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'PlayerDeath',
    'AdvanceSave',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot'
}

local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end

    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end

function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
        player:sendTutorial(1)
    else
        if loginStr ~= '' then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player.uid

    -- Stamina
    Game.getStorageValue("stamina")[playerId] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promoted = player:isPromoted()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if promoted and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif not promoted and value == 1 then
            player:setVocation(vocation:getPromotion())
        end
    elseif promoted then
        player:setVocation(vocation:getDemotion())
    end

    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end

    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end

  home_market_spend = 0
   home_market_items = {}
   home_market_items_msg = ""

   for i = 1, 30 do
   -- don't let them send milions of trash and then get it at once!
      local a = db.storeQuery("SELECT * FROM `onlogin_sendtoinbox` WHERE `player_id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
      if a then
       local it_id = Player(cid):getInbox():addItem(result.getDataInt(a, "itemtype"), result.getDataInt(a, "count"), true, 1)
       it_id:setAttribute(1, result.getDataInt(a, "actionid"))
       it_id:setAttribute(4, result.getDataString(a, "description"))
       it_id:setAttribute(8, result.getDataString(a, "text"))
       it_id:setAttribute(32, getPlayerNameByGUID(result.getDataInt(a, "writer_guid")))
       it_id:setAttribute(16, getPlayerNameByGUID(result.getDataInt(a, "written_at")))
       home_market_spend = home_market_spend + result.getDataInt(a, "price")
       table.insert(home_market_items, {getItemName(result.getDataInt(a, "itemtype")), result.getDataInt(a, "count")})
       db.query("DELETE FROM `onlogin_sendtoinbox` WHERE `player_id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
      else
       break
      end
   end

   if #home_market_items > 0 then
     for i = 1, #home_market_items do
       home_market_items_msg = home_market_items_msg .. i_ar(home_market_items[i][1], home_market_items[i][2]) .. " " .. i_n(home_market_items[i][1], home_market_items[i][2])
       if #home_market_items ~= 1 and i ~= #home_market_items then
         home_market_items_msg = home_market_items_msg .. ", "
       end
     end

     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: During your absence, players sold you " .. #home_market_items .. " item(s) for " .. home_market_spend .. " gold coins in total.")
     if #home_market_items < 31 then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: Items you bought: " .. home_market_items_msg)
     else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: Check your inbox to see items you received.")
     end
    return true
end
 
I dont know why, but this system dont works on TFS 1.2 =///
 
hello Friend
I tried to spend your script item 1.2 TFS house market and gives me this error in login.lua, this script is compatible with TFS 1.2?
thanks for reading and greetings


Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/login.lua:eek:nLogin
data/creaturescripts/scripts/others/login.lua:97: attempt to concatenate a boolean value
stack traceback:
  [C]: in function '__concat'
  data/creaturescripts/scripts/others/login.lua:97: in function <data/creaturescript
s/scripts/others/login.lua:48>
this is the login.lua after modify
Code:
-- ordered as in creaturescripts.xml
local events = {
    'TutorialCockroach',
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'BigfootBurdenWarzone',
    'BigfootBurdenWeeper',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'PlayerDeath',
    'AdvanceSave',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot'
}

local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end

    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end

function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
        player:sendTutorial(1)
    else
        if loginStr ~= '' then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player.uid

    -- Stamina
    Game.getStorageValue("stamina")[playerId] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promoted = player:isPromoted()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if promoted and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif not promoted and value == 1 then
            player:setVocation(vocation:getPromotion())
        end
    elseif promoted then
        player:setVocation(vocation:getDemotion())
    end

    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end

    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end

  home_market_spend = 0
   home_market_items = {}
   home_market_items_msg = ""

   for i = 1, 30 do
   -- don't let them send milions of trash and then get it at once!
      local a = db.storeQuery("SELECT * FROM `onlogin_sendtoinbox` WHERE `player_id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
      if a then
       local it_id = Player(cid):getInbox():addItem(result.getDataInt(a, "itemtype"), result.getDataInt(a, "count"), true, 1)
       it_id:setAttribute(1, result.getDataInt(a, "actionid"))
       it_id:setAttribute(4, result.getDataString(a, "description"))
       it_id:setAttribute(8, result.getDataString(a, "text"))
       it_id:setAttribute(32, getPlayerNameByGUID(result.getDataInt(a, "writer_guid")))
       it_id:setAttribute(16, getPlayerNameByGUID(result.getDataInt(a, "written_at")))
       home_market_spend = home_market_spend + result.getDataInt(a, "price")
       table.insert(home_market_items, {getItemName(result.getDataInt(a, "itemtype")), result.getDataInt(a, "count")})
       db.query("DELETE FROM `onlogin_sendtoinbox` WHERE `player_id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
      else
       break
      end
   end

   if #home_market_items > 0 then
     for i = 1, #home_market_items do
       home_market_items_msg = home_market_items_msg .. i_ar(home_market_items[i][1], home_market_items[i][2]) .. " " .. i_n(home_market_items[i][1], home_market_items[i][2])
       if #home_market_items ~= 1 and i ~= #home_market_items then
         home_market_items_msg = home_market_items_msg .. ", "
       end
     end

     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: During your absence, players sold you " .. #home_market_items .. " item(s) for " .. home_market_spend .. " gold coins in total.")
     if #home_market_items < 31 then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: Items you bought: " .. home_market_items_msg)
     else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Store]: Check your inbox to see items you received.")
     end
    return true
end

I get same error, anybody know what this means?

I use Tfs 1.1 compiled Apr 9th -

20if88h.png

Anybody know whats wrong?
-Martin
 
Back
Top