Postado Fevereiro 19, 2016 9 anos Olá, eu gostaria de adaptar este script para TFS 1x auctions. Já tentei de vários modos, mas não consegui. Script: Mostrar conteúdo oculto --[[Offline player to player item trader (Auction System)Script version: 1.2a [ -- FIXED CLONE ITEMS BUG -- ]]]--local config = {levelRequiredToAdd = 20,maxOffersPerPlayer = 5,SendOffersOnlyInPZ = true,blocked_items = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933}}function onSay(cid, words, param, channel)if(param == '') thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")return trueendlocal t = string.explode(param, ",")if(t[1] == "add") thenif((not t[2]) or (not t[3]) or (not t[4])) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")return trueendif(not tonumber(t[3]) or (not tonumber(t[4]))) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't set valid price or items count.")return trueendif(string.len(t[3]) > 7 or (string.len(t[4]) > 3)) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This price or item count is too high.")return trueendlocal item = getItemIdByName(t[2], false)if(not item) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")return trueendif(getPlayerLevel(cid) < config.levelRequiredToAdd) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have required (" .. config.levelRequiredToAdd .. ") level.")return trueendif(isInArray(config.blocked_items, item)) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This item is blocked.")return trueendif(getPlayerItemCount(cid, item) < (tonumber(t[4]))) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have this item(s).")return trueendlocal check = db.getResult("SELECT `id` FROM `auction_system` WHERE `player` = " .. getPlayerGUID(cid) .. ";")if(check:getID() == -1) thenelseif(check:getRows(true) >= config.maxOffersPerPlayer) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't add more offers (max. " .. config.maxOffersPerPlayer .. ")")return trueendif(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(getPlayerPosition(cid))) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you add offert to database.")return trueendendif(tonumber(t[4]) < 1 or (tonumber(t[3]) < 1)) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to type a number higher than 0.")return trueendlocal itemcount, costgp = math.floor(t[4]), math.floor(t[3])doPlayerRemoveItem(cid, item, itemcount)db.executeQuery("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. getPlayerGUID(cid) .. ", \"" .. t[2] .. "\", " .. getItemIdByName(t[2]) .. ", " .. itemcount .. ", " .. costgp ..", " .. os.time() .. ")")doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You successfully add " .. itemcount .." " .. t[2] .." for " .. costgp .. " gps to offerts database.")endif(t[1] == "buy") thenif(not tonumber(t[2])) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")return trueendlocal buy = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";")if(buy:getID() ~= -1) thenif(getPlayerMoney(cid) < buy:getDataInt("cost")) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enoguh GP.")buy:free()return trueendif(getPlayerName(cid) == getPlayerNameByGUID(buy:getDataInt("player"))) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can't buy your own items.")buy:free()return trueendif(getPlayerFreeCap(cid) < getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")))thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You try to buy a " .. buy:getDataString("item_name") .. ". It weight " .. getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")) .. " cap oz. and you have only " .. getPlayerFreeCap(cid) .. " oz. free capacity. Put some items to depot and try again.")buy:free()return trueendif(isItemStackable((buy:getDataString("item_id")))) thendoPlayerAddItem(cid, buy:getDataString("item_id"), buy:getDataInt("count"))elsefor i = 1, buy:getDataInt("count") dodoPlayerAddItem(cid, buy:getDataString("item_id"), 1)endenddoPlayerRemoveMoney(cid, buy:getDataInt("cost"))db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";")doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. buy:getDataInt("count") .. " ".. buy:getDataString("item_name") .. " for " .. buy:getDataInt("cost") .. " gps!")db.executeQuery("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. buy:getDataInt("cost") .. " WHERE `id` = " .. buy:getDataInt("player") .. ";")buy:free()elsedoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")endendif(t[1] == "remove") thenif((not tonumber(t[2]))) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")return trueendif(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(getPlayerPosition(cid))) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ area when you remove offerts from database.")return trueendendlocal delete = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";") if(delete:getID() ~= -1) thenif(getPlayerGUID(cid) == delete:getDataInt("player")) thendb.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";")if(isItemStackable(delete:getDataString("item_id"))) thendoPlayerAddItem(cid, delete:getDataString("item_id"), delete:getDataInt("count"))elsefor i = 1, delete:getDataInt("count") dodoPlayerAddItem(cid, delete:getDataString("item_id"), 1)endenddoPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your offert has been deleted from offerts database.")elsedoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This is not your offert!")enddelete:free()elsedoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong ID.")endendif(t[1] == "withdraw") thenlocal balance = db.getResult("SELECT `auction_balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")if(balance:getDataInt("auction_balance") < 1) thendoPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have money on your auction balance.")balance:free()return trueenddoPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got " .. balance:getDataInt("auction_balance") .. " gps from auction system!")doPlayerAddMoney(cid, balance:getDataInt("auction_balance"))db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";")balance:free()endreturn trueend
Postado Fevereiro 20, 2016 9 anos Esta é uma mensagem automática, este tópico foi movido para a área correta. Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680Este tópico foi movido: De: Scripting OTServ > OTServ > Actions e TalkActions Para: Suporte OTServ > OTServ > Suporte de Scripts ➥ Regras | Seções OTServ | Seções BOT
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.