Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • 3 months later...

Testado com o Geisor ACC 2012 + TFS 0.4(8.6) funcionou perfeitamente, porem só tive que omitir o case do index.php:

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

para isso:

//case "tradeoff";
   $topic = "Trade Off";
   $subtopic = "tradeoff";
   include("tradeoff.php");
break;

Muito Obrigado por compartilhar isso!

Link para o post
Compartilhar em outros sites
  • 5 months later...

Ôtimo script do King Natan, para os que não conseguiram por imagem é simples, basta alocar no script para a pasta images/items/ do seu site.

Link para o post
Compartilhar em outros sites
  • 4 weeks later...
Em 25/05/2014 em 20:44, Natanael Beckman disse:

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 ;


 

 

Esse código aqui está dando erro ao executar no bando de dados. Parece que essa última linha não passa.

Alguma sugestão de como resolver?

cms1-pr%C3%AAmio.png

Link para o post
Compartilhar em outros sites
  • 1 year later...

Fala galera tudo certinho?

 

Eu sei que estou um pouco atrasado, e nem sei se posso estar ressuscitando esse tópico, mas eu notei que no 8.6 existem alguns pontos que podiam ser melhorados no script então eu dei uma atualizada aqui no meu e trouxe para compartilhar aqui com vocês.

 

Citar

local config = {
        levelRequiredToAdd = 1,
        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, "Este comando requer parametros.")
                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, "Este comando requer parametros.")
                        return true
                end
                if(not tonumber(t[3]) or (not tonumber(t[4]))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce inseriu um preco ou uma quantidade de itens invalida.")
                        return true
                end
                if(string.len(t[3]) > 9 or (string.len(t[4]) > 3)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O preco ou quantidade deste itens sao muito altos, o preco maximo pelo item eh de 999999999, e a quantidade maxima inserida eh de 3.")
                        return true
                end
                local item = getItemIdByName(t[2])
                if(not item) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O item com esse nome não existe.")
                        return true
                end
                if(getPlayerLevel(cid) < config.levelRequiredToAdd) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem o level requerido (" .. config.levelRequiredToAdd .. ").")
                        return true
                end
                if(isInArray(config.blocked_items, item)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este item eh bloqueado.")
                        return true
                end
                if(getPlayerItemCount(cid, item) < (tonumber(t[4]))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem esse item.")
                        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, "Voce nao pode adicionar mais ofertas, maximo de: " .. config.maxOffersPerPlayer)
                        return true
                end
                if(config.SendOffersOnlyInPZ) then    
                        if(not getTilePzInfo(getPlayerPosition(cid))) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Precisa estar em Zona de Protecao (PZ) para fazer oferta.")
                                return true
                        end
                end
                if(tonumber(t[4]) < 1 or (tonumber(t[3]) < 1)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O preco ou numero tem que ser maiores que 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, "Voce adcionou " .. itemcount .." " .. t[2] ..", por " .. costgp .. " Gps.")
        end
        if(t[1] == "buy") then
                if(not tonumber(t[2])) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido. Para verificar os ID's digite !offer list ou !offer list, nome do item.")
                        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, "Voce nao tem Gps suficientes.")
                                buy:free()
                                return true
                        end
                        if(getPlayerName(cid) == getPlayerNameByGUID(buy:getDataInt("player"))) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode comprar seus proprios itens, mas pode remove-los digitando !offer remove, ID.")
                                buy:free()
                                return true
                        end
                        if(getPlayerFreeCap(cid) < getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")))then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce tentou comprar um " .. buy:getDataString("item_name") .. ". Que pesa " .. getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")) .. "oz. E voce tem apenas " .. getPlayerFreeCap(cid) .. "oz. Livre, alivie o peso antes de comprar.")
                                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, "Voce comprou " .. buy:getDataInt("count") .. " ".. buy:getDataString("item_name") .. " por " .. buy:getDataInt("cost") .. " Gps! Legal.")
                        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, "ID invalido.")
                end
        end
        if(t[1] == "remove") then
                if((not tonumber(t[2]))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido.")
                        return true
                end
                                if(config.SendOffersOnlyInPZ) then    
                                        if(not getTilePzInfo(getPlayerPosition(cid))) then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce deve estar em Zona de Protecao (PZ) quando for remover seus itens.")
                                                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, "Voce removeu sua oferta.")
                        else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esta oferta nao eh sua.")
                        end
                delete:free()
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido.")
                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, "Voce nao tem dinheiro para retirar.")
                        balance:free()
                        return true
                end
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu " .. balance:getDataInt("auction_balance") .. " gps do Trade Offline!")
                doPlayerAddMoney(cid, balance:getDataInt("auction_balance"))
                db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                balance:free()
        end
        --[[ Tentativa de listar os itens sem o gesior ]]
        if(t[1] == "list" and (not t[2])) then
            local result = db.getResult("SELECT * FROM `auction_system` ORDER BY `auction_system`.`id` DESC")
            if result:getID() == -1 then
                return true
            end
            --[[local msg = "+-----------+\n" .. 
                        "|  Trade Offline:  |\n" ..
                        "+-----------+\n\n" ]]
            local msg = ""
            local counter = 0    
            
            while true do
                local id = result:getDataString("id")
                local name = getPlayerNameByGUID(result:getDataString("player"))
                local item_name = getItemNameById(result:getDataString("item_id"))
                local count = result:getDataString("count")
                local custo = result:getDataString("cost")/1000
                local custo2 = result:getDataString("cost")
                --[[if isPlayer(cid) then
                    msg = ""..msg.."ID: "..id.." -Item: "..item_name.." -Quantidade: "..count.." -Preco: "..custo.."k("..custo2.."GP) -Dono: "..name.."\n"
                end ]]
                if isPlayer(cid) then
                    msg = "" ..msg.. "ID: " ..id.. " " ..item_name.. " Preco: " ..custo2.. "GP\n"
                end
                if not result:next() then
                    break
                end
                if(counter==39) then
                    break
                end
                counter = counter + 1;
            end
            --doPlayerPopupFYI(cid, msg) return true
            doShowTextDialog(cid, 2175, msg)
        end
        if(t[1] == "list" and t[2] ~= nil) then
            local item = getItemIdByName(t[2])
            if(not item) then
                doMutePlayer(cid, 10)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O item com esse nome nao existe, voce sera mutado por 10 segundos. Tenha atencao ao digitar o nome do item.")
                return true
            end
            local result = db.getResult("SELECT * FROM `auction_system` where `auction_system`.`item_id`=" ..item.. " ORDER BY `auction_system`.`cost` ASC")
            if result:getID() == -1 then
                return true
            end
            local msg = "+-----------+\n" .. 
                        "|  Trade Offline:  |\n" ..
                        "+-----------+\n\n"
            local msg = ""
            local counter = 0    
            
            while true do
                local id = result:getDataString("id")
                local name = getPlayerNameByGUID(result:getDataString("player"))
                local item_name = getItemNameById(result:getDataString("item_id"))
                local count = result:getDataString("count")
                local custo = result:getDataString("cost")/1000
                local custo2 = result:getDataString("cost")
                if isPlayer(cid) then
                    msg = ""..msg.."ID: "..id.." -Item: "..item_name.." -Quantidade: "..count.." -Preco: "..custo.."k("..custo2.."GP) -Dono: "..name.."\n"
                end
                --[[ if isPlayer(cid) then
                    msg = "" ..msg.. "ID: " ..id.. " " ..item_name.. " Preco: " ..custo2.. "GP\n"
                end ]]
                if not result:next() then
                    break
                end
                if(counter==9) then
                    break
                end
                counter = counter + 1;
            end
            doPlayerPopupFYI(cid, msg) return true
        end
        --[[ Fim da listagem sem o Gesior ]]
        if(t[1] == "my") then
            local result = db.getResult("SELECT `auction_system`.* FROM `auction_system` JOIN `players` WHERE `auction_system`.`player` = `players`.`id` AND `players`.`name` = '"..getPlayerName(cid).."'")
            if result:getID() == -1 then
                doPlayerPopupFYI(cid, getPlayerName(cid)) return true
            end
            local msg = "+----------------+\n" .. 
                        "| Suas ofertas no trade: |\n" ..
                        "+----------------+\n\n"
            local counter = 0    
            
            while true do
                local id = result:getDataString("id")
                local name = getPlayerNameByGUID(result:getDataString("player"))
                local item_name = getItemNameById(result:getDataString("item_id"))
                local count = result:getDataString("count")
                local custo = result:getDataString("cost")
                if isPlayer(cid) then
                    msg = ""..msg.."ID: "..id.." -Item: "..item_name.." -Quantidade: "..count.." -Preco: "..custo.." GP\n"
                end
                --[[ if isPlayer(cid) then
                    msg = "" ..msg.. "ID: " ..id.. " " ..item_name.. " Preco: " ..custo2.. "GP\n"
                end ]]
                if not result:next() then
                    break
                end
                if(counter==9) then
                    break
                end
                counter = counter + 1;
            end
            doPlayerPopupFYI(cid, msg) return true
        end
        
        if(t[1] == "info") then
            local msg = "+--------------------------------------------------+\n" ..
                        "| !offer buy, ID - Compra uma oferta pelo ID\n" ..
                        "| !offer remove, ID - Remove sua oferta pelo ID\m" ..
                        "| !offer my - Lista suas ofertas atuais no Trade\n"..
                        "| !offer add, NomeItem, PrecoItem, QuantidadeItem\n" ..
                        "| !offer withdraw - Retira todo o dinheiro do Trade Offline\n" ..
                        "| !offer list -- Mostra os ultimos 40 itens do Trade Offline\n" ..
                        "| !offer list, NomeItem -- Mostra os 10 itens mais baratos pelo nome\n" ..
                        "+--------------------------------------------------+\n"
            doPlayerPopupFYI(cid, msg) return true
        end
        return true
end

Agora quando o player disser:

          !offer my - Vai ser listado somente as coisas que ele colocou para negociar, assim fica mais fácil de remover.

          !offer info - Vai mostrar as opções e como utilizar os comandos.

          !offer list, NomeItem - Vai mostrar os 10 itens mais baratos pelo nome que foi procurado.

Lembrando que essa alteração no Script é válida apenas para pessoas que como eu não vão usar Web Site.

Todos os avisos de retorno em caso de erro foram traduzidos para português também, fiz isso pensando na galera que ainda não ta fera no inglês.

 

Bom sem mais, só gostaria de pedir uma ajuda com o método: getItemNameById()

Alguém saberia me dizer como evitar que ele retorne um erro no Console do Ot server caso alguém digite o nome de um item errado?

A solução paliativa que eu coloquei para evitar que ficasse imprimindo muitos erros no console, foi dar um mute de 10 segundos no jogador que digita-se o nome do item errado.

 

Valeu ai, obrigado ?

..:: Novos horizontes estão a caminho ::..

 

"É com um enaltecer maduro que vejo essa comunidade como uma grande família em que posso confiar e contar.

Mantenhamos vivo o modelo Open Tibia Server para futuras gerações.

Para que novos entretenimentos como esse RPG surjam e cresçam."

 

"Nunca esqueçam que os momentos bons não são eternos, eles vêm o aproveitamos e ele se vai.

Dessa mesma maneira são os momentos ruins, eles vêm o enfrentamos e ele se vai.

Não se deixe abater pelas adversidades ou dificuldades, lute, enfrente e conquiste.

Não espere que alguém o guie sempre pela mão."

 

 

Dev Helpers

     Raythan - Ishikawa

 

 

download.png

Link para o post
Compartilhar em outros sites

@Azzus22 Não testei o script, porém, só o fato de vim aqui melhorar o script para quem precisa já merece elogios.

Sobre sua dúvida, já pensou em olhar o script de criar itens do OTServ (o famoso /i )? Pelo menos parece um pouco com sua dúvida.

Tipo assim:

 

	local ret = RETURNVALUE_NOERROR
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esta faltando comandos.")
		return true
	end
	if(ret ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não existe esse item")
		return true
	end

 

Não testei, não sei se dará certo, mas...

cms1-pr%C3%AAmio.png

Link para o post
Compartilhar em outros sites
  • 8 months later...
  • 4 weeks later...
  • ESSA PARTE AKI NAO DEU MUITO BOM NAO.
     
  • File: C:\xampp\htdocs/index.php   Line: 33
 index.php adicione esse code:
case "tradeoff";
   $topic = "Trade Off";
   $subtopic = "tradeoff";
   include("tradeoff.php");
break;
Link para o post
Compartilhar em outros sites

@Natanael Beckman  essa parte qual Index.php vc ta falando

case "tradeoff";
   $topic = "Trade Off";
   $subtopic = "tradeoff";
   include("tradeoff.php");
break;
Spoiler

<?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

tem outro Index.php fora esse

@Bruder0v Warning: include(tradeoff.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\index.php on line 5

Warning: include() [function.include]: Failed opening 'tradeoff.php' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\index.php on line 5

Fatal error: Cannot break/continue 1 level in C:\xampp\htdocs\index.php on line 6

 

FIZ QUE NEM VC MAIS DA ISSO

Editado por Rush Of Dead (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • 3 months later...
Em 25/05/2014 em 20:44, Natanael Beckman disse:

Esse sistema disponibiliza uma negociação offline, onde você oferta um item e esse item é divulgado no site do server e qualquer player pode comprar o item utilizando um comando especificado.

 

Crie uma arquivo .lua dentro da pasta data/talkactions/scripts com o nome auctionsystem.lua, dentro do mesmo adicione o code:


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

Em seguida em talkactions.xml adicione a tag:


<talkaction words="!offer" event="script" value="auctionsystem.lua"/>

No banco de dados execute as querys:


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 ;

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

Na pasta do seu site crie um arquivo chamado tradeoff.php, em seguida adicione o code:


<?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>';
}
    ?> 

Em layouts.php adcione o code:


                                <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>

Pra finalizar em index.php adicione esse code:


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

m1m4mJw.png

-

E pronto galera clica em GOSTEI e comenta no tópico.

 

Opa amigo, boa tarde, estou com um problema na parte do index.php, quando coloco aquele script o site para de funcionar com o seguinte erro: Parse error: syntax error, unexpected 'case' (T_CASE) in C:\xampp\htdocs\index.php on line 39, sabe como posso resolver? Obrigado pela ajuda! o script está top!!

Link para o post
Compartilhar em outros sites
Em 25/05/2014 em 20:44, Natanael Beckman disse:

Esse sistema disponibiliza uma negociação offline, onde você oferta um item e esse item é divulgado no site do server e qualquer player pode comprar o item utilizando um comando especificado.

 

Crie uma arquivo .lua dentro da pasta data/talkactions/scripts com o nome auctionsystem.lua, dentro do mesmo adicione o code:


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

Em seguida em talkactions.xml adicione a tag:


<talkaction words="!offer" event="script" value="auctionsystem.lua"/>

No banco de dados execute as querys:


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 ;

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

Na pasta do seu site crie um arquivo chamado tradeoff.php, em seguida adicione o code:


<?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>';
}
    ?> 

Em layouts.php adcione o code:


                                <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>

Pra finalizar em index.php adicione esse code:


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

m1m4mJw.png

-

E pronto galera clica em GOSTEI e comenta no tópico.

 

fiz tudo certinho e aparece esse erro no site:

 

Parse error: syntax error, unexpected 'case' (T_CASE) in C:\xampp\htdocs\index.php on line 41

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por looktsx
      Salve Rapaziada tudo bom .
      queria ajuda pra cria um teleport ou uma alavanca com tempo ..
      depois do player usa o teleport ou a lavanca ele so poderá usa depois de tal determinado tempo.
       
      SERVIDOR 12.91
      Se alguem poder me ajuda vou fica grato ,
      des de ja agradeço a todos.
      ..
    • Por willian646
      O evento é totalmente baseado no Foxy Quiz proveniente do GLA, no entanto é apenas uma base para vocês alterarem como acharem melhor.
      Para começar será necessario que você crie um arquivo em talkactions>scripts para entrar no evento, como por exemplo : participar.lua
      e entao colocar sua tag em talkactions.xml, como por exemplo: 
      <talkaction words="!participar;/participar" script="!participar.lua"/> Tendo feito isso você irá colar esse codigo dentro desse arquivo: 
      function onSay(cid, words, param)pos = {x=1236, y=1125, z=15} --POSIÇAO QUE O PLAYER IRÁ COM O COMANDO if getGlobalStorageValue(88788) == 1 then doSendMagicEffect(getPlayerPosition(cid),19) doTeleportThing(cid,pos) else doPlayerSendCancel(cid, "Desculpe mas o evento esta fechado !") end return true end Agora iremos para o script principal, vá em global events>scripts e crie o arquivo pokequiz.lua em seguida coloque sua tag em globalevents.xml como por exemplo: 
      <globalevent name="Pokequiz" interval="10" event="script" value="pokequiz.lua"/> Lembrando que o intervalo de inicio do evento é com vcs, Tendo feito isso abra o arquivo e cole o  seguinte código dentro : 
      quizstrg = 88788 local wave = 0 local CPpos = {x=1051, y=1047, z=7} --POSIÇAO QUE O PLAYER IRÁ SE ERRAR function wave_acresc() wave = wave + 1 addEvent(Quiz, 5000) end function Quiz() if wave == 1 then doBroadcastMessage("Na serie pokemon RAYQUAZA possui mega evolucao ?", RED) addEvent(Resposta, 10000) elseif wave == 2 then doBroadcastMessage("Na serie pokemon ARCEUS e considerado um pokemon RARO ?", RED) addEvent(Resposta, 10000) elseif wave == 3 then doBroadcastMessage("Na serie pokemon MEW criou os 3 caes lendarios ?", RED) addEvent(Resposta, 10000) elseif wave == 4 then doBroadcastMessage("Na serie pokemon ARCEUS tem o poder de mudar de tipo livremente ?", RED) addEvent(Resposta, 10000) elseif wave == 5 then doBroadcastMessage("Na serie pokemon GIRATINA possui 2 formas sendo elas alterada e fantasma ?", RED) addEvent(Resposta, 10000) elseif wave == 6 then doBroadcastMessage("Na serie pokemon DIALGA e PALKIA sao rivais ?", RED) addEvent(Resposta, 10000) elseif wave == 7 then doBroadcastMessage("Na serie pokemon CELEBI possui a habilidade de viajar entre dimensoes ?", RED) addEvent(Resposta, 10000) elseif wave == 8 then doBroadcastMessage("Na serie pokemon SOLGALEO e a primeira evolucao de cosmog ?", RED) addEvent(Resposta, 10000) elseif wave == 9 then doBroadcastMessage("Na serie pokemon MAGEARNA e uma das ultra beasts ?", RED) addEvent(Resposta, 10000) elseif wave == 10 then doBroadcastMessage("Na serie pokemon a cor original de MAGEARNA e laranja ?", RED) addEvent(Resposta, 10000) elseif wave == 11 then doBroadcastMessage("O evento Quiz terminou !", RED) addEvent(winPlayers, 5000) end end function Resposta() if wave == 1 then addEvent(TPFalso, 5000) elseif wave == 2 then addEvent(TPVerdadeiro, 5000) elseif wave == 3 then addEvent(TPVerdadeiro, 5000) elseif wave == 4 then addEvent(TPFalso, 5000) elseif wave == 5 then addEvent(TPVerdadeiro, 5000) elseif wave == 6 then addEvent(TPFalso, 5000) elseif wave == 7 then addEvent(TPVerdadeiro, 5000) elseif wave == 8 then addEvent(TPVerdadeiro, 5000) elseif wave == 9 then addEvent(TPVerdadeiro, 5000) elseif wave == 10 then addEvent(TPFalso, 5000) end end function TPFalso() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1236, y=1122, z=15} local posf = {x=1243, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) end addEvent(wave_acresc, 5000) end end function TPVerdadeiro() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1228, y=1122, z=15} local posf = {x=1235, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) end addEvent(wave_acresc, 5000) end end function winPlayers() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1228, y=1122, z=15} local posf = {x=1243, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) doPlayerAddItem(sid,2159, 10) end wave = 0 setGlobalStorageValue(88788, 0) end end --AVISOS DE INICIO function finalEventWarning() if getGlobalStorageValue(quizstrg) == 1 then setGlobalStorageValue(88788, 2) doBroadcastMessage("O evento Quiz fechou, a primeira pergunta surgira em 30 segundos.", RED) addEvent(wave_acresc, 30000) end end function secondEventWarning() if getGlobalStorageValue(quizstrg) == 1 then doBroadcastMessage("O evento Quiz ira iniciar em 1 minuto, usem o comando !participar ou /participar.", RED) addEvent(finalEventWarning, 60000) end end function firstEventWarning() if getGlobalStorageValue(quizstrg) == 1 then doBroadcastMessage("O evento Quiz ira iniciar em 3 minutos, usem o comando !participar ou /participar.", RED) addEvent(secondEventWarning, 120000) end end function onThink(interval, lastExecution) if getGlobalStorageValue(quizstrg) == 0 then setGlobalStorageValue(88788, 1) doBroadcastMessage("O evento Quiz ira iniciar em 5 minutos, usem o comando !participar ou /participar.", RED) addEvent(firstEventWarning, 120000) end return true end Já ia me esquecendo, a unica coisa ao qual vocês devem mudar de acordo com as coordenadas do seu mapa e área do evento são as funções TPVerdadeiro , TPFalso, winPlayers , elas servem para indicar qual área é a errada e teleportar quem tiver nessa área pro cp, caso o lado errado seja o esquerdo então será usado a função  TPVerdadeiro, e é a msm coisa para o outro lado, no caso da winPlayers é toda a área do evento.
       
      Aqui vai um exemplo: 
       
      E é isso rapaziada, não sei se já possui algum evento parecido por essas bandas, mas eu não encontrei ,então fiz  e resolvi contribuir com a comunidade, peço que se for repostar em algum outro lugar dê os devidos créditos, obg e até a próxima.
    • Por Ghaz
      Fala pessoal tudo bem?
       
      Estou com dificuldades em um script e preciso da ajuda dos magos do LUA rs.
       
      Tenho um script que quando o player morre (onDeath), ele faz algumas coisas e depois ele chama uma função que deveria retornar uma table (array) para eu fazer o for com o ipairs certinho. Segue abaixo o código:
       
       
      Segue abaixo a função getPlayersInArea:
       
       
      Acontece que no código de cima (do primeiro spoiler) eu dou um print no retorno da função getPlayersInArea, porém ela não tá me retornando a table, tá me retornando só: 2
       
       
       
      Alguém consegue me ajudar em, como raios eu faço a função retornar a lista de players ao invés da quantidade? Acredito que ta retornando o count da table, e não os itens do array.
       
       
      Agradeço desde já, valeu tchurma!
    • Por sannn
      --[[ /////////////////////////////////////////////////////////////////////////////////////////////////////// Discord: San#7791 -- Loja System 2.0 -- TFS 0.3.6 -- para adicionar qualquer item na loja: basta adicionar na tabelinha, seguindo o exemplo do vip! valor = quantidade de DIAMOND a ser cobrada; itemID = item a ser recebido; quantidade = quantidade de itens a ser recebidos; msg = mensagem que o player vai receber após comprar! Feito por San Discord: San#7791 exemplo de como comprar: !loja vip podendo ser adicionado a modules também. tag talkactions.xml // <talkaction words="!loja" case-sensitive="no" event="script" value="Loja System 2.0.lua"/> ////////////////////////////////////////////////////////////////////////////////////////////////////// depois de tantos sistemas com mil elseifs, vim trazer esta contribuição simples, para facilitar a vida de muitos adms! Contribuição pra comunidade =D ]]-- LOJA_CANCEL = "Você não possui diamantes o suficiente." LOJA_INVALID = "Não temos este item a venda na loja!" INVALID = "Comando incorreto" DIAMOND = 2145 -- item que será cobrado; tabelinha = { ["vip"] = {valor = 5, itemID = 2160, quantidade = 1, msg = "Obrigado por comprar um VIP em nossa loja!"}, -- coloque sempre minusculo o nome ! ["vip"]... etc } function onSay(cid, words, param, channel) local msg = string.lower(param) -- Não mexa! if msg == "" then doPlayerSendTextMessage(cid, 22, INVALID) return true end -- verificação if tabelinha[msg] == nil then doPlayerSendTextMessage(cid, 22, INVALID) return true end -- verificação if tabelinha[msg].valor then if getPlayerItemCount(cid, DIAMOND) >= tabelinha[msg].valor then doPlayerRemoveItem(cid, DIAMOND, tabelinha[msg].valor) doPlayerAddItem(cid, tabelinha[msg].itemID, tabelinha[msg].quantidade) doPlayerSendTextMessage(cid, 20, tabelinha[msg].msg) else doPlayerSendTextMessage(cid, 22, LOJA_CANCEL) return true end else doPlayerSendTextMessage(cid, 22, LOJA_INVALID) end return true end  
    • Por Guilherme.
      Bom galera, certa vez eu abri um servidor de tibia 8.55, ai pra incrementar ele resolvi colocar um sistema que faz com que o player compre os Itens VIPs direto do jogo.
       
       
      Funciona assim: Eu disponibilizei no site, a venda de moedas que podem ser usadas para comprar tanto VIP Account, quanto Itens VIP direto do jogo. O jogador que compra as moedas, recebe 100 delas e para poder comprar os itens eu editei uma TalkAction que veio no Baiak Yourots que era uma simples quest por comando, e transformei em uma ótima ferramenta para servidores com sistema vip.
      Vamos ao Script:
      Vá em data\talkactions\scripts , e crie um arquivo com o nome desejado e com o final ".lua" (Exemplo: ex.lua)
      Coloque isso dentro:
      Edite conforme você quiser, salve e feche.
      Laranja: ID do iten que vai servir como "moeda"
      Verde: Quantidade do iten
      Vermelho: ID do iten que o player vai receber quando usar o comando
      Azul: Quantidade do iten recebido
      Roxo: Palavra que aparecerá quando o player digitar o comando
      Rosa: Mensagem enviada ao player caso ele não tenha o iten ou quantidade neessária para a compra.
      Agora vá em "data\talkactions\" , edite o talkactions.xml
      Coloque isso la dentro:
      Verde: O Que o Player irá falar para usar o comando. ( Exemplo: !armor )
      Azul: O Nome do Arquivo que você criou em "data\talkactions\scripts". ( Exemplo: ex.lua )
      Créditos:
      Script: Baiak Lula ( Peguei o script do OT dele então, não tenho Certeza )
      Edição e Nova Função: Guilherme.
      COMENTEM !
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo