Ir para conteúdo
  • Cadastre-se

(Resolvido)Bug Do Shop Não Para de Manda Itens


Ir para solução Resolvido por Rusherzin,

Posts Recomendados

Auguem poderia me ajuda faz horas que estou tentando resolver esse erro, ja procurei por vários tópicos mais nem 1 tinha uma solução. É quando eu compro 1 item no shop ele chega mais dps de uns 30 segundos vem dinovo e assim infinitamente se auguem souber resolver. O erro que da:

 

[26/02/2015 17:22:50] [Error - GlobalEvent Interface]
[26/02/2015 17:22:50] data/globalevents/scripts/shop.lua:onThink
[26/02/2015 17:22:50] Description:
[26/02/2015 17:22:50] data/globalevents/scripts/shop.lua:56: attempt to call field 'Query' (a nil value)
[26/02/2015 17:22:50] stack traceback:
[26/02/2015 17:22:50]     data/globalevents/scripts/shop.lua:56: in function <data/globalevents/scripts/shop.lua:7>
[26/02/2015 17:22:50] [Error - GlobalEvents::think] Couldn't execute event: shop

 

Toda vez  que o item chega aparece esse erro.

 

Estou Postando o Print De Como Fica!!

 

post-98333-0-16778500-1424985045_thumb.p

Editado por matheuskc (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

aqui o arquivo shop.lua

 

-- ### 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
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)
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 received >> '.. add_item_name ..' << from OTS shop.')
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

Link para o post
Compartilhar em outros sites

tenta esse script

    -- ### CONFIG ###
    -- message send to player by script "type" (types you can check in "global.lua")
    SHOP_MSG_TYPE = 17
    -- time (in seconds) between connections to SQL database by shop script
    SQL_interval = 30
    -- ### END OF CONFIG ###
    SQL_COMUNICATION_INTERVAL = SQL_interval * 1000
    function onLogin(cid)
    if(InitShopComunication == 0) then
    local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, {})
    InitShopComunication = eventServ
    end
    registerCreatureEvent(cid, "PlayerDeath")
    return TRUE
    end
     
    function sql_communication(parameters)
    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 = getPlayerByName(tostring(result_plr:getDataString("name")))
    if isPlayer(cid) == TRUE then
    if action == 'give_item' 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 b_head_slot = getPlayerSlotItem(cid, 1)
    local b_necklace_slot = getPlayerSlotItem(cid, 2)
    local b_backpack_slot = getPlayerSlotItem(cid, 3)
    local b_armor_slot = getPlayerSlotItem(cid, 4)
    local b_right_hand = getPlayerSlotItem(cid, 5)
    local b_left_hand = getPlayerSlotItem(cid, 6)
    local b_legs_slot = getPlayerSlotItem(cid, 7)
    local b_feet_slot = getPlayerSlotItem(cid, 8)
    local b_ring_slot = getPlayerSlotItem(cid, 9)
    local b_arrow_slot = getPlayerSlotItem(cid, 10)
    if b_arrow_slot.itemid == 0 or (b_left_hand.itemid == 0 and b_right_hand.itemid == 0) then
    local full_weight = 0
    if add_item_type == 'container' then
    container_weight = getItemWeight(container_id, 1)
    items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
    full_weight = items_weight + container_weight
    else
    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
    end
    local free_cap = getPlayerFreeCap(cid)
    if full_weight <= free_cap then
    if add_item_type == 'container' then
    local new_container = doCreateItemEx(container_id)
    local iter = 0
    while iter ~= container_count do
    doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
    iter = iter + 1
    end
    doPlayerAddItemEx(cid, new_container)
    itemtogive_id = container_id
    else
    local addeditem = doPlayerAddItem(cid, itemtogive_id, itemtogive_count)
    end
    local head_slot = getPlayerSlotItem(cid, 1)
    local necklace_slot = getPlayerSlotItem(cid, 2)
    local backpack_slot = getPlayerSlotItem(cid, 3)
    local armor_slot = getPlayerSlotItem(cid, 4)
    local right_hand = getPlayerSlotItem(cid, 5)
    local left_hand = getPlayerSlotItem(cid, 6)
    local legs_slot = getPlayerSlotItem(cid, 7)
    local feet_slot = getPlayerSlotItem(cid, 8)
    local ring_slot = getPlayerSlotItem(cid, 9)
    local arrow_slot = getPlayerSlotItem(cid, 10)
    if ring_slot.itemid == itemtogive_id or feet_slot.itemid == itemtogive_id or legs_slot.itemid == itemtogive_id or armor_slot.itemid == itemtogive_id or necklace_slot.itemid == itemtogive_id or head_slot.itemid == itemtogive_id or arrow_slot.itemid == itemtogive_id or left_hand.itemid == itemtogive_id or right_hand.itemid == itemtogive_id or backpack_slot.itemid == itemtogive_id then
    if b_ring_slot.uid ~= ring_slot.uid or b_feet_slot.uid ~= feet_slot.uid or b_legs_slot.uid ~= legs_slot.uid or b_armor_slot.uid ~= armor_slot.uid or b_necklace_slot.uid ~= necklace_slot.uid or b_head_slot.uid ~= head_slot.uid or b_backpack_slot.uid ~= backpack_slot.uid or b_right_hand.uid ~= right_hand.uid or b_left_hand.uid ~= left_hand.uid or b_arrow_slot.uid ~= arrow_slot.uid then
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop. You should re-login now to become sure your new item will not disappear if any error occur.')
    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 not added. Unknown error occured. Wait about '.. SQL_interval ..' seconds. If error will occur again contact with admin. Error item ID is: '.. id ..'')
    end
    else
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop not added. Unknown error occured. Wait about '.. SQL_interval ..' seconds. If error will occur again contact with admin. Error item ID is: '.. id ..'')
    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 or give to friend 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. Please take items from both hands or item from arrow slot and wait about '.. SQL_interval ..' seconds to get it.')
    end
    end
    end
    if not(result_plr:next()) then
    break
    end
    end
    result_plr:free()
    end
    local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, parameters)
    end

@EDIT
copie todo o código acima e rode esse script na sua DB:

CREATE TABLE IF NOT EXISTS `z_ots_comunication` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`action` varchar(255) NOT NULL,
`param1` varchar(255) NOT NULL,
`param2` varchar(255) NOT NULL,
`param3` varchar(255) NOT NULL,
`param4` varchar(255) NOT NULL,
`param5` varchar(255) NOT NULL,
`param6` varchar(255) NOT NULL,
`param7` varchar(255) NOT NULL,
`delete_it` int(2) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
Editado por Patrick Jean (veja o histórico de edições)

Ajudei??? Rep + ae! :D

gtYFjO8.gif

 

1iiu7Gw.png

Facebook: Béria Alternative Server

Link para o post
Compartilhar em outros sites

Esse script que Você mando o item não chega na conta.

 

@EDIT

 

Eu ja tenho essa table criada na minha database:z_ots_comunication

Editado por matheuskc (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

mudou os db.executeQuery para db.query??

 

Se não funcionou denovo, tente usar esse...

-- ### CONFIG ###
-- 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.storeQuery("SELECT * FROM z_ots_comunication")
    if result_plr ~= false then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local player = Player(tostring(result.getDataString(result_plr, "name")))
            if player then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local received_item = 0
                local full_weight = 0
        local itemType = ItemType(itemtogive_id)
                if add_item_type == 'container' then
                    if itemType:isRune() then
                        items_weight = container_count * itemType:getWeight()
                    else
                        items_weight = container_count * itemType:getWeight(itemtogive_count)
                    end
                    full_weight = items_weight + ItemType(container_id):getWeight()
                else
                    if itemType:isRune() then
                        full_weight = itemType:getWeight()
                    else
                        full_weight = itemType:getWeight(itemtogive_count)
                    end
                end
                local free_cap = player:getFreeCapacity()
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = Game.createItem(container_id, 1)
                        local iter = 0
                        while iter ~= container_count do
                            new_container:addItem(itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = player:addItemEx(new_container)
                    else
                        local new_item = Game.createItem(itemtogive_id, itemtogive_count)
                        received_item = player:addItemEx(new_item)
                    end
                    if type(received_item) == 'number' and received_item == RETURNVALUE_NOERROR then
                        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        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
                        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '>> '.. 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
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '>> '.. 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
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end

Ajudei??? Rep + ae! :D

gtYFjO8.gif

 

1iiu7Gw.png

Facebook: Béria Alternative Server

Link para o post
Compartilhar em outros sites

Tenta com esse:
 

local SHOP_MSG_TYPE = MESSAGE_STATUS_CONSOLE_RED
local SQL_interval = 30

function generateSerial()
  --local lettersUsedToGenerateHash = "AaBbCcDdEeFfGgHhIiJjKkLlMmOoPpQqRrSsTtUuVvWwXxYyZz"
	local lettersUsedToGenerateHash = "ABCDEFGHIJKLMOPQRSTUVWXYZ"
	local newSerial = "!"
	for k = 1, 10 do
		local l = math.random(1, string.len(lettersUsedToGenerateHash))
		newSerial = newSerial .. string.sub(lettersUsedToGenerateHash, l, l)
	end
	local newSerialInt  = math.random(999999)
	newSerial = newSerial .."-" .. newSerialInt
	-- Set TIME -> newSerial = newSerialStr .. "-" .. os.time() .. "-" .. newSerialInt
	-- length: ![10 letters]-[10 numbers (unix date)]-[6 numbers]
	-- length = 29 [always!]
	return newSerial
end 
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
			local id = tonumber(result_plr:getDataInt("id"))
			local action = tostring(result_plr:getDataString("action"))
			local delete = tonumber(result_plr:getDataInt("delete_it"))
			local cid = getCreatureByName(tostring(result_plr:getDataString("name")))
			if isPlayer(cid) 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)
						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)
						--doItemSetAttribute(new_item, "description",  "Name: ".. getPlayerName(cid) ..". Data: ".. os.date("%d %B %Y Hora: %X. ").."Serial: "..generateSerial().."")
						doItemSetAttribute(new_item, "description", "Serial: "..generateSerial().."")
						--doItemSetAttribute(new_item, "description", "This item was purchased at the shop by the player ".. getPlayerName(cid) ..".")
						--doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
						received_item = doPlayerAddItemEx(cid, new_item)
					end
					if received_item == RETURNVALUE_NOERROR then
						doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '{Shopping System} Entrega do Item '.. add_item_name ..' Feita com Sucesso!.')
						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, ' {Shopping System} Sua Backpack Nao Tem Espaco Para Receber o Item '.. add_item_name ..' Por Favor Abra Espaco em Sua Backpack, Estaremos Tentando Entregar o Item Em '.. SQL_interval ..' Segundos!.')
					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

Se não funcionar posta o seu 100-compat.lua (fica em data/lib).

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Link para o post
Compartilhar em outros sites

Cara ñ Pego Ta ae o 100-compat.lua!!!!

 

 

 

 

--[[
 * File containing deprecated functions and constants used by alot of scripts and other engines
]]--
--bit = require("bit")
 
TRUE = true
FALSE = false
LUA_ERROR = false
LUA_NO_ERROR = true
LUA_NULL = nil
 
TALKTYPE_CHANNEL_R1 = TALKTYPE_CHANNEL_RN
TALKTYPE_CHANNEL_R2 = TALKTYPE_CHANNEL_RA
TALKTYPE_ORANGE_1 = TALKTYPE_MONSTER
TALKTYPE_ORANGE_2 = TALKTYPE_MONSTER_YELL
 
TEXTCOLOR_BLACK = 0
TEXTCOLOR_BLUE = 5
TEXTCOLOR_GREEN = 18
TEXTCOLOR_TEAL = 35
TEXTCOLOR_LIGHTGREEN = 66
TEXTCOLOR_DARKBROWN = 78
TEXTCOLOR_LIGHTBLUE = 89
TEXTCOLOR_DARKPURPLE = 112
TEXTCOLOR_BROWN = 120
TEXTCOLOR_GREY = 129
TEXTCOLOR_DARKRED = 144
TEXTCOLOR_DARKPINK = 152
TEXTCOLOR_PURPLE = 154
TEXTCOLOR_DARKORANGE = 156
TEXTCOLOR_RED = 180
TEXTCOLOR_PINK = 190
TEXTCOLOR_ORANGE = 192
TEXTCOLOR_DARKYELLOW = 205
TEXTCOLOR_YELLOW = 210
TEXTCOLOR_WHITE = 215
TEXTCOLOR_NONE = 255
 
CONDITION_PARAM_STAT_MAXHITPOINTS = CONDITION_PARAM_STAT_MAXHEALTH
CONDITION_PARAM_STAT_MAXMANAPOINTS = CONDITION_PARAM_STAT_MAXMANA
CONDITION_PARAM_STAT_SOULPOINTS = CONDITION_PARAM_STAT_SOUL
CONDITION_PARAM_STAT_MAGICPOINTS = CONDITION_PARAM_STAT_MAGICLEVEL
CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT = CONDITION_PARAM_STAT_MAXHEALTHPERCENT
CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT = CONDITION_PARAM_STAT_MAXMANAPERCENT
CONDITION_PARAM_STAT_SOULPOINTSPERCENT = CONDITION_PARAM_STAT_SOULPERCENT
CONDITION_PARAM_STAT_MAGICPOINTSPERCENT = CONDITION_PARAM_STAT_MAGICLEVELPERCENT
 
STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE = 1
STACKPOS_SECOND_ITEM_ABOVE_GROUNDTILE = 2
STACKPOS_THIRD_ITEM_ABOVE_GROUNDTILE = 3
STACKPOS_FOURTH_ITEM_ABOVE_GROUNDTILE = 4
STACKPOS_FIFTH_ITEM_ABOVE_GROUNDTILE = 5
 
WORLD_TYPE_NO_PVP = 1
WORLD_TYPE_PVP = 2
WORLD_TYPE_PVP_ENFORCED = 3
 
WORLDTYPE_NO_PVP = 1
WORLDTYPE_PVP = 2
WORLDTYPE_PVP_ENFORCED = 3
 
CHANNEL_STAFF = 2
CHANNEL_COUNSELOR = 4
CHANNEL_GAMECHAT = 5
CHANNEL_TRADE = 6
CHANNEL_TRADEROOK = 7
CHANNEL_RLCHAT = 8
 
BANTYPE_IP_BANISHMENT = 1
BANTYPE_NAMELOCK = 2
BANTYPE_BANISHMENT = 3
BANTYPE_NOTATION = 4
BANTYPE_DELETION = 3
 
SKILLS = SKILL_NAMES
 
table.getPos = table.find
doSetCreatureDropLoot = doCreatureSetDropLoot
doPlayerSay = doCreatureSay
doPlayerAddMana = doCreatureAddMana
playerLearnInstantSpell = doPlayerLearnInstantSpell
doPlayerRemOutfit = doPlayerRemoveOutfit
pay = doPlayerRemoveMoney
broadcastMessage = doBroadcastMessage
getPlayerName = getCreatureName
getCreaturePosition = getThingPosition
getPlayerPosition = getCreaturePosition
getCreaturePos = getCreaturePosition
creatureGetPosition = getCreaturePosition
getPlayerMana = getCreatureMana
getPlayerMaxMana = getCreatureMaxMana
hasCondition = getCreatureCondition
isMoveable = isMovable
isItemMoveable = isItemMovable
saveData = saveServer
savePlayers = saveServer
getPlayerSkill = getPlayerSkillLevel
getPlayerSkullType = getCreatureSkullType
getCreatureSkull = getCreatureSkullType
getAccountNumberByName = getAccountIdByName
getIPByName = getIpByName
getPlayersByIP = getPlayersByIp
getThingfromPos = getThingFromPos
getPlayersByAccountNumber = getPlayersByAccountId
getIPByPlayerName = getIpByName
getPlayersByIPNumber = getPlayersByIp
getAccountNumberByPlayerName = getAccountIdByName
convertIntToIP = doConvertIntegerToIp
convertIPToInt = doConvertIpToInteger
queryTileAddThing = doTileQueryAdd
getTileHouseInfo = getHouseFromPos
executeRaid = doExecuteRaid
saveServer = doSaveServer
cleanHouse = doCleanHouse
cleanMap = doCleanMap
shutdown = doShutdown
mayNotMove = doCreatureSetNoMove
doPlayerSetNoMove = doCreatureSetNoMove
getPlayerNoMove = getCreatureNoMove
getConfigInfo = getConfigValue
doPlayerAddExp = doPlayerAddExperience
isInArea = isInRange
doPlayerSetSkillRate = doPlayerSetRate
getCreatureLookDir = getCreatureLookDirection
getPlayerLookDir = getCreatureLookDirection
getPlayerLookDirection = getCreatureLookDirection
doCreatureSetLookDir = doCreatureSetLookDirection
getPlayerLookPos = getCreatureLookPosition
setPlayerStamina = doPlayerSetStamina
setPlayerPromotionLevel = doPlayerSetPromotionLevel
setPlayerGroupId = doPlayerSetGroupId
setPlayerPartner = doPlayerSetPartner
doPlayerSetStorageValue = doCreatureSetStorage
setPlayerStorageValue = doPlayerSetStorageValue
getPlayerStorageValue = getCreatureStorage
getGlobalStorageValue = getStorage
setGlobalStorageValue = doSetStorage
setPlayerBalance = doPlayerSetBalance
doAddMapMark = doPlayerAddMapMark
doSendTutorial = doPlayerSendTutorial
getWaypointsList = getWaypointList
getPlayerLastLoginSaved = getPlayerLastLogin
getThingPos = getThingPosition
doAreaCombatHealth = doCombatAreaHealth
doAreaCombatMana = doCombatAreaMana
doAreaCombatCondition = doCombatAreaCondition
doAreaCombatDispel = doCombatAreaDispel
getItemDescriptionsById = getItemInfo
hasProperty = hasItemProperty
hasClient = hasPlayerClient
print = std.cout
getPosByDir = getPositionByDirection
db.updateQueryLimitOperator = db.updateLimiter
db.stringComparisonOperator = db.stringComparer
db.stringComparison = db.stringComparer
db.executeQuery = db.query
isNumber = isNumeric
 
PlayerFlag_CannotUseCombat = 0
PlayerFlag_CannotAttackPlayer = 1
PlayerFlag_CannotAttackMonster = 2
PlayerFlag_CannotBeAttacked = 3
PlayerFlag_CanConvinceAll = 4
PlayerFlag_CanSummonAll = 5
PlayerFlag_CanIllusionAll = 6
PlayerFlag_CanSenseInvisibility = 7
PlayerFlag_IgnoredByMonsters = 8
PlayerFlag_NotGainInFight = 9
PlayerFlag_HasInfiniteMana = 10
PlayerFlag_HasInfiniteSoul = 11
PlayerFlag_HasNoExhaustion = 12
PlayerFlag_CannotUseSpells = 13
PlayerFlag_CannotPickupItem = 14
PlayerFlag_CanAlwaysLogin = 15
PlayerFlag_CanBroadcast = 16
PlayerFlag_CanEditHouses = 17
PlayerFlag_CannotBeBanned = 18
PlayerFlag_CannotBePushed = 19
PlayerFlag_HasInfiniteCapacity = 20
PlayerFlag_CanPushAllCreatures = 21
PlayerFlag_CanTalkRedPrivate = 22
PlayerFlag_CanTalkRedChannel = 23
PlayerFlag_TalkOrangeHelpChannel = 24
PlayerFlag_NotGainExperience = 25
PlayerFlag_NotGainMana = 26
PlayerFlag_NotGainHealth = 27
PlayerFlag_NotGainSkill = 28
PlayerFlag_SetMaxSpeed = 29
PlayerFlag_SpecialVIP = 30
PlayerFlag_NotGenerateLoot = 31
PlayerFlag_CanTalkRedChannelAnonymous = 32
PlayerFlag_IgnoreProtectionZone = 33
PlayerFlag_IgnoreSpellCheck = 34
PlayerFlag_IgnoreWeaponCheck = 35
PlayerFlag_CannotBeMuted = 36
PlayerFlag_IsAlwaysPremium = 37
PlayerFlag_CanAnswerRuleViolations = 38
PlayerFlag_39 = 39 -- ignore
PlayerFlag_ShowGroupNameInsteadOfVocation = 40
PlayerFlag_HasInfiniteStamina = 41
PlayerFlag_CannotMoveItems = 42
PlayerFlag_CannotMoveCreatures = 43
PlayerFlag_CanReportBugs = 44
PlayerFlag_45 = 45 -- ignore
PlayerFlag_CannotBeSeen = 46
PlayerFlag_HideHealth = 47
 
PlayerCustomFlag_AllowIdle = 0
PlayerCustomFlag_CanSeePosition = 1
PlayerCustomFlag_CanSeeItemDetails = 2
PlayerCustomFlag_CanSeeCreatureDetails = 3
PlayerCustomFlag_NotSearchable = 4
PlayerCustomFlag_GamemasterPrivileges = 5
PlayerCustomFlag_CanThrowAnywhere = 6
PlayerCustomFlag_CanPushAllItems = 7
PlayerCustomFlag_CanMoveAnywhere = 8
PlayerCustomFlag_CanMoveFromFar = 9
PlayerCustomFlag_CanLoginMultipleCharacters = 10
PlayerCustomFlag_HasFullLight = 11
PlayerCustomFlag_CanLogoutAnytime = 12
PlayerCustomFlag_HideLevel = 13
PlayerCustomFlag_IsProtected = 14
PlayerCustomFlag_IsImmune = 15
PlayerCustomFlag_NotGainSkull = 16
PlayerCustomFlag_NotGainUnjustified = 17
PlayerCustomFlag_IgnorePacification = 18
PlayerCustomFlag_IgnoreLoginDelay = 19
PlayerCustomFlag_CanStairhop = 20
PlayerCustomFlag_CanTurnhop = 21
PlayerCustomFlag_IgnoreHouseRent = 22
Link para o post
Compartilhar em outros sites

Okay, já estou meio confuso.. Qual erro dá quando você usa o script que eu passei?

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Link para o post
Compartilhar em outros sites

usei sim ta dando esse do print :

 

post-98333-0-56771800-1424987562_thumb.p

 

No ot fica assim:

 

post-98333-0-39645200-1424987744_thumb.p

 

 

Editado por matheuskc (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

Sim, o erro é na hora de executar a query para confimar a entrega do item.

Tenta deletar essa linha aqui no seu 100-compat.lua db.executeQuery = db.query
Se não funcionar.. tenta usar essa lib:
lib.rar

Obs: Salve a sua pasta original caso ocorra algum outro erro
 

Editado por Rusherzin (veja o histórico de edições)

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Link para o post
Compartilhar em outros sites

Vlw Cara deu certo! Era apenas excluir o db.executeQuery = db.query muito abrigador mesmo cara 3 dia tentando resolve sor vc mesmo pra conseguir vlw abraços tudo de bom para vc cara.

 

post-98333-0-54213300-1424989649_thumb.j

Link para o post
Compartilhar em outros sites
  • 1 year later...
Em 26/02/2015 at 18:29, Rusherzin disse:

Tenta com esse:
 


local SHOP_MSG_TYPE = MESSAGE_STATUS_CONSOLE_RED
local SQL_interval = 30

function generateSerial()
  --local lettersUsedToGenerateHash = "AaBbCcDdEeFfGgHhIiJjKkLlMmOoPpQqRrSsTtUuVvWwXxYyZz"
	local lettersUsedToGenerateHash = "ABCDEFGHIJKLMOPQRSTUVWXYZ"
	local newSerial = "!"
	for k = 1, 10 do
		local l = math.random(1, string.len(lettersUsedToGenerateHash))
		newSerial = newSerial .. string.sub(lettersUsedToGenerateHash, l, l)
	end
	local newSerialInt  = math.random(999999)
	newSerial = newSerial .."-" .. newSerialInt
	-- Set TIME -> newSerial = newSerialStr .. "-" .. os.time() .. "-" .. newSerialInt
	-- length: ![10 letters]-[10 numbers (unix date)]-[6 numbers]
	-- length = 29 [always!]
	return newSerial
end 
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
			local id = tonumber(result_plr:getDataInt("id"))
			local action = tostring(result_plr:getDataString("action"))
			local delete = tonumber(result_plr:getDataInt("delete_it"))
			local cid = getCreatureByName(tostring(result_plr:getDataString("name")))
			if isPlayer(cid) 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)
						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)
						--doItemSetAttribute(new_item, "description",  "Name: ".. getPlayerName(cid) ..". Data: ".. os.date("%d %B %Y Hora: %X. ").."Serial: "..generateSerial().."")
						doItemSetAttribute(new_item, "description", "Serial: "..generateSerial().."")
						--doItemSetAttribute(new_item, "description", "This item was purchased at the shop by the player ".. getPlayerName(cid) ..".")
						--doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
						received_item = doPlayerAddItemEx(cid, new_item)
					end
					if received_item == RETURNVALUE_NOERROR then
						doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '{Shopping System} Entrega do Item '.. add_item_name ..' Feita com Sucesso!.')
						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, ' {Shopping System} Sua Backpack Nao Tem Espaco Para Receber o Item '.. add_item_name ..' Por Favor Abra Espaco em Sua Backpack, Estaremos Tentando Entregar o Item Em '.. SQL_interval ..' Segundos!.')
					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

Se não funcionar posta o seu 100-compat.lua (fica em data/lib).

Vlw mano fuciono aqui esse ae blz meu abraço 

Link para o post
Compartilhar em outros sites
  • 3 years later...

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo