Ir para conteúdo
  • Cadastre-se

(Resolvido)[PEDIDO] Script dos Vagões de Kazordoon


Ir para solução Resolvido por kaiquegabriel,

Posts Recomendados

Estava verificando os possíveis bugs do meu servidor, quando fui passear por kazordoon e observei que meu NPC não vende os tickets para andar por kazordoon pelos vagões e os vagões também não estão funcionando! Uma boa alma poderia disponibilizar o script do sistema de vagões por favor!? E também preciso do script do npc Lokur (me ajudem com o serviço completo hein  ahsuahsuahsaushasuahsa).

Te Ajudei? Rep+  (y)

Link para o post
Compartilhar em outros sites

Tenta esse para o NPC :

"data/npc/lokur.xml"

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lokur" script="Lokur.lua" walkinterval="2000" floorchange="0">
  <health now="100" max="100" />
  <look type="69" head="57" body="79" legs="60" feet="114" corpse="6007" />
<voices>
<voice text="If you need help with letters or parcels, just ask me. I can explain everything." interval2="100" margin="1" yell="no"/>
<voice text="Also selling weekly tickets for the ore wagon service!" interval2="120" margin="1" yell="no"/>
<voice text="Welcome to the post office!" interval2="90" margin="1" yell="no"/>
</voices>
  <parameters>
        <parameter key="message_greet" value="How may I help you |PLAYERNAME|? Ask me for a {trade} if you want to buy something. I can also explain the {mail} system, sell {tickets} for the ore wagon service or give you access to your {bank} account."/>
        <parameter key="message_farewell" value="Come back if you need my services, |PLAYERNAME|."/>
		<parameter key="message_walkaway" value="Come back if you need my services, |PLAYERNAME|." />
		<parameter key="message_sendtrade" value="Here. Don't forget that you need to buy a label too if you want to send a parcel. Always write the name of the {receiver} in the first line and the name of the {city} in the second line." />
    <parameter key="module_shop" value="1" />
    <parameter key="shop_buyable" value="parcel,2595,15;letter,2597,8;label,2599,1;" />
  </parameters>
</npc>

"data/npc/scripts/lokur.lua"

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local transaction = {}
local transfer = {}
local transfer_name = {}
 
function onCreatureAppear(cid)
        npcHandler:onCreatureAppear(cid)                      
end
function onCreatureDisappear(cid)
        npcHandler:onCreatureDisappear(cid)                    
end
function onCreatureSay(cid, type, msg)
        npcHandler:onCreatureSay(cid, type, msg)              
end
function onThink()
        npcHandler:onThink()                                  
end
 
function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
        local function getMoneyCount(s)
                local b, e = s:find("%d+")
                return b and e and tonumber(s:sub(b, e)) or -1
        end
       
        local function doPlayerAddSafeMoney(cid, money)
                moneyAdd = money
                freeCap = getPlayerFreeCap(cid)
                crystalCoins = money >= 10000 and money / 10000 or 0
                money = money - crystalCoins * 10000
                platinumCoins = money >= 100 and money / 100 or 0
                money = money - platinumCoins * 100
                goldCoins = money
                if(freeCap >= (crystalCoins * 0.1 + platinumCoins * 0.1 + goldCoins * 0.1) and doPlayerAddMoney(cid, moneyAdd)) then
                        return true    
                else
                        return false
                end
        end
       
        -- Check Balance
        if(msgcontains(msg, "balance")) then
                balance = getPlayerBalance(cid)
                if(balance > 100000 and balance < 1000000) then
                        msg = "You certainly have made a pretty penny. "
                elseif(balance > 1000000 and balance < 10000000) then
                        msg = "Wow, you have reached the magic number of a million gp!!! "
                elseif(balance > 10000000) then
                        msg = "I think you must be one of the richest inhabitants of Tibia! "
                elseif (balance < 100000) then
                        msg = ""
                end
                npcHandler:say(msg .. "Your account balance is " .. balance .. " gold.", cid)
       
        -- Deposit All
        elseif(msg == "deposit all") then
                if(getPlayerMoney(cid) > 0) then
                        npcHandler:say("Do you really want to deposit " .. getPlayerMoney(cid) .. " to your bank account?", cid)
                        transaction[talkUser] = getPlayerMoney(cid)
                        talkState[talkUser] = 1
                else
                        npcHandler:say("You don't have any money with you.", cid)
                        transaction[talkUser] = 0
                        talkState[talkUser] = 0
                end
               
        -- Withdraw Money
        elseif(msgcontains(msg, "withdraw")) then
                npcHandler:say("How much money would you like to withdraw from your bank account?", cid)
                talkState[talkUser] = 2
        elseif(talkState[talkUser] == 2) then
                if tonumber(msg) == nil then
                        npcHandler:say("Please tell me a {number} you want to withdraw.", cid)
                        talkState[talkUser] = 2
                        return true
                end
                if(tonumber(msg) > 0 and getMoneyCount(msg) <= getPlayerBalance(cid)) then
                        npcHandler:say("Would you like to withdraw " .. getMoneyCount(msg) .. " gold from your bank account?", cid)
                        transaction[talkUser] = getMoneyCount(msg)
                        talkState[talkUser] = 3
                  elseif (tonumber(msg) < 1) then
                           npcHandler:say("Sure, you want nothing you get nothing!", cid)
                           talkState[talkUser] = 0
                elseif(getMoneyCount(msg) < 1) then
                        npcHandler:say("How much money would you like to withdraw from your bank account?", cid)
                elseif(getMoneyCount(msg) > getPlayerBalance(cid)) then
                        npcHandler:say("You don't have enought money on your bank account.", cid)
                        talkState[talkUser] = 0
                end
               
        -- Deposit Money
        elseif(msgcontains(msg, "deposit")) then
                npcHandler:say("How much money would you like to deposit to your bank account?", cid)
              talkState[talkUser] = 4
        elseif(talkState[talkUser] == 4) then
                if tonumber(msg) == nil then
                        npcHandler:say("Please tell me a {number} you want to deposit.", cid)
                        talkState[talkUser] = 4
                        return true
                end
                if(tonumber(msg) > 0 and getMoneyCount(msg) <= getPlayerMoney(cid)) then
                        npcHandler:say("Would you like to deposit " .. getMoneyCount(msg) .. " gold to your bank account?", cid)
                        transaction[talkUser] = getMoneyCount(msg)
                        talkState[talkUser] = 5
                  elseif(tonumber(msg) < 1) then
                           npcHandler:say("You are joking, aren't you??", cid)
                           talkState[talkUser] = 0
                elseif(getMoneyCount(msg) < 1) then
                        npcHandler:say("How much money would you like to deposit to your bank account?", cid)
                elseif(getMoneyCount(msg) > getPlayerMoney(cid)) then
                        npcHandler:say("You don't have enought money with you.", cid)
                        talkState[talkUser] = 0
                end
               
        -- Transfer Money
        elseif(msgcontains(msg, "transfer")) then
                npcHandler:say("Who do you want transfer money to?", cid)
                talkState[talkUser] = 6
        elseif(talkState[talkUser] == 6) then
                if(getPlayerGUIDByName(string.lower(msg)) > 0 and string.lower(msg) ~= string.lower(getCreatureName(cid))) then
                        transfer[talkUser] = getPlayerGUIDByName(string.lower(msg))
                        transfer_name[talkUser] = string.lower(msg)
                        npcHandler:say("How much money would you like to transfer?", cid)
                        talkState[talkUser] = 7
                else
                        npcHandler:say("There is no such player.", cid)
                        talkState[talkUser] = 0
                end
        elseif(talkState[talkUser] == 7) then
                if tonumber(msg) == nil then
                        npcHandler:say("Please tell me a {number} you want to transfer.", cid)
                        talkState[talkUser] = 7
                        return true
                end
                if(tonumber(msg) > 0 and getMoneyCount(msg) <= getPlayerBalance(cid)) then
                        npcHandler:say("Would you like to transfer " .. getMoneyCount(msg) .. " to " .. transfer_name[talkUser] .. "?", cid)
                        transaction[talkUser] = getMoneyCount(msg)
                        talkState[talkUser] = 8
                elseif(tonumber(msg) < 1) then
                        npcHandler:say("Please think about it. Okay?", cid)
                        talkState[talkUser] = 0
                elseif(getMoneyCount(msg) < 0) then
                        npcHandler:say("How much money would you like to transfer?", cid)
                elseif(getMoneyCount(msg) > getPlayerMoney(cid)) then
                        npcHandler:say("You don't have enought money on your bank account.", cid)
                        talkState[talkUser] = 0
                end
               
        -- Yes
        elseif(msgcontains(msg, "yes")) then  
                if(talkState[talkUser] == 1) then
                        if(getPlayerMoney(cid) == transaction[talkUser]) then
                                doPlayerRemoveMoney(cid, transaction[talkUser])
                                doPlayerSetBalance(cid, getPlayerBalance(cid)+ transaction[talkUser])
                                npcHandler:say("You deposited " .. transaction[talkUser] .. " gold coins to your bank account.", cid)
                                transaction[talkUser] = 0
                                talkState[talkUser] = 0
                        else
                                npcHandler:say("You don't have enought money.", cid)
                                transaction[talkUser] = 0
                                talkState[talkUser] = 1
                        end
                elseif(talkState[talkUser] == 3) then
                        if(doPlayerAddSafeMoney(cid, transaction[talkUser])) then
                                doPlayerSetBalance(cid, getPlayerBalance(cid)- transaction[talkUser])
                                npcHandler:say("You withdrawed " .. transaction[talkUser] .. " gold coins from your bank account.", cid)
                        else
                                npcHandler:say("You don't have anought capacity or slots in backpack to withdraw " .. transaction[talkUser] .. " gold.", cid)
                        end
                        transaction[talkUser] = 0
                        talkState[talkUser] = 0
                elseif(talkState[talkUser] == 5) then
                        if(transaction[talkUser] <= getPlayerMoney(cid)) then
                                doPlayerRemoveMoney(cid, transaction[talkUser])
                                doPlayerSetBalance(cid, getPlayerBalance(cid)+ transaction[talkUser])
                                npcHandler:say("You deposited " .. transaction[talkUser] .. " gold coins to your bank account.", cid)
                                transaction[talkUser] = 0
                                talkState[talkUser] = 0
                        else
                                npcHandler:say("You don't have enought money.", cid)
                                transaction[talkUser] = 0
                                talkState[talkUser] = 1
                        end
                elseif(talkState[talkUser] == 8) then
                        if(transaction[talkUser] <= getPlayerMoney(cid)) then
                                doPlayerRemoveMoney(cid, transaction[talkUser])
                                doPlayerSetBalance(cid, getPlayerBalance(cid)- transaction[talkUser])
                                npcHandler:say("You transfered " .. transaction[talkUser] .. " gold coins to " .. transfer_name[talkUser] .. "'s bank account.", cid)
                                    if(getPlayerByName(""..transfer_name[talkUser].."")) then
                                        doPlayerSetBalance(getPlayerByName(""..transfer_name[talkUser]..""), getPlayerBalance(getPlayerByName(""..transfer_name[talkUser].."")) + transaction[talkUser])
                                    else
                                        transferGold(""..transfer_name[talkUser].."", transaction[talkUser])
                                    end
                                transaction[talkUser] = 0
                                transfer[talkUser] = 0
                                transfer_name[talkUser] = ""
                                talkState[talkUser] = 0
                        else
                                npcHandler:say("You don't have enought money.", cid)
                                transaction[talkUser] = 0
                                talkState[talkUser] = 1
                        end
                end  
        elseif(msgcontains(msg, "no")) then
                npcHandler:say("The customer is king! Come back anytime you want to if you wish to withdraw your money.", cid)
                talkState[talkUser] = 0
	end
	-- WAGON TICKET
	if(msgcontains(msg, "ticket")) then
		if(getPlayerStorageValue(cid, 1131) < os.time()) then
			npcHandler:say("Do you want to purchase a weekly wagon ticket for 250 gold?", cid)
			talkState[talkUser] = 1
		end
	elseif(msgcontains(msg, "yes")) then
		if(talkState[talkUser] == 1) then
			if(getPlayerMoney(cid) >= 250) then
				doPlayerRemoveMoney(cid, 250)
				setPlayerStorageValue(cid, 1131, os.time() + 7 * 24 * 60 * 60 * 1000)
				npcHandler:say("Thank you for purchasing a wagon ticket.", cid)
			else
				npcHandler:say("You don't have enought money.", cid)
			end
			talkState[talkUser] = 0
		end
	elseif(talkState[talkUser] == 1) then 
		if(msgcontains(msg, "no")) then 
			npcHandler:say("No then.", cid)	
			talkState[talkUser] = 0
		end
	-- WAGON TICKET
	end
        return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Link para o post
Compartilhar em outros sites

Ui... muito bom!!! O NPC parece que já foi... jaja testo aqui. Mas falta o script para viajar pelos vagões de Kazordoon!

Te Ajudei? Rep+  (y)

Link para o post
Compartilhar em outros sites

Ve se esse de vagões está funcionando :

"data/actions/actions.xml"

<action fromaid="8034" toaid="8038" script="kazordoon/kazordoonOreWagons.lua"/>

"data/actions/kazordoon/kazordoonOreWagons.lua"

local nodes = {
	[8034] = {x = 32657, y = 31903, z = 8}, -- Depo
	[8035] = {x = 32606, y = 31905, z = 9}, -- Shops
	[8036] = {x = 32628, y = 31922, z = 11}, -- Temple
	[8037] = {x = 32576, y = 31973, z = 9}, -- Main Gate
	[8038] = {x = 32676, y = 31976, z = 15}, -- Steam Ship
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerStorageValue(cid, 1131) > os.time()) then
		if(getPlayerStorageValue(cid, 1132) < 100) then
			setPlayerStorageValue(cid, 1132, math.max(0, getPlayerStorageValue(cid, 1132)) + 1)
		end
		doTeleportThing(cid, nodes[item.actionid])
		doSendMagicEffect(nodes[item.actionid], CONST_ME_TELEPORT)
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "To travel by ore wagons you must purchase a wagon ticket from any kazordoon's merchant.")
	end
	return true
end
Link para o post
Compartilhar em outros sites

Na interface, deu a seguinte mensagem de erro:

 

[8/5/2014 21:49:5] [Error - Action Interface] 
[8/5/2014 21:49:5] data/actions/scripts/kazordoon/kazordoonOreWagons.lua:onUse
[8/5/2014 21:49:5] Description: 
[8/5/2014 21:49:5] ...ata/actions/scripts/kazordoon/kazordoonOreWagons.lua:12: bad argument #3 to 'max' (number expected, got nil)
[8/5/2014 21:49:5] stack traceback:
[8/5/2014 21:49:5] [C]: in function 'max'
[8/5/2014 21:49:5] ...ata/actions/scripts/kazordoon/kazordoonOreWagons.lua:12: in function <...ata/actions/scripts/kazordoon/kazordoonOreWagons.lua:9>

Te Ajudei? Rep+  (y)

Link para o post
Compartilhar em outros sites
  • Solução

local nodes = {
    [8034] = {x = 32657, y = 31903, z = 8}, -- Depo
    [8035] = {x = 32606, y = 31905, z = 9}, -- Shops
    [8036] = {x = 32628, y = 31922, z = 11}, -- Temple
    [8037] = {x = 32576, y = 31973, z = 9}, -- Main Gate
    [8038] = {x = 32676, y = 31976, z = 15}, -- Steam Ship
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerStorageValue(cid, 1131) > os.time()) then
        if(getPlayerStorageValue(cid, 1132) < 100) then
            setPlayerStorageValue(cid, 1132)
        end
        doTeleportThing(cid, nodes[item.actionid])
        doSendMagicEffect(nodes[item.actionid], CONST_ME_TELEPORT)
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "To travel by ore wagons you must purchase a wagon ticket from any kazordoon's merchant.")
    end
    return true
end

 

Tenta assim, vê se dá algum erro.

Skype @kaiquegabriel__ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Atenciosamente,

kaiquegabriel.

Não dou suporte via pm.

Em caso de dúvidas, crie um tópico e espere o suporte.

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 Nandozeraah
      E ai galera, recentemente eu estava precisando de um mapa clean (sem áreas obsoletas) e com cidades que fornecessem um bom pvp. 
      Logo lembrei do mapa das cidades free do Tibia e não conseguia encontrar então eu mesmo recortei de um servidor global e colei neste arquivo.
       
      As posições das cidades foram preservadas (igual ao global).
      O que contém:
      Thais (Fibula , Mintwalin). Venore (Poi, Orc Fortress). Ab'dendriel (Hellgate) Carlin (Banshee Quest, Demona, Ice Isles)... Kazordoon. Rookgaard Island of Destiny Respawns Originais (Opcional, você decide se faz o download do arquivo XML ao final do post). Houses (Opcional, você decide se faz o download do arquivo XML ao final do post).  
      Abaixo vocês podem ver o minimap:
       
      SCAN
      SCAN DO ARQUIVO AQUI (CLIQUE).
       
      DOWNLOAD (MANTER OS 3 ARQUIVOS NA MESMA PASTA ?)
      Download do MAPA aqui:
      Continente Free-spawn.xml
      Continente Free-house.xml
       
      OBS: coloquei o arquivo .otbm no MediaFire pois era muito grande para anexar ao post.
       
       
       
       
       
       
    • Por eddybrow
      O shop admin estava normal, isso foi depois que eu adicionei acho que o tutorial de anti-injection, ai ficou desse jeito.
      Esse tuto: http://www.tibiaking.com/forum/topic/26861-tutorial-protegendo-seu-gesior-e-xampp/
       
       
      Parou de criar ticket de atendimento também desse script abaixo.
      http://www.tibiaking.com/forum/topic/36314-sistema-de-ticket-atendimento-gesior-acc/
       
       
      Oque será ?
    • Por Absolute
      Fala galerinha do TK, depois de ver muitos pedidos em busca desse simples sistema, resolvi pegar um antigo meu e realizar algumas modificações para que vocês possam usar em seus servidores, aprimorando o atendimento aos seus players.
       
       
       
       
      Funcionamento;
       
       
      Quando o player logar a conta e clicar na página para abrir um chamado, irá abrir:
       

       
       
      Qualquer jogador com a conta logada, poderá abrir seu chamado, clicando em [Abrir chamado] (como mostra na imagem a cima). Então o mesmo será redirecionado para:

       
       
       
       
      Campos requeridos:
       
      Assunto;

      O nome já diz tudo, o motivo da abertura do chamado.
       
       
       
      Descrição;

      Nome também diz tudo, o assunto do motivo da abertura do chamado.
       
       
       
       
      Tag;

      Em tag ele selecionará o motivo do chamado (para ajudar o administrador dos tickets no assunto), Ficando mais ágil e bonito hihi .
       
       
       
       
      Prioridade;

      Em prioridade ele irá selecionar a prioridade da resposta do ticket, Alta; Normal ou Baixa.
       
       
       
       
       
      Pós clicar em "Submit" irá abrir o chamado como na imagem:

       
       
       
       
      Nota: Quando estiver logado com a conta do administrador (Page acess 6) irá aparecer na página um "Admin Painel" onde você irá ver, responder e gerenciar os chamados abertos pelos jogadores.
       
      Toda vez que o ticket for respondido o status é alterado para "Respondido" e então caso ainda haja alguma dúvida o players poderá responder o ticket, até você selecionar o status como "Fechado"


       
       

      Creio que está bem explicado o funcionamento.
       
       
       
      Enfim, agora vamos a instalação do sistema *-*
       
       
      Primeiramente na sua pasta htocs(em windows) ou www(no caso de linux), ou seja, na pasta do seu site, onde fica as páginas principais como: latestnews.php, arichive.php, highscores.php e companhia.
      Nesta pasta crie um arquivo com o nome de helpdesk.php e adicione o seguinte dentro:
      <?php if($logged) { // type (1 = question; 2 = answer) // status (1 = open; 2 = new message; 3 = closed;) $dark = $config['site']['darkborder']; $light = $config['site']['lightborder']; $priority = array(1 => "Baixa", "Normal", "Alta"); $tags = array(1 => "[Vendas]", "[Suporte]", "[Parceria]", "[Bug]", "[Outros]"); if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] and $_REQUEST['control'] == "true") { if(empty($_REQUEST['id']) and empty($_REQUEST['acc']) or !is_numeric($_REQUEST['acc']) or !is_numeric($_REQUEST['id']) ) $bug[1] = $SQL->query('SELECT * FROM '.$SQL->tableName('z_helpdesk').' where `type` = 1 order by `uid` desc'); if(!empty($_REQUEST['id']) and is_numeric($_REQUEST['id']) and !empty($_REQUEST['acc']) and is_numeric($_REQUEST['acc'])) $bug[2] = $SQL->query('SELECT * FROM '.$SQL->tableName('z_helpdesk').' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 1')->fetch(); if(!empty($_REQUEST['id']) and is_numeric($_REQUEST['id']) and !empty($_REQUEST['acc']) and is_numeric($_REQUEST['acc'])) { if(!empty($_REQUEST['reply'])) $reply=true; $account = $ots->createObject('Account'); $account->load($_REQUEST['acc']); $account->isLoaded(); $players = $account->getPlayersList(); if(!$reply) { if($bug[2]['status'] == 2) $value = "<font color=gray><b>Aguardando</b> <img src=images/bug/waiting.gif></font>"; elseif($bug[2]['status'] == 4) $value = "<font color=green><b>Respondido</b></font> <img src=images/bug/ok.png>"; elseif($bug[2]['status'] == 3) $value = "<font color=red><b>Fechado</b></font> <img src=images/bug/closed.png>"; elseif($bug[2]['status'] == 1) $value = "<font color=#4169E1><b>Nova Resposta</b></font> <img src=images/bug/new.png>"; $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Atendimento</B></TD></TR>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td width=40%><img src=images/bug/report.png> <b>Assunto:</b></td><td> '.$tags[$bug[2]['tag']].' '.$bug[2]['subject'].' '.$value.'</td></tr>'; $main_content .= '<TR BGCOLOR="'.$light.'"><td><img src=images/bug/pri.gif> <b>Prioridade:</b></td><td> <img src=images/bug/'.$bug[2]['priority'].'.png> '.$priority[$bug[2]['priority']].''; $main_content .= '<TR BGCOLOR="'.$dark.'"><td><img src=images/bug/tibia.png> <b>Enviado por:</b></td><td>'; foreach($players as $player) { $main_content .= '<img src=images/bug/t.png> '.$player->getName().'<br>'; } $main_content .= '</td></tr>'; $main_content .= '<TR BGCOLOR="'.$light.'"><td colspan=2><img src=images/bug/des.png><b>Descrição:</b></td></tr>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($bug[2]['text']).'</td></tr>'; $main_content .= '</TABLE>'; $answers = $SQL->query('SELECT * FROM '.$SQL->tableName('z_helpdesk').' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2 order by `reply`'); $ot = $config['site']['worlds']; foreach($answers as $answer) { if($answer['who'] == 1) $who = "<img src=images/bug/staff.gif> <font color=red><b>Staff</b></font>"; else $who = "<img src=images/bug/player.gif> <font color=green><b>Player</b></font>"; $main_content .= '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Resposta #'.$answer['reply'].'</B></TD></TR>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td width=70%><img src=images/bug/tibia.png><i><b>Enviado por:</b></i></td><td>'.$who.'</td></tr>'; $main_content .= '<TR BGCOLOR="'.$light.'"><td colspan=2><img src=images/bug/des.png><i><b>Descrição:</b></i></td></tr>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($answer['text']).'</td></tr>'; $main_content .= '</TABLE>'; } if($bug[2]['status'] <= 4) $main_content .= '<br><a href="index.php?subtopic=helpdesk&control=true&id='.$_REQUEST['id'].'&acc='.$_REQUEST['acc'].'&reply=true"><b>[Responder]</b></a>'; } else { //if($bug[2]['status'] < 3) //{ $reply = $SQL->query('SELECT MAX(reply) FROM `z_helpdesk` where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2')->fetch(); $reply = $reply[0] + 1; $iswho = $SQL->query('SELECT * FROM `z_helpdesk` where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2 order by `reply` desc limit 1')->fetch(); if(isset($_POST['finish'])) { if(empty($_POST['text'])) $error[] = "<font color=black><b>Por favor, preencha a descrição.</b></font>"; //if($iswho['who'] == 1) //$error[] = "<font color=black><b>Você precisa aguardar a resposta do usuário.</b></font>"; if(empty($_POST['status'])) $error[] = "<font color=black><b>Status cannot be empty.</b></font>"; if(!empty($error)) { foreach($error as $errors) $main_content .= ''.$errors.'<br>'; } else { $type = 2; $INSERT = $SQL->query('INSERT INTO `z_helpdesk` (`account`,`id`,`text`,`reply`,`type`, `who`) VALUES ('.$SQL->quote($_REQUEST['acc']).','.$SQL->quote($_REQUEST['id']).','.$SQL->quote($_POST['text']).','.$SQL->quote($reply).','.$SQL->quote($type).','.$SQL->quote(1).')'); $UPDATE = $SQL->query('UPDATE `z_helpdesk` SET `status` = '.$_POST['status'].' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].''); header('Location: index.php?subtopic=helpdesk&control=true&id='.$_REQUEST['id'].'&acc='.$_REQUEST['acc'].''); } } $main_content .= '<br><form method="post" action=""><table><tr><td>Mensagem:</i></td><td><textarea name="text" rows="3" cols="25"></textarea></td></tr><tr><td><br><font color=gray><b>Aguardando</b></font> <img src=images/bug/waiting.gif></td><td><input type=radio name=status value=2></td></tr><tr><td><font color=green><b>Respondido <img src=images/bug/ok.png /></b></font></td><td><input type=radio name=status value=4></td></tr><tr><td><font color=red><b>Fechado <img src=images/bug/closed.png></b></font></td><td><input type=radio name=status value=3></td></tr></table><br><input type="submit" name="finish" value="Submit" class="input2"/></form>'; //} //else //{ //$main_content .= "<br><font color=black><b>You can't add answer to closed bug thread.</b></font>"; //} } $post=true; } if(!$post) { $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD colspan=2 CLASS=white><B>Atendimento Admin</B></TD></TR>'; $i=1; foreach($bug[1] as $report) { if($report['status'] == 2) $value = "<font color=gray><b>Aguardando</b> <img src=images/bug/waiting.gif></font>"; elseif($report['status'] == 3) $value = "<font color=red><b>Fechado</b></font> <img src=images/bug/closed.png>"; elseif($report['status'] == 4) $value = "<font color=green><b>Respondido </b></font> <img src=images/bug/ok.png>"; elseif($report['status'] == 1) $value = "<font color=#4169E1><b>Nova Resposta</b></font> <img src=images/bug/new.png>"; if(is_int($i / 2)) { $bgcolor = $dark; } else { $bgcolor = $light; } $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><td width=75%><img src=images/bug/'.$report['priority'].'.png> <a href="index.php?subtopic=helpdesk&control=true&id='.$report['id'].'&acc='.$report['account'].'">'.$tags[$report['tag']].' '.$report['subject'].'</a></td><td>'.$value.'</td></tr>'; $showed=true; $i++; } $main_content .= '</TABLE>'; } } else { $acc = $account_logged->getId(); $account_players = $account_logged->getPlayersList(); foreach($account_players as $player) { $allow=true; } if(!empty($_REQUEST['id'])) $id = addslashes(htmlspecialchars(trim($_REQUEST['id']))); if(empty($_REQUEST['id'])) $bug[1] = $SQL->query('SELECT * FROM '.$SQL->tableName('z_helpdesk').' where `account` = '.$account_logged->getId().' and `type` = 1 order by `id` desc'); if(!empty($_REQUEST['id']) and is_numeric($_REQUEST['id'])) $bug[2] = $SQL->query('SELECT * FROM '.$SQL->tableName('z_helpdesk').' where `account` = '.$account_logged->getId().' and `id` = '.$id.' and `type` = 1')->fetch(); else $bug[2] = NULL; if(!empty($_REQUEST['id']) and $bug[2] != NULL) { if(!empty($_REQUEST['reply'])) $reply=true; if(!$reply) { if($bug[2]['status'] == 1) $value = "<font color=gray><b>Aguardando</b> <img src=images/bug/waiting.gif></font>"; elseif($bug[2]['status'] == 2) $value = "<font color=#4169E1><b>Nova Resposta</b></font> <img src=images/bug/new.png>"; elseif($bug[2]['status'] == 3) $value = "<font color=red><b>Fechado</b></font> <img src=images/bug/closed.png>"; elseif($bug[2]['status'] == 4) $value = "<font color=green><b>Respondido</b></font> <img src=images/bug/ok.png>"; $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Atendimento</B></TD></TR>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td width=40%><img src=images/bug/report.png><b> Assunto:</b></td><td> '.$tags[$bug[2]['tag']].' '.$bug[2]['subject'].' '.$value.'</td></tr>'; $main_content .= '<TR BGCOLOR="'.$light.'"><td><img src=images/bug/pri.gif> <b>Prioridade:</b></td><td> <img src=images/bug/'.$bug[2]['priority'].'.png> '.$priority[$bug[2]['priority']].''; $main_content .= '<TR BGCOLOR="'.$dark.'"><td><img src=images/bug/tibia.png> <b>Enviado por:</b></td><td>'; $main_content .= '<img src=images/bug/t.png> You <br>'; $main_content .= '<TR BGCOLOR="'.$light.'"><td colspan=2><img src=images/bug/des.png><b>Descrição:</b></td></tr>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($bug[2]['text']).'</td></tr>'; $main_content .= '</TABLE>'; $answers = $SQL->query('SELECT * FROM '.$SQL->tableName('z_helpdesk').' where `account` = '.$account_logged->getId().' and `id` = '.$id.' and `type` = 2 order by `reply`'); foreach($answers as $answer) { if($answer['who'] == 1) $who = "<img src=images/bug/staff.gif> <font color=red><b>Staff</b></font>"; else $who = "<img src=images/bug/player.gif> <font color=green><b>YOU</b></font>"; $main_content .= '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.$answer['reply'].'</B></TD></TR>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td width=70%><img src=images/bug/tibia.png><i><b> Enviado por:</b></i></td><td>'.$who.'</td></tr>'; $main_content .= '<TR BGCOLOR="'.$light.'"><td colspan=2><img src=images/bug/des.png><i><b>Descrição:</b></i></td></tr>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($answer['text']).'</td></tr>'; $main_content .= '</TABLE>'; } if($bug[2]['status'] != 3) $main_content .= '<br><a href="index.php?subtopic=helpdesk&id='.$id.'&reply=true"><b>[Responder]</b></a>'; } else { //if($bug[2]['status'] != 3) //{ $reply = $SQL->query('SELECT MAX(reply) FROM `z_helpdesk` where `account` = '.$acc.' and `id` = '.$id.' and `type` = 2')->fetch(); $reply = $reply[0] + 1; $iswho = $SQL->query('SELECT * FROM `z_helpdesk` where `account` = '.$acc.' and `id` = '.$id.' and `type` = 2 order by `reply` desc limit 1')->fetch(); if(isset($_POST['finish'])) { if(empty($_POST['text'])) $error[] = "<font color=black><b>Descrição não pode ser vazia.</b></font>"; if($iswho['who'] == 0) $error[] = "<font color=black><b>Você precisa aguardar a resposta da staff.</b></font>"; if(!$allow) $error[] = "<font color=black><b>Você não possui nenhum char na conta.</b></font>"; if(!empty($error)) { foreach($error as $errors) $main_content .= ''.$errors.'<br>'; } else { $type = 2; $INSERT = $SQL->query('INSERT INTO `z_helpdesk` (`account`,`id`,`text`,`reply`,`type`) VALUES ('.$SQL->quote($acc).','.$SQL->quote($id).','.$SQL->quote($_POST['text']).','.$SQL->quote($reply).','.$SQL->quote($type).')'); $UPDATE = $SQL->query('UPDATE `z_helpdesk` SET `status` = 1 where `account` = '.$acc.' and `id` = '.$id.''); header('Location: index.php?subtopic=helpdesk&id='.$id.''); } } $main_content .= '<br><form method="post" action=""><table><tr><td><i>Description</i></td><td><textarea name="text" rows="15" cols="35"></textarea></td></tr></table><br><input type="submit" name="finish" value="Submit" class="input2"/></form>'; //} //else // //$main_content .= "<br><font color=black><b>You can't add answer to closed bug thread.</b></font>"; //} } $post=true; } elseif(!empty($_REQUEST['id']) and $bug[2] == NULL) { $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Atendimento</B></TD></TR>'; $main_content .= '<TR BGCOLOR="'.$dark.'"><td><i>Ticket doesn\'t exist.</i></td></tr>'; $main_content .= '</TABLE>'; $post=true; } if(!$post) { if($_REQUEST['add'] != TRUE) { $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD colspan=2 CLASS=white><B>Atendimento</B></TD></TR>'; foreach($bug[1] as $report) { if($report['status'] == 1) $value = "<font color=gray><b>Aguardando</b> <img src=images/bug/waiting.gif></font>"; elseif($report['status'] == 2) $value = "<font color=#4169E1><b>Nova Resposta</b></font> <img src=images/bug/new.png>"; elseif($report['status'] == 3) $value = "<font color=red><b>Fechado</b></font> <img src=images/bug/closed.png>"; elseif($report['status'] == 4) $value = "<font color=green><b>Respondido </b></font> <img src=images/bug/ok.png>"; if(is_int($report['id'] / 2)) { $bgcolor = $dark; } else { $bgcolor = $light; } $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><td width=75%><img src=images/bug/'.$report['priority'].'.png> <a href="index.php?subtopic=helpdesk&id='.$report['id'].'">'.$tags[$report['tag']].' '.$report['subject'].'</a></td><td>'.$value.'</td></tr>'; $showed=true; } if(!$showed) { $main_content .= '<TR BGCOLOR="'.$dark.'"><td><i>Nenhum atendimento solicitado.</i></td></tr>'; } $main_content .= '</TABLE>'; $main_content .= '<br><a href="index.php?subtopic=helpdesk&add=true"><b>[Abrir Chamado]</b></a>'; } elseif($_REQUEST['add'] == TRUE) { $thread = $SQL->query('SELECT * FROM `z_helpdesk` where `account` = '.$acc.' and `type` = 1 order by `id` desc')->fetch(); $id_next = $SQL->query('SELECT MAX(id) FROM `z_helpdesk` where `account` = '.$acc.' and `type` = 1')->fetch(); $id_next = $id_next[0] + 1; if(empty($thread)) $thread['status'] = 3; if(isset($_POST['submit'])) { //if($thread['status'] != 3) //$error[] = "<font color=black><b>Can be only 1 open bug thread.</b></font>"; if(empty($_POST['subject'])) $error[] = "<font color=black><b>Assunto cannot be empty.</b></font>"; if(empty($_POST['text'])) $error[] = "<font color=black><b>Description cannot be empty.</b></font>"; if(!$allow) $error[] = "<font color=black><b>You haven't any characters on account.</b></font>"; if(empty($_POST['tags'])) $error[] = "<font color=black><b>Tag cannot be empty.</b></font>"; if(!empty($error)) { foreach($error as $errors) $main_content .= ''.$errors.'<br>'; } else { $type = 1; $status = 1; $INSERT = $SQL->query('INSERT INTO `z_helpdesk` (`account`,`id`,`text`,`type`,`subject`,`status`,`tag`,`priority`) VALUES ('.$SQL->quote($acc).','.$SQL->quote($id_next).','.$SQL->quote($_POST['text']).','.$SQL->quote($type).','.$SQL->quote($_POST['subject']).','.$SQL->quote($status).','.$SQL->quote($_POST['tags']).','.$SQL->quote($_POST['priority']).')'); header('Location: index.php?subtopic=helpdesk&id='.$id_next.''); } } $main_content .= '<br><form method="post" action=""><font size=4><b>Atendimento</b></font><br><br><br><table><tr><td><img src=images/bug/report.png> <b>Assunto:</b></td><td><input type=text name="subject"/></td></tr><tr><td><img src=images/bug/des.png><b>Descrição:</b></td><td><textarea name="text" rows="4" cols="15"></textarea></td></tr><tr><td><img src=images/bug/tag.png> <b>TAG:</b></td><td><select name="tags"><option value="">SELECT</option>'; for($i = 1; $i <= count($tags); $i++) { $main_content .= '<option value="' . $i . '">' . $tags[$i] . '</option>'; } $main_content .= '</td></tr><tr><td><br><img src=images/bug/pri.gif> <b>Prioridade:</b></td><td><br><select name="priority"><option value="">SELECT</option>'; for($i = 1; $i <= count($priority); $i++) { $main_content .= '<option value="' . $i . '">' . $priority[$i] . '</option>'; } $main_content .= '</select></tr></tr></table><br><input type="submit" name="submit" value="Submit" class="input2"/></form>'; } } } if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] and empty($_REQUEST['control'])) { $main_content .= '<br><br><a href="index.php?subtopic=helpdesk&control=true">[ADMIN PANEL]</a>'; } } else { $main_content .= 'Please enter your account name and your password.<br/><a href="?subtopic=createaccount" >Create an account</a> if you do not have one yet.<br/><br/><form action="?subtopic=helpdesk" method="post" ><div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Account Login</div> <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td class="LabelV" ><span >Account Name:</span></td><td style="width:100%;" ><input type="password" name="account_login" SIZE="10" maxlength="10" ></td></tr><tr><td class="LabelV" ><span >Password:</span></td><td><input type="password" name="password_login" size="30" maxlength="29" ></td></tr> </table> </div> </table></div></td></tr><br/><table width="100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=lostaccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Account lost?" alt="Account lost?" src="'.$layout_name.'/images/buttons/_sbutton_accountlost.gif" ></div></div></td></tr></form></table></td></tr></table>'; } ?> Salve e feche.
       
       
      Pós isso abra o seu phpmyadmin, seuip.com/phpmyadmin, clique em executar e dentro da caixa coloque o seguinte:
      CREATE TABLE IF NOT EXISTS `z_helpdesk` ( `account` varchar(255) NOT NULL, `type` int(11) NOT NULL, `status` int(11) NOT NULL, `text` text NOT NULL, `id` int(11) NOT NULL, `subject` varchar(255) NOT NULL, `priority` int(11) NOT NULL, `reply` int(11) NOT NULL, `who` int(11) NOT NULL, `uid` int(11) NOT NULL AUTO_INCREMENT, `tag` int(11) NOT NULL, `registered` int(11) NOT NULL, PRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=61 ; E então irá aparecer aquela linha verde dizendo que o comando foi executado com sucesso...


      Pronto, o sistema foi implantando.


      Agora irei ensinar vocês (caso não saibam) adicionar a aba de atendimento no menu do seu website.

      Primeiramente, na pasta principal do seu site abra o arquivo index.php e procure por:
       
      case "houses": $topic = "Houses"; $subtopic = "houses"; include("houses.php"); break; Logo abaixo de break; adicione o seguinte:
      case "helpdesk": $topic = "Helpdesk"; $subtopic = "helpdesk"; include("helpdesk.php"); break; Ficando então:
       
      case "houses": $topic = "Houses"; $subtopic = "houses"; include("houses.php"); break; case "helpdesk": $topic = "Helpdesk"; $subtopic = "helpdesk"; include("helpdesk.php"); break; Salve e feche.
       
       
       
       
      Logo depois na pasta principal vá em layouts/tibiacom/layout.php e procure por:
      <a href='index.php?subtopic=archive'> <div id='submenu_archive' 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_archive' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'>News Archive</div> <div class='RightChain' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/general/chain.gif);'></div> </div> </a> Logo depois do </a> adicione:
      <a href='index.php?subtopic=helpdesk'> <div id='submenu_helpdesk' 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_helpdesk' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'>Atendimento <font size=-3>NOVO</font></div> <div class='RightChain' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/general/chain.gif);'></div> </div> </a> Salve e feche.
       
       
       
      Pronto, atualize seu site e no menu News verifique que estará lá em funcionalidade o sistema de Atendimento por Ticket.
       
       
       
       
      Dica: Seja formal e tenha eficaz com seus jogadores, isto mostrará a dedicação da equipe em cima do servidor.
       
       
       
       
      Este sistema é antigo, onde venho adaptando para postar para vocês do TibiaKing, não autorizo o post do mesmo em outro fórum seja qual for a relação. O conteúdo foi adaptado por mim e exclusivo ao fórum do tibiaking.




      Qualquer dúvida quero que me comunique e poste aqui no fórum.


      O Sistema foi testado e encontra-se em funcionalidade a qualquer gesior account, seja qual for a versão do mesmo.


      Créditos:
      Averatec -OTLAND
      Absolute

      Gostaram?
       
       
       
      Até o próximo sistema/script/servidor seja o que for!

      Até mais galerinha do TK!
       
    • Por toiim
      Olá, este é meu primeiro tópico e gostaria de pedir scripts para um cavebot do tibia auto dos dwarfs de nivel maior de kazordoon, os dwarfs guard junto com os bonelords, já que o fórum do tibia auto só é acessível pelos já registrados, obrigado.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo