• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Html] Trade OFF - Shop Offline

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Html] Trade OFF - Shop Offline Empty [Html] Trade OFF - Shop Offline Miér Abr 20, 2016 3:10 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Hola usuario de tibiaface

    [Html] Trade OFF - Shop Offline M1m4mJw


    Como los servidores 8.60 y versiones no tiene el market bueno inventaron este sistema de mercado de trade off que podran vender su item y ser comprados desde la pagina:

    no vamos a nuestra PHPADMIN logeamos entramos a nuestra base de datos y en el menu buscamos SQL y ejecutamos estas lineas:

    Código:
    CREATE TABLE `auction_system` (
      `id` int(11) NOT NULL auto_increment,
      `player` int(11),
      `item_id` int(11),
      `item_name` varchar(255),
      `count` int(11),
      `cost` int(11),
      `date` int(11),
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    y esta otra:

    Código:
    ALTER TABLE `players` ADD `auction_balance` INT( 11 ) NOT NULL DEFAULT '0';

    Bueno una ves hecho aquello no vamos a htdoc y copiamos cualquier archivo php y renombramos por tradeoff.php y pegamos dentro:

    Código:


    <?PHP
    $auctions = $SQL->query('SELECT `auction_system`.`player`, `auction_system`.`id`, `auction_system`.`item_name`, `auction_system`.`item_id`, `auction_system`.`count`, `auction_system`.`cost`, `auction_system`.`date`, `players`.`name` FROM `auction_system`, `players` WHERE `players`.`id` = `auction_system`.`player` ORDER BY `auction_system`.`id` DESC')->fetchAll();
    $players = 0;
         
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><b>Instruction<b></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><center><h2>Commands</h2><b>!offer add, itemName, itemPrice, itemCount</b><br /><small>example: !offer add, plate armor, 500, 1</small><br /><br /><B>!offer buy, AuctionID</b><br /><small>example: !offer buy, 1943</small><br /><br /><b>!offer remove, AuctionID</b><br /><small>example: !offer remove, 1943</small><br /><br /><b>!offer withdraw</b><br /><small>Use this command to get money for sold items.</small></center></TR></TD></TABLE><br />';
        if(empty($auctions))
        {
            $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><b>Auctions</b></td></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD>Currently is no one active Auction.</TD></TR></TABLE>';
            $main_content .= '<br /><p align="right"><small>System created by <a href="http://otland.net/members/vDk/">vDk</a>.</small></p>';
        }
        else
        {
        foreach($auctions as $auction) {
            $players++;
                if(is_int($players / 2))
                    $bgcolor = $config['site']['lightborder'];
                else
                    $bgcolor = $config['site']['darkborder'];
            $cost = round($auction['cost']/1000, 2);
            $content .= '<TR BGCOLOR='.$bgcolor.'><TD><center>'.$auction['id'].'</center></TD><TD><center><img src="/item_images/'.$auction['item_id'].'.gif"/></center></TD><TD><center>'.$auction['item_name'].'</center></TD><TD><center><a href="?subtopic=characters&name='.urlencode($auction['name']).'">'.$auction['name'].'</a></center></TD><TD><center>'.$auction['count'].'</center></TD><TD><center>'.$cost.'k<br /><small>'.$auction['cost'].'gp</small></center></TD><TD><center>!offer buy, '.$auction['id'].'</center></TR>';
        }
       
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><b><center>ID</center></b></TD><TD class="white"><b><center>#</center></b></TD><TD class="white"><b><center>Item Name</center></b></TD><TD class="white"><b><center>Player</center></b></TD><TD class="white"><b><center>Count</center></b></TD><TD class="white"><b><center>Cost</center></b></td><TD class="white"><b><center>Buy</center></b></td></TR>'.$content.'</TABLE>';
        $main_content .= '<br /><p align="right"><small>System created by <a href="http://otland.net/members/vdk.1553/">vDk</a>.</small></p>';
    }
        ?>



    en layouts.php añadimos un nuevo subtopic en el lugar del menu que quieran:

    Código:
      <a href="?subtopic=tradeoff">
                                            <div id="submenu_tradeoff" class="Submenuitem" onmouseover="MouseOverSubmenuItem(this)" onmouseout="MouseOutSubmenuItem(this)">
                                                    <div class="LeftChain" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);"></div>
                                                    <div id="ActiveSubmenuItemIcon_tradeoff" class="ActiveSubmenuItemIcon" style="background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);"></div>
                                                    <div id="ActiveSubmenuItemLabel_tradeoff" class="SubmenuitemLabel">Trade Off</div>
                                                    <div class="RightChain" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);"></div>
                                            </div>
                                    </a>

    en index.php agregamos esta linea:

    Código:
    case "tradeoff";
      $topic = "Trade Off";
      $subtopic = "tradeoff";
      include("tradeoff.php");
    break;

    ---------------------------------------------
    ahora nos vamos a la carpeta data/talkactions
    ---------------------------------------------

    en nuestra carpeta data talkactions/talkactions.xml agregamos:

    Código:
    <talkaction words="!offer" event="script" value="auctionsystem.lua"/>

    y en la carpeta data/talkactions/script copiamos cualquier archivo y renombramos por auctionsystem.lua y pegamos esto dentro

    Código:
    local config = {
            levelRequiredToAdd = 20,
            maxOffersPerPlayer = 5,
            SendOffersOnlyInPZ = true,
            blocked_items = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933}
            }
    function onSay(cid, words, param, channel)
            if(param == '') then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                    return true
            end
            local t = string.explode(param, ",")
            if(t[1] == "add") then
                    if((not t[2]) or (not t[3]) or (not t[4])) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                            return true
                    end
                    if(not tonumber(t[3]) or (not tonumber(t[4]))) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't set valid price or items count.")
                            return true
                    end
                    if(string.len(t[3]) > 7 or (string.len(t[4]) > 3)) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This price or item count is too high.")
                            return true
                    end
                    local item = getItemIdByName(t[2])
                    if(not item) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
                            return true
                    end
                    if(getPlayerLevel(cid) < config.levelRequiredToAdd) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have required (" .. config.levelRequiredToAdd .. ") level.")
                            return true
                    end
                    if(isInArray(config.blocked_items, item)) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This item is blocked.")
                            return true
                    end
                    if(getPlayerItemCount(cid, item) < (tonumber(t[4]))) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have this item(s).")
                            return true
                    end
                    local check = db.getResult("SELECT `id` FROM `auction_system` WHERE `player` = " .. getPlayerGUID(cid) .. ";")
                    if(check:getID() == -1) then
                    elseif(check:getRows(true) >= config.maxOffersPerPlayer) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't add more offers (max. " .. config.maxOffersPerPlayer .. ")")
                            return true
                    end
                    if(config.SendOffersOnlyInPZ) then   
                            if(not getTilePzInfo(getPlayerPosition(cid))) then
                                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you add offert to database.")
                                    return true
                            end
                    end
                    if(tonumber(t[4]) < 1 or (tonumber(t[3]) < 1)) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to type a number higher than 0.")
                            return true
                    end
                                    local itemcount, costgp = math.floor(t[4]), math.floor(t[3])
                    doPlayerRemoveItem(cid, item, itemcount)
                    db.executeQuery("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. getPlayerGUID(cid) .. ", \"" .. t[2] .. "\", " .. getItemIdByName(t[2]) .. ", " .. itemcount .. ", " .. costgp ..", " .. os.time() .. ")")
                                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You successfully add " .. itemcount .." " .. t[2] .." for " .. costgp .. " gps to offerts database.")
            end
            if(t[1] == "buy") then
                    if(not tonumber(t[2])) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")
                            return true
                    end
                    local buy = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";")
                    if(buy:getID() ~= -1) then
                            if(getPlayerMoney(cid) < buy:getDataInt("cost")) then
                                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enoguh GP.")
                                    buy:free()
                                    return true
                            end
                            if(getPlayerName(cid) == getPlayerNameByGUID(buy:getDataInt("player"))) then
                                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can't buy your own items.")
                                    buy:free()
                                    return true
                            end
                            if(getPlayerFreeCap(cid) < getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")))then
                                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You try to buy a " .. buy:getDataString("item_name") .. ". It weight " .. getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")) .. " cap oz. and you have only " .. getPlayerFreeCap(cid) .. " oz. free capacity. Put some items to depot and try again.")
                                    buy:free()
                                    return true
                            end
                            if(isItemStackable((buy:getDataString("item_id")))) then
                                    doPlayerAddItem(cid, buy:getDataString("item_id"), buy:getDataInt("count"))
                            else
                                    for i = 1, buy:getDataInt("count") do
                                            doPlayerAddItem(cid, buy:getDataString("item_id"), 1)
                                    end
                            end
                            doPlayerRemoveMoney(cid, buy:getDataInt("cost"))
                            db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";")
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. buy:getDataInt("count") .. " ".. buy:getDataString("item_name") .. " for " .. buy:getDataInt("cost") .. " gps!")
                            db.executeQuery("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. buy:getDataInt("cost") .. " WHERE `id` = " .. buy:getDataInt("player") .. ";")
                            buy:free()
                    else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")
                    end
            end
            if(t[1] == "remove") then
                    if((not tonumber(t[2]))) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")
                            return true
                    end
                                    if(config.SendOffersOnlyInPZ) then   
                                            if(not getTilePzInfo(getPlayerPosition(cid))) then
                                                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you remove offerts from database.")
                                                    return true
                                            end
                    end
                    local delete = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";")       
                    if(delete:getID() ~= -1) then
                            if(getPlayerGUID(cid) == delete:getDataInt("player")) then
                                    db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";")
                                    if(isItemStackable(delete:getDataString("item_id"))) then
                                            doPlayerAddItem(cid, delete:getDataString("item_id"), delete:getDataInt("count"))
                                    else
                                            for i = 1, delete:getDataInt("count") do
                                                    doPlayerAddItem(cid, delete:getDataString("item_id"), 1)
                                            end
                                    end
                                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your offert has been deleted from offerts database.")
                            else
                                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This is not your offert!")
                            end
                    delete:free()
                    else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")
                    end
            end
            if(t[1] == "withdraw") then
                    local balance = db.getResult("SELECT `auction_balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                    if(balance:getDataInt("auction_balance") < 1) then
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have money on your auction balance.")
                            balance:free()
                            return true
                    end
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got " .. balance:getDataInt("auction_balance") .. " gps from auction system!")
                    doPlayerAddMoney(cid, balance:getDataInt("auction_balance"))
                    db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                    balance:free()
            end
            return true
    end

    y listo eso seria todo saludos.



    Creditos:

    vDk

    Killua - Ajuste no .lua







    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    2[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Vie Jun 10, 2016 6:20 pm

    Waach

    Waach
    Nuevo Miembro
    Nuevo Miembro
    [php]  <?php
    // comment to show E_NOTICE [undefinied variable etc.], comment if you want make script and see all errors
    error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE);

    // true = show sent queries and SQL queries status/status code/error message
    define('DEBUG_DATABASE', false);

    define('INITIALIZED', true);

    // if not defined before, set 'false' to load all normal
    if(!defined('ONLY_PAGE'))
    define('ONLY_PAGE', false);

    // check if site is disabled/requires installation
    include_once('./system/load.loadCheck.php');

    // fix user data, load config, enable class auto loader
    include_once('./system/load.init.php');

    // DATABASE
    include_once('./system/load.database.php');
    if(DEBUG_DATABASE)
    Website::getDBHandle()->setPrintQueries(true);
    // DATABASE END

    // LOGIN
    if(!ONLY_PAGE)
    include_once('./system/load.login.php');
    // LOGIN END

    // COMPAT
    // some parts in that file can be blocked because of ONLY_PAGE constant
    include_once('./system/load.compat.php');
    // COMPAT END

    // LOAD PAGE
    include_once('./system/load.page.php');
    // LOAD PAGE END

    // LAYOUT
    // with ONLY_PAGE we return only page text, not layout
    if(!ONLY_PAGE)
    include_once('./system/load.layout.php');
    else
    echo $main_content;
    // LAYOUT END

    // TRADE OFF
    case "tradeoff";
       $topic = "Trade Off";
       $subtopic = "tradeoff";
       include("tradeoff.php");
    break;
    // TRADE OFF END [php]

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    3[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Vie Jun 10, 2016 6:32 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Waach escribió:[php]
    Código:
     <?php
    // comment to show E_NOTICE [undefinied variable etc.], comment if you want make script and see all errors
    error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE);

    // true = show sent queries and SQL queries status/status code/error message
    define('DEBUG_DATABASE', false);

    define('INITIALIZED', true);

    // if not defined before, set 'false' to load all normal
    if(!defined('ONLY_PAGE'))
       define('ONLY_PAGE', false);
       
    // check if site is disabled/requires installation
    include_once('./system/load.loadCheck.php');

    // fix user data, load config, enable class auto loader
    include_once('./system/load.init.php');

    // DATABASE
    include_once('./system/load.database.php');
    if(DEBUG_DATABASE)
       Website::getDBHandle()->setPrintQueries(true);
    // DATABASE END

    // LOGIN
    if(!ONLY_PAGE)
       include_once('./system/load.login.php');
    // LOGIN END

    // COMPAT
    // some parts in that file can be blocked because of ONLY_PAGE constant
    include_once('./system/load.compat.php');
    // COMPAT END

    // LOAD PAGE
    include_once('./system/load.page.php');
    // LOAD PAGE END

    // LAYOUT
    // with ONLY_PAGE we return only page text, not layout
    if(!ONLY_PAGE)
       include_once('./system/load.layout.php');
    else
       echo $main_content;
    // LAYOUT END

    // TRADE OFF
    case "tradeoff";
       $topic = "Trade Off";
       $subtopic = "tradeoff";
       include("tradeoff.php");
    break;
    // TRADE OFF END [php]

    utilza esta gesior [Tienes que estar registrado y conectado para ver este vínculo]



    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    4[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Sáb Jun 11, 2016 1:10 pm

    Waach

    Waach
    Nuevo Miembro
    Nuevo Miembro
    Ok maya te explico ojala pudieras ayudarme, El caso es que arregle el problema de el TRADE OFF El problema es q no muestra los items cargados a la pag, parte de esto, quisiera saber que o donde actualiza los datos del comando introducido " !offer add, plate armor, 100, 1 " Esos valores q deberian actualizarze en mi base de datos no los consigo por ninguna parte....
    -- Pregunto esto porq sabiendo esa informacion tal vez pueda crear un nuevo script para q haga la misma funcion.. si puedes ayudarme estaria bastante agradecido.
    PD: estoy el 90% de el dia conectado en tu sitio husmeando jaja me encanta.! =D

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    5[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Sáb Jun 11, 2016 2:38 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Waach escribió:Ok maya te explico ojala pudieras ayudarme, El caso es que arregle el problema de el TRADE OFF El problema es q no muestra los items cargados a la pag, parte de esto, quisiera saber que o donde actualiza los datos del comando introducido " !offer add, plate armor, 100, 1 " Esos valores q deberian actualizarze en mi base de datos no los consigo por ninguna parte....
    -- Pregunto esto porq sabiendo esa informacion tal vez pueda crear un nuevo script para q haga la misma funcion.. si puedes ayudarme estaria bastante agradecido.
    PD: estoy el 90% de el dia conectado en tu sitio husmeando jaja me encanta.! =D

    no se si te refieres a esta linea
    Código:

    <img src="/item_images/'.$auction['item_id'].'.gif"/>

    tienes que tener una carpeta en htdocs o www llamada item_images cuando agregues un item te muestre la imagen de aquel con el id que sera el nombre de la imaagen



    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    6[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 6:23 am

    chili bizc

    chili bizc
    Miembro
    Miembro
    hola maya, oye no sale la imagen del item que se pone en venta, como si lo estuviera declarado

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    7[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 8:17 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    chili bizc escribió:hola maya, oye no sale la imagen del item que se pone en venta, como si lo estuviera declarado

    revise la imagen en la shop dandole clic derecho y inspeccionar elemento y revise cual es la direccion de la imagen



    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    8[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 9:14 am

    Mezzony

    Mezzony
    Miembro
    Miembro
    hola una pregunta, se puede modificar, para que en vez de golds, sea en otra moneda, o mejor dicho VIP Coins, (id; 11192), o premium points en su defecto???, solo me deja vender por muy pocos golds!!

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    9[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 9:27 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Mezzony escribió:hola una pregunta, se puede modificar, para que en vez de golds, sea en otra moneda, o mejor dicho VIP Coins, (id; 11192), o premium points en su defecto???, solo me deja vender por muy pocos golds!!

    Código:


      doPlayerRemoveMoney(cid, buy:getDataInt("cost"))  ----------->  aqui es donde puede ver y trabajar para que sea un objeto


                            db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";")
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. buy:getDataInt("count") .. " ".. buy:getDataString("item_name") .. " for " .. buy:getDataInt("cost") .. " gps!")
                            db.executeQuery("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. buy:getDataInt("cost") .. " WHERE `id` = " .. buy:getDataInt("player") .. ";")
                            buy:free()



    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    10[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 9:44 am

    Mezzony

    Mezzony
    Miembro
    Miembro
    Me Ayudarias???? de verdad no se como cambiar a un objeto!
    if doPlayerRemoveItem(cid,10136,1) then ese seria bien?

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    11[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 10:14 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Mezzony escribió:Me Ayudarias???? de verdad no se como cambiar a un objeto!
    if doPlayerRemoveItem(cid,10136,1) then ese seria bien?

    ESTA ES LA LINEA APRA QUE VERIFUQE

    Código:
     if(getPlayerMoney(cid) < buy:getDataInt("cost")) then

    USE LA FUNCION GETPLAYERITEMCOUNT



    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    12[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Lun Jun 29, 2020 10:43 am

    Mezzony

    Mezzony
    Miembro
    Miembro
    Disculpa Mi Ignorancia, Pero Quede igual :S no se manejar los scripts :S

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    13[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Jue Sep 03, 2020 9:00 pm

    Notch

    Notch
    Miembro
    Miembro
    sirve para 0.4?

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    14[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Vie Sep 04, 2020 10:37 am

    chili bizc

    chili bizc
    Miembro
    Miembro
    Si funciona en tfs 0.4, uso gesior 2012 tfs 0.4 y funciona

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    15[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Vie Sep 04, 2020 3:06 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    chili bizc escribió:Si funciona en tfs 0.4, uso gesior 2012 tfs 0.4 y funciona

    Si funciona


    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    16[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Jue Sep 10, 2020 8:30 am

    Cetronic

    Cetronic
    Nuevo Miembro
    Nuevo Miembro
    Me funciono perfectamente... solo una cosa cuando intentas agregar un item con el gm, cm, o god te va a salir este mensaje  "Item wich such name does not exists." no te preocupes no es un error por que un jugador lo puede agregar normalmente.

    si yo agregaba este código en el index.php:

    Código:
    case "tradeoff";
       $topic = "Trade Off";
       $subtopic = "tradeoff";
       include("tradeoff.php");
    break;

    no me cargaba nada me salía error 500, solo lo elimine y listo...

    los que usan gesior hay que cambiar esto "/item_images/" por esto "/images/items/" en el tradeoff.php o dependiendo donde tengas las imágenes de tus items para que carguen bien en la pagina. si no están agregados los items solo ve a tibiawiki, o alguna fan page de tibia oficial y buscas por el nombre del item por ejemplo "Royal Scale Robe" y guardas la imagen como gif pero con el Item ID de tu OTServ por ejemplo en mi caso "12604.gif" y la metes en la carpeta de imágenesy listo.



    Última edición por Cetronic el Jue Sep 10, 2020 8:46 am, editado 2 veces

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    17[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Sáb Mayo 01, 2021 12:42 pm

    ioke

    ioke
    Miembro
    Miembro
    este sistema esta genial lo único que falta modificarlo para subir items que necesitas en vez de querer vender por ejemplo si necesitas conseguir una sword pues creas tu oferta por dicha sword poniendo la cantidad de dinero que vas a pagar por la espada di alguien te la vende

    !offer buy,itemname, precio, cantidad esto para comprar objetos
    !offer sell,itemname, precio, cantidad esto para vender objetos

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://baiakciteron.sytes.net

    18[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Vie Mayo 05, 2023 8:15 am

    kusilla

    kusilla
    Miembro
    Miembro
    buenas no se si alguien puede ayudarme les explico
    El sistema de TRADEOFF que subieron aqui a mi no me funciono , pero encontre uno por otro lado.
    ya lo adapte para que se almacene el dinero el aution_balance pero al agrega el withdraw que dejaron aquí da errores y eso es normal ya que lo agrege de otro lado
    Me encantaria que alguien con sus conocimientos me lo adaptara para este LUA , por favor aqui les dejo mi lua completo para que adapten la parte final de withdraw



    Código:
    local config = {
     levelRequiredToAdd = 20,
     maxOffersPerPlayer = 10,
     valuePerOffer = 500,
     blockedItems = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933}
    }

    function onSay(player, words, param)
     if param == '' then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You must be in the protection zone to use these commands.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getExhaustion(Storage.exhaustion) > 0 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need to wait a time.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     local word = param:split(",")
     if word[1] == "add" then
     if not word[2] or not word[3] or not word[4] then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required. Ex: !offer add, ItemName, ItemCount, ItemPrice")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end
     
     local itemCount = tonumber(word[3])
     local itemValue = tonumber(word[4])
     if not itemCount or not itemValue then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't set valid price or items count.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif itemCount < 1 or itemValue < 1 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to type a number higher than 0.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif string.len(itemCount) > 3 or string.len(itemValue) > 7 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "This price or item count is too high.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getLevel() < config.levelRequiredToAdd then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't have required level ".. config.levelRequiredToAdd ..".")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     player:setExhaustion(Storage.exhaustion, 5)

     local offers = 0
     local playerId = player:getGuid()
     local resultId = db.storeQuery("SELECT `id` FROM `auction_system` WHERE `player` = " .. playerId)
     if resultId ~= false then
     repeat
     offers = offers + 1
     until not result.next(resultId)
     result.free(resultId)
     end

     if offers >= config.maxOffersPerPlayer then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't add more offers (max. " .. config.maxOffersPerPlayer .. ")")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     -- Trim left
     word[2] = word[2]:gsub("^%s*(.-)$", "%1")

     local itemId = ItemType(word[2]):getId()
     itemCount = math.floor(itemCount)
     if itemId == 0 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif table.contains(config.blockedItems, itemId) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "This item is blocked.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getItemCount(itemId) < itemCount then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have this item(s).")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     if player:getMoney() >= config.valuePerOffer then
     if not player:removeItem(itemId, itemCount) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have the necessary items!")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif not player:removeMoney(config.valuePerOffer) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need ".. config.valuePerOffer .." gold coins to add an offer in auction system.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     else
     local itemName = ItemType(itemId):getName()
     itemValue = math.floor(itemValue)
     db.query("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. playerId .. ", \"" .. db.escapeString(itemName) .. "\", " .. itemId .. ", " .. itemCount .. ", " .. itemValue ..", " .. os.time() .. ")")
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You successfully add " .. itemCount .." " .. itemName .." for " .. itemValue .. " gold coins to auction system.")
     end
     else
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need ".. config.valuePerOffer .." gold coins to add an offer in auction system.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     end

     return false

     elseif word[1] == "buy" then

     if not word[2] then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required. Ex: /offer buy, AuctionID")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     local id = tonumber(word[2])
     if not id then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     player:setExhaustion(Storage.exhaustion, 5)

     local resultId = db.storeQuery("SELECT * FROM `auction_system` WHERE `id` = " .. id)
     if resultId == false then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "This offer does not exist.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     local playerId = result.getNumber(resultId, "player")
     local itemValue = result.getNumber(resultId, "cost")
     local itemId = result.getNumber(resultId, "item_id")
     local itemCount = result.getNumber(resultId, "count")
     result.free(resultId)

     if player:getGuid() == playerId then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can't buy your own items.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getFreeCapacity() < ItemType(itemId):getWeight() then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't have capacity.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif not player:removeMoney(itemValue) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enoguh gold coins.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     else
     player:addItem(itemId, itemCount)
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought " .. itemCount .. " ".. ItemType(itemId):getName() .. " for " .. itemValue .. " gold coins in auction system!")
     db.query("DELETE FROM `auction_system` WHERE `id` = " .. id)
     local seller = Player(playerId)
     if seller then

     else
     db.query("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. itemValue .. " WHERE `id` = " .. playerId .. ";")
     end
     end

     return false

     elseif word[1] == "list" then

     player:setExhaustion(Storage.exhaustion, 5)

     local message = "Trade Offline:\n\n!offer add, ItemName, ItemCount, ItemPrice\n!offer buy, AuctionID\n!offer remove, AuctionID\n\n"
     local resultId = db.storeQuery("SELECT * FROM `auction_system` ORDER BY `id` ASC")
     if resultId ~= false then
     repeat
     local auctionId = result.getNumber(resultId, "id")
     local itemId = result.getNumber(resultId, "item_id")
     local itemCount = result.getNumber(resultId, "count")
     local itemValue = result.getNumber(resultId, "cost")
     message = ""..message.."ID: ".. auctionId .." - ".. itemCount .." ".. ItemType(itemId):getName() .." for ".. itemValue .." gold coins.\n"
     until not result.next(resultId)
     result.free(resultId)
     player:popupFYI(message)
     else
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is not offer in the system.")
     end
     end

    if(t[1] == "withdraw") then
                    local balance = db.getResult("SELECT `auction_balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                    if(balance:getDataInt("auction_balance") < 1) then
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have money on your auction balance.")
                            balance:free()
                            return true
                    end
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got " .. balance:getDataInt("auction_balance") .. " gps from auction system!")
                    doPlayerAddMoney(cid, balance:getDataInt("auction_balance"))
                    db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                    balance:free()
            end
            return true
    end

    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    19[Html] Trade OFF - Shop Offline Empty Re: [Html] Trade OFF - Shop Offline Vie Mayo 05, 2023 2:19 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    kusilla escribió:buenas no se si alguien puede ayudarme les explico
    El sistema de TRADEOFF que subieron aqui a mi no me funciono , pero encontre uno por otro lado.
    ya lo adapte para que se almacene el dinero el aution_balance pero al agrega el withdraw que dejaron aquí da errores y eso es normal ya que lo agrege de otro lado
    Me encantaria que alguien con sus conocimientos me lo adaptara para este LUA , por favor aqui les dejo mi lua completo para que adapten la parte final de withdraw



    Código:
    local config = {
     levelRequiredToAdd = 20,
     maxOffersPerPlayer = 10,
     valuePerOffer = 500,
     blockedItems = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933}
    }

    function onSay(player, words, param)
     if param == '' then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif not Tile(player:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You must be in the protection zone to use these commands.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getExhaustion(Storage.exhaustion) > 0 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need to wait a time.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     local word = param:split(",")
     if word[1] == "add" then
     if not word[2] or not word[3] or not word[4] then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required. Ex: !offer add, ItemName, ItemCount, ItemPrice")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end
     
     local itemCount = tonumber(word[3])
     local itemValue = tonumber(word[4])
     if not itemCount or not itemValue then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't set valid price or items count.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif itemCount < 1 or itemValue < 1 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to type a number higher than 0.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif string.len(itemCount) > 3 or string.len(itemValue) > 7 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "This price or item count is too high.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getLevel() < config.levelRequiredToAdd then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't have required level ".. config.levelRequiredToAdd ..".")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     player:setExhaustion(Storage.exhaustion, 5)

     local offers = 0
     local playerId = player:getGuid()
     local resultId = db.storeQuery("SELECT `id` FROM `auction_system` WHERE `player` = " .. playerId)
     if resultId ~= false then
     repeat
     offers = offers + 1
     until not result.next(resultId)
     result.free(resultId)
     end

     if offers >= config.maxOffersPerPlayer then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't add more offers (max. " .. config.maxOffersPerPlayer .. ")")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     -- Trim left
     word[2] = word[2]:gsub("^%s*(.-)$", "%1")

     local itemId = ItemType(word[2]):getId()
     itemCount = math.floor(itemCount)
     if itemId == 0 then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif table.contains(config.blockedItems, itemId) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "This item is blocked.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getItemCount(itemId) < itemCount then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have this item(s).")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     if player:getMoney() >= config.valuePerOffer then
     if not player:removeItem(itemId, itemCount) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have the necessary items!")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif not player:removeMoney(config.valuePerOffer) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need ".. config.valuePerOffer .." gold coins to add an offer in auction system.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     else
     local itemName = ItemType(itemId):getName()
     itemValue = math.floor(itemValue)
     db.query("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. playerId .. ", "" .. db.escapeString(itemName) .. "", " .. itemId .. ", " .. itemCount .. ", " .. itemValue ..", " .. os.time() .. ")")
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You successfully add " .. itemCount .." " .. itemName .." for " .. itemValue .. " gold coins to auction system.")
     end
     else
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need ".. config.valuePerOffer .." gold coins to add an offer in auction system.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     end

     return false

     elseif word[1] == "buy" then

     if not word[2] then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required. Ex: /offer buy, AuctionID")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     local id = tonumber(word[2])
     if not id then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     player:setExhaustion(Storage.exhaustion, 5)

     local resultId = db.storeQuery("SELECT * FROM `auction_system` WHERE `id` = " .. id)
     if resultId == false then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "This offer does not exist.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     end

     local playerId = result.getNumber(resultId, "player")
     local itemValue = result.getNumber(resultId, "cost")
     local itemId = result.getNumber(resultId, "item_id")
     local itemCount = result.getNumber(resultId, "count")
     result.free(resultId)

     if player:getGuid() == playerId then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can't buy your own items.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif player:getFreeCapacity() < ItemType(itemId):getWeight() then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't have capacity.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     elseif not player:removeMoney(itemValue) then
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enoguh gold coins.")
     player:getPosition():sendMagicEffect(CONST_ME_POFF)
     return false
     else
     player:addItem(itemId, itemCount)
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought " .. itemCount .. " ".. ItemType(itemId):getName() .. " for " .. itemValue .. " gold coins in auction system!")
     db.query("DELETE FROM `auction_system` WHERE `id` = " .. id)
     local seller = Player(playerId)
     if seller then

     else
     db.query("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. itemValue .. " WHERE `id` = " .. playerId .. ";")
     end
     end

     return false

     elseif word[1] == "list" then

     player:setExhaustion(Storage.exhaustion, 5)

     local message = "Trade Offline:\n\n!offer add, ItemName, ItemCount, ItemPrice\n!offer buy, AuctionID\n!offer remove, AuctionID\n\n"
     local resultId = db.storeQuery("SELECT * FROM `auction_system` ORDER BY `id` ASC")
     if resultId ~= false then
     repeat
     local auctionId = result.getNumber(resultId, "id")
     local itemId = result.getNumber(resultId, "item_id")
     local itemCount = result.getNumber(resultId, "count")
     local itemValue = result.getNumber(resultId, "cost")
     message = ""..message.."ID: ".. auctionId .." - ".. itemCount .." ".. ItemType(itemId):getName() .." for ".. itemValue .." gold coins.\n"
     until not result.next(resultId)
     result.free(resultId)
     player:popupFYI(message)
     else
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is not offer in the system.")
     end
     end

    if(t[1] == "withdraw") then
                    local balance = db.getResult("SELECT `auction_balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                    if(balance:getDataInt("auction_balance") < 1) then
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have money on your auction balance.")
                            balance:free()
                            return true
                    end
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got " .. balance:getDataInt("auction_balance") .. " gps from auction system!")
                    doPlayerAddMoney(cid, balance:getDataInt("auction_balance"))
                    db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                    balance:free()
            end
            return true
    end

    el sistema del tema principal es para tfs 0.4 y otx 2



    [Html] Trade OFF - Shop Offline YNU5B25
    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    +4
    Notch
    Mezzony
    Waach
    [Admin] God Maya
    8 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).