OU
pedido

[Encerrado] aloot

Por outbreaks, 27 de set. de 2013 em Tópicos Sem Resposta

loot
resolvido
9
1.2k
outbreaksO
27 de setembro de 2013 às 11:31

Esse aloot so funciona no pokemons normais...

queria que ele funciona-se no pokemons de outland!

 

tive duvida

skype: nando13089

 

 

 

function onLogin(cid)

registerCreatureEvent(cid, "aloot_kill")
return true
end
local stor = 7575
function autoloot(cid, target, pos)
local function doStack(cid, itemid, new)
local count = getPlayerItemCount(cid, itemid)
if (count > 100) then
count = count - math.floor(count / 100) * 100
end
local newCount = count + new
if (count ~= 0) then
local find = getPlayerItemById(cid, true, itemid, count).uid
if (find > 0) then
doRemoveItem(find)
else
newCount = new
end
end
local item = doCreateItemEx(itemid, newCount)
doPlayerAddItemEx(cid, item, true)
end
local function scanContainer(cid, uid, list)
for k = (getContainerSize(uid) - 1), 0, -1 do
local tmp = getContainerItem(uid, k)
if (isInArray(list, tmp.itemid)) then
if isItemStackable(tmp.itemid) and (getPlayerItemCount(cid, tmp.itemid) > 0) then
doStack(cid, tmp.itemid, tmp.type)
else
local item = doCreateItemEx(tmp.itemid, tmp.type)
doPlayerAddItemEx(cid, item, true)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Looted ' .. tmp.type .. ' ' .. getItemNameById(tmp.itemid) .. '.')
doRemoveItem(tmp.uid)
elseif isContainer(tmp.uid) then
scanContainer(cid, tmp.uid, list)
end
end
end
local items = {}
for i = getTileInfo(pos).items, 1, -1 do
pos.stackpos = i
table.insert(items, getThingFromPos(pos))
end
if (#items == 0) then
return
end
local corpse = -1
for _, item in ipairs(items) do
local name = getItemName(item.uid):lower()
if name:find(target:lower()) then
corpse = item.uid
break
end
end
if (corpse ~= -1) and isContainer(corpse) then
scanContainer(cid, corpse, tostring(getPlayerStorageValue(cid, stor)):gsub('_', ''):explode(','))
end
end
function onKill(cid, target, lastHit)
if not isPlayer(target) then
local infos = getPlayerStorageValue(cid, stor)
if (infos == -1) then
return true
end
local list = tostring(infos):explode(',')
if (#list == 0) then
return true
end
addEvent(autoloot, 150, cid, getCreatureName(target), getCreaturePosition(target))
end
return true

end

 

 

 

 

 

 

local stor, limit = 7575, 10 --storage, limit to add.

local allow_container = false --empty! not looted with items, atleast for now.
function onSay(cid, words, param)
local expl = param:explode(':')
local action, rst = expl[1], expl[2]
if (action:lower() == 'check') then
local infos, list = getPlayerStorageValue(cid, stor), {}
if (infos ~= -1) then
list = tostring(infos):explode(',')
end
local txt = 'Autoloot List:\n'
if (#list > 0) then
for k, id in ipairs(list) do
id = id:gsub('_', '')
if tonumber(id) then
txt = txt .. getItemNameById(tonumber(id)) .. ((k < #list) and '\n' or '')
end
end
else
txt = 'Empty'
end
doPlayerPopupFYI(cid, txt)
elseif (action:lower() == 'add') then
local infos, list = getPlayerStorageValue(cid, stor), {}
if (infos ~= -1) then
list = tostring(infos):gsub('_', ''):explode(',')
end
if (#list >= limit) then
return doPlayerSendCancel(cid, 'You already have ' .. limit .. ' autolooting items.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'Esse item nao existe.')
end
end
if not allow_container and isItemContainer(item) then
return doPlayerSendCancel(cid, 'this item can not be autolooted.')
end
local attrs = getItemInfo(item)
if not attrs then
return doPlayerSendCancel(cid, 'Esse item nao existe.')
elseif not attrs.movable or not attrs.pickupable then
return doPlayerSendCancel(cid, 'this item can not be autolooted.')
end
if isInArray(list, item) then
return doPlayerSendCancel(cid, 'Ja foi adicionado.')
end
table.insert(list, tostring(item))
local new = ''
for v, id in ipairs(list) do
new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')
end
doPlayerSetStorageValue(cid, stor, tostring(new))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< has been added to the autoloot list.')
elseif (action:lower() == 'delete') then
local infos, list = getPlayerStorageValue(cid, stor), {}
if (infos ~= -1) then
list = tostring(infos):gsub('_', ''):explode(',')
end
if (#list == 0) then
return doPlayerSendCancel(cid, 'You dont have any item added.')
end
local item = tonumber(rst)
if not item then
item = getItemIdByName(rst, false)
if not item then
return doPlayerSendCancel(cid, 'not valid item.')
end
end
if not isInArray(list, item) then
return doPlayerSendCancel(cid, 'This item is not in the list.')
end
local new = ''
for v, id in ipairs(list) do
if (tonumber(id) ~= item) then
new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')
end
end
doPlayerSetStorageValue(cid, stor, tostring(new))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< removed from the autoloot list.')
end
return true
end

Editado Setembro 27 por outbreaks

1 mês depois...
OmegaO
04 de outubro de 2013 às 19:32

Tópico movido para a seção correta (pedidos e dúvidas - servidores derivados). Por favor, preste mais atenção na próxima vez.

akumahA
06 de outubro de 2013 às 18:33

O problema desse script, é que ele vai procurar pelo corpo com o nome "fainted war gyarados", por exemplo, por causa do nome do pokémon ser "War Gyarados" e não somente "Gyarados"... você pode fazer uma função mais ou menos assim, e colocá-la no "somefunctions.lua", na pasta lib:






function isOutlandName(name)
if name == nil then
return false
end

if string.find(tostring(name), "War") then
return true
end
end

Só que onde está "string.find(tostring(name), "War")", você vai colocando o diferencial dos outros nomes dos pokémons da outland (Brute, Brave, e etc.), adcionando, por exemplo:

string.find(tostring(name), "Brute")

Ficando:

if string.find(tostring(name), "War") or string.find(tostring(name), "Brute") then

E ai, no script "pokeexp.lua", na pasta creaturescripts, você coloca o seguinte, no finalzinho:






if isOutlandName(getCreatureName(cid)) then
	doItemSetAttribute(corpse.uid, "name", "fainted "...string.lower(getCreatureName(cid)))
end

Mas é NECESSÁRIO você colocar a primeira função, e colocar todos os nomes de outland!

Editado Outubro 6 por Akumah

outbreaksO
06 de outubro de 2013 às 21:56

hmmm vo testa

outbreaksO
12 de outubro de 2013 às 21:56

ow mais tipo nome do pokemon e war gyarados so que corpo dele e somente gyarados


vc podia me explica aonde eu coloko nome da.

Outland North-Outland East-Outland South

akumahA
13 de outubro de 2013 às 00:01

Exatamente por isso... o nome do pokémon tem que ser exatamente (em minusculas, claro) "defeated nomedopokemon", como no caso seria "defeated war gyarados" e não "defeated gyarados".

E eu não entendi a segunda pergunta .-.

outbreaksO
13 de outubro de 2013 às 18:06

quando o poke morre o defeat dele e gyarados normal

mais o nome da outland sao esses ai

vc pode me mostra aonde coloka nome da outland na script

o resto deixa cmg!

Editado Outubro 13 por outbreaks

2 semanas depois...
GabrieltxuG
23 de outubro de 2013 às 11:03

Tópico movido para a seção de dúvidas e pedidos resolvidos.

4 anos depois...
StigalS
21 de abril de 2018 às 03:10
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.