Ir para conteúdo
  • 0

Shop Gesior


koete

Pergunta

To com um grande problema no shop do meu Gesior acc

 

Eu coloco os itens pra comprar no shop mas quando eu compro eles com um player de teste

os itens não vão para o player nem pro dp dele. Mas quando eu pago pra mudar o nome

o nome muda sem erro nenhum alguém pode me ajudar?

Link para o comentário
Compartilhar em outros sites

13 respostass a esta questão

Posts Recomendados

  • 0

Olá amigo, tente trocar o seu globalevent por essa:

 

globalevents.xml adicione:
<globalevent name="shop" interval="30000" event="script" value="shop.lua"/>
Crie em globalevents/scripts um arquivo chamado shop.lua
function doPlayerAddDepotItems(cid, items, town)
if (not isPlayer(cid)) then
error("Player not found")
end
local town = town or getPlayerTown(cid)


local parcel = doCreateItemEx(ITEM_PARCEL)
for item, count in pairs(items) do
if (type(item) == "number") then
local attritemid = doAddContainerItem(parcel, item, count)
doItemSetAttribute(attritemid, "description", "This item belongs to ".. getPlayerName(cid) ..".")
doItemSetAttribute(attritemid, "aid", getPlayerGUID(cid)+10000)
elseif (type(item) == "string") then
doAddContainerItem(parcel, getItemIdByName(item), count)
else
error("Undefinied type of item name")
end
end


return doPlayerSendMailByName(getCreatureName(cid), parcel, town) 
end


function onThink(interval, lastExecution, thinkInterval)


local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;")


if(result:getID() ~= -1) then
while(true) do
cid = getCreatureByName(tostring(result:getDataString("player")))
product = tonumber(result:getDataInt("product"))
itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
if isPlayer(cid) then
local id = tonumber(itemr:getDataInt("item"))
local tid = tonumber(result:getDataInt("id"))
local count = tonumber(itemr:getDataInt("count"))
local tipe = tonumber(itemr:getDataInt("type"))
local productn = tostring(itemr:getDataString("name"))
if isInArray({5,8},tipe) then
if getPlayerFreeCap(cid) >= getItemWeightById(id, count) then
if isPlayer(cid) then
received = doPlayerAddDepotItems(cid, {[id]=count})
if received then
doPlayerSendTextMessage(cid,19, "You received "..productn.." in depot of your hometown.")
db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
doPlayerSave(cid)
else
doPlayerSendTextMessage(cid,19, "You need a free slot on container to receive "..productn..".")
end
else
doPlayerSendTextMessage(cid,19, "You need a free container to receive "..productn..".")
end
else
doPlayerSendTextMessage(cid,19, "You need "..getItemWeightById(id, count).." of free capacity to receive "..productn..".")
end
elseif isInArray({6,7},tipe) then
if tipe == 6 then
bcap = 8
bid = 1987
elseif tipe == 7 then
bcap = 20
bid = 1988
end
if isItemRune(id) then
count = 1
end
if getPlayerFreeCap(cid) >= (getItemWeightById(1987, 1) + getItemWeightById(id,count * bcap)) then
local bag = doCreateItemEx(bid, 1)
for i = 1,bcap do
doAddContainerItem(bag, id, count)
end
received = doPlayerAddDepotItems(cid, bag)
if received == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid,19, "You received "..productn.." in depot of your hometown.")
db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
doPlayerSave(cid)
else
doPlayerSendTextMessage(cid,19, "You need a free slot on container to receive "..productn..".")
end
else
doPlayerSendTextMessage(cid,19, "You need "..getItemWeightById(id, count).." of free capacity to receive "..productn..".")
end
end
end
itemr:free()
if not(result:next()) then
break
end
end
result:free()
end
return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

Deu esse erro cara

 


[12/09/2013 00:31:47] [Error - GlobalEvents::think] Couldn't execute event: saveplayer
[12/09/2013 00:31:47] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Table 'otserv.shop_history' doesn't exist (1146)
Editado por koete
Link para o comentário
Compartilhar em outros sites

  • 0

Execute os seguintes comandos no seu phpmyadmin:

 

CREATE TABLE `shop_history`
(
`id` int(11) NOT NULL auto_increment,
`to_name` varchar(255) NOT NULL default '0',
`to_account` int(11) NOT NULL default '0',
`from_nick` varchar(255) NOT NULL,
`from_account` int(11) NOT NULL default '0',
`price` int(11) NOT NULL default '0',
`offer_id` int(11) NOT NULL default '0',
`trans_state` varchar(255) NOT NULL,
`trans_start` int(11) NOT NULL default '0',
`trans_real` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);

 

 

 

------

 

 

 

ALTER TABLE `shop_history` ADD `processed` int(11) NOT NULL default '0';

 

 

 

 

Espero ter ajudado!

Link para o comentário
Compartilhar em outros sites

  • 0

Bom Eu Uso Gesior Ja fiz esse procedimento Uso tfs 4.0 é nada acontece.

 

 

 

 

function doPlayerAddDepotItems(cid, items, town)
if (not isPlayer(cid)) then
error("Player not found")
end
local town = town or getPlayerTown(cid)
local parcel = doCreateItemEx(ITEM_PARCEL)
for item, count in pairs(items) do
if (type(item) == "number") then
local attritemid = doAddContainerItem(parcel, item, count)
doItemSetAttribute(attritemid, "description", "This item belongs to ".. getPlayerName(cid) ..".")
doItemSetAttribute(attritemid, "aid", getPlayerGUID(cid)+10000)
elseif (type(item) == "string") then
doAddContainerItem(parcel, getItemIdByName(item), count)
else
error("Undefinied type of item name")
end
end
return doPlayerSendMailByName(getCreatureName(cid), parcel, town)
end
function onThink(interval, lastExecution, thinkInterval)
local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;")
if(result:getID() ~= -1) then
while(true) do
cid = getCreatureByName(tostring(result:getDataString("player")))
product = tonumber(result:getDataInt("product"))
itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
if isPlayer(cid) then
local id = tonumber(itemr:getDataInt("item"))
local tid = tonumber(result:getDataInt("id"))
local count = tonumber(itemr:getDataInt("count"))
local tipe = tonumber(itemr:getDataInt("type"))
local productn = tostring(itemr:getDataString("name"))
if isInArray({5,8},tipe) then
if getPlayerFreeCap(cid) >= getItemWeightById(id, count) then
if isPlayer(cid) then
received = doPlayerAddDepotItems(cid, {[id]=count})
if received then
doPlayerSendTextMessage(cid,19, "You received "..productn.." in depot of your hometown.")
db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
doPlayerSave(cid)
else
doPlayerSendTextMessage(cid,19, "You need a free slot on container to receive "..productn..".")
end
else
doPlayerSendTextMessage(cid,19, "You need a free container to receive "..productn..".")
end
else
doPlayerSendTextMessage(cid,19, "You need "..getItemWeightById(id, count).." of free capacity to receive "..productn..".")
end
elseif isInArray({6,7},tipe) then
if tipe == 6 then
bcap = 8
bid = 1987
elseif tipe == 7 then
bcap = 20
bid = 1988
end
if isItemRune(id) then
count = 1
end
if getPlayerFreeCap(cid) >= (getItemWeightById(1987, 1) + getItemWeightById(id,count * bcap)) then
local bag = doCreateItemEx(bid, 1)
for i = 1,bcap do
doAddContainerItem(bag, id, count)
end
received = doPlayerAddDepotItems(cid, bag)
if received == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid,19, "You received "..productn.." in depot of your hometown.")
db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
doPlayerSave(cid)
else
doPlayerSendTextMessage(cid,19, "You need a free slot on container to receive "..productn..".")
end
else
doPlayerSendTextMessage(cid,19, "You need "..getItemWeightById(id, count).." of free capacity to receive "..productn..".")
end
end
end
itemr:free()
if not(result:next()) then
break
end
end
result:free()
end
return true
end

Editado por EduziTow
Link para o comentário
Compartilhar em outros sites

  • 0

este erro fica dando a cada 30 segundos (tempo que eu configurei no script do Avuenja mostrado ali em cima

[12/09/2013 12:14:05] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:14:12] mysql_real_query(): SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_depotitems` WHERE `player_id` = 13 ORDER BY `sid` DESC - MYSQL ERROR: Incorrect key file for table '.\otserv\player_depotitems.MYI'; try to repair it (126)
[12/09/2013 12:14:12] mysql_store_result(): SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = 13 - MYSQL ERROR: Table 'player_storage' is marked as crashed and should be repaired (1194)
[12/09/2013 12:14:12] Koete has logged in.
[12/09/2013 12:14:36] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:15:07] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:15:38] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:16:09] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:16:40] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:17:11] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:17:42] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:18:13] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:18:44] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:19:15] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
[12/09/2013 12:19:46] mysql_real_query(): SELECT * FROM shop_history WHERE `processed` = 0; - MYSQL ERROR: Unknown column 'processed' in 'where clause' (1054)
 
Já ete erro acontece quando eu clico em "Trans. Histori" no site











Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'otserv.pagsegurotransacoes' doesn't exist' in C:\xampp\htdocs\www\history.php:39 Stack trace: #0 C:\xampp\htdocs\www\history.php(39): PDO->query('SELECT * FROM `...') #1 C:\xampp\htdocs\www\index.php(111): include('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\www\history.php on line 39
Editado por koete
Link para o comentário
Compartilhar em outros sites

  • 0

Tenta essa script em shop.lua no 'globalevents'

Shop.lua


-- 1. Now open folder data of your ots
-- 2. Open file globalevents.xml in folder globalevents
--3. Add there line (don't break XML structure, ask someone to help you if you got no idea about XML files format):

--XML Code:
--<globalevent name="website_shop_item_delivery" interval="30000" event="script" value="shop.lua"/>

--4. Create file shop.lua in folder globalevents/scripts and paste in it:

-- Lua Code:

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "data/lib/000-constants.lua")
SHOP_MSG_TYPE = MESSAGE_STATUS_CONSOLE_BLUE
-- time (in seconds) between queries to MySQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM `z_ots_comunication` WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
        while(true) do
            id = tonumber(result_plr:getDataInt("id"))
            action = tostring(result_plr:getDataString("action"))
            delete = tonumber(result_plr:getDataInt("delete_it"))
            cid = getCreatureByName(tostring(result_plr:getDataString("name")))
            if isPlayer(cid) == TRUE then
                local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
                local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
                local container_id = tonumber(result_plr:getDataInt("param3"))
                local container_count = tonumber(result_plr:getDataInt("param4"))
                local add_item_type = tostring(result_plr:getDataString("param5"))
                local add_item_name = tostring(result_plr:getDataString("param6"))
                local received_item = 0
                local full_weight = 0
                if add_item_type == 'container' then
                    container_weight = getItemWeightById(container_id, 1)
                    if isItemRune(itemtogive_id) == TRUE then
                        items_weight = container_count * getItemWeightById(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
                    if isItemRune(itemtogive_id) == TRUE then
                        full_weight = getItemWeightById(itemtogive_id, 1)
                    else
                        full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
                    end
                end
                local free_cap = getPlayerFreeCap(cid)
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = doCreateItemEx(container_id, 1)
						doItemSetAttribute(new_container, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
						doItemSetAttribute(new_container, "tid", id)
                        local iter = 0
                        while iter ~= container_count do
							local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
							doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
							doItemSetAttribute(new_item, "tid", id)
							doAddContainerItemEx(new_container, new_item)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
						doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
						doItemSetAttribute(new_item, "tid", id)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS SHOP.')
						doPlayerSave(cid)
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return true
end
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------

 



Globalevents.xml


<globalevent name="website_shop" interval="30000" event="script" value="shop.lua" desc="Auto Shop System."/>

 



Testa ae!

Link para o comentário
Compartilhar em outros sites

  • 0

ta dando esse error olha

 

 

 

 

[13/09/2013 00:14:47] Lua Script Error: [GlobalEvent Interface]
[13/09/2013 00:14:47] data/globalevents/scripts/shop.lua:onThink
[13/09/2013 00:14:47] data/globalevents/scripts/shop.lua:71: attempt to call global 'doItemSetAttribute' (a nil value)
[13/09/2013 00:14:47] stack traceback:
[13/09/2013 00:14:47] data/globalevents/scripts/shop.lua:71: in function <data/globalevents/scripts/shop.lua:21>
[13/09/2013 00:14:47] [Error - GlobalEvents::think] Couldn't execute event: website_shop

 

 

 

Link para o comentário
Compartilhar em outros sites

  • 0

continua com o erro


Resolvi o Problema

 

 

 

 

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
id = tonumber(result_plr:getDataInt("id"))
action = tostring(result_plr:getDataString("action"))
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
full_weight = getItemWeightById(itemtogive_id, 1)
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
local iter = 0
while iter ~= container_count do
doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You just got a >> '.. add_item_name ..' << from the Tibera-World Shop Offert. Please logout so your character can save.')
db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end

 

 

 

 

 

no meu caso foi isso

 

vou dar REP

pra quem mais me ajudou

 

luanluciano93

que sempre me ajuda em minhas duvidas

 

e

 

Avuenja

por ter disponibilizar seu tempo para socorrer minha duvida mais vezes.

Editado por koete
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...