Ir para conteúdo

Featured Replies

Postado
Fala galera tk,Venho aqui pedi um scripting 
Oque ele faria?
Bom seria um que nem ''PokexGames'' pegaria itens dos pokémons
automaticamente e colocaria em sua bag
Exemplo mato um rattata {Loot] ''Apple bite''
ao player clicar no 'Pokémon' o itens iria automaticamente para sua
bag veja na print
post-106324-0-66360600-1407885346_thumb.
Pois bem somente isso agradeço desde já a quem ajudar
Valendo meu rep +
 
OBS: Se estiver na área incorreta mova!

Resolvido por slyton

Ir para solução
  • Respostas 5
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Bom é muito fácil... mas como é 1 genérico não é perfeito, chega de lenga lenga e vamos lá. Vá em data\creaturescripts\scripts\ e crie 1 arquivo lua chamado aloot.lua e bote isto dentro.

Posted Images

Postado
  • Solução

Bom é muito fácil... mas como é 1 genérico não é perfeito, chega de lenga lenga e vamos lá.

Vá em data\creaturescripts\scripts\ e crie 1 arquivo lua chamado aloot.lua e bote isto dentro.

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

<event type="login" name="aloot_reg" event="script" value="aloot.lua"/>
<event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>

Bom depois de ter feito todo o procedimento, você vai precisar dos comandos.

vá em \data\talkactions\scripts\ e crie um arquivo lua chamado de aloot.lua e bote isto dentro.

local stor, limit = 7575, 60 --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, 'not valid item.')

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, 'not valid item.')

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, 'already added.')

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() == 'remove') 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

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, '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

Depois vá em data\talkactions\talkactions.xml e bote isto dentro.

<talkaction words="/aloot" event="script" value="aloot.lua"/>

AAAH mas como é os comandos? e como eu edito o script?.

Comandos

/aloot add: nome do item
/aloot remove: nome do item
Editar o script é só no talkactions.lua

local stor, limit = 7575, 60 --storage, Limite de itens adicionados.
Bom espero ter ajudado.

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

Postado
  • Autor

Bom é muito fácil... mas como é 1 genérico não é perfeito, chega de lenga lenga e vamos lá.

Vá em data\creaturescripts\scripts\ e crie 1 arquivo lua chamado aloot.lua e bote isto dentro.

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

<event type="login" name="aloot_reg" event="script" value="aloot.lua"/>
<event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>

Bom depois de ter feito todo o procedimento, você vai precisar dos comandos.

vá em \data\talkactions\scripts\ e crie um arquivo lua chamado de aloot.lua e bote isto dentro.

local stor, limit = 7575, 60 --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, 'not valid item.')

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, 'not valid item.')

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, 'already added.')

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() == 'remove') 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

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, '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

Depois vá em data\talkactions\talkactions.xml e bote isto dentro.

<talkaction words="/aloot" event="script" value="aloot.lua"/>

AAAH mas como é os comandos? e como eu edito o script?.

Comandos

/aloot add: nome do item
/aloot remove: nome do item
Editar o script é só no talkactions.lua

local stor, limit = 7575, 60 --storage, Limite de itens adicionados.
Bom espero ter ajudado.

 

Resolvido obrigado pela colaboração!!Reputado :D

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo