1 [Tutorial] Como Adicionar O Comando Auto Loot-Do Seu Servidor De Poketibia Sex Set 28, 2012 7:59 am
andre_dhon
MembroPercebi Que ainda TEM PESSOAS COM Dúvida sobre Como colocar o Comando auto-pilhagem nenhum servidor de poketibia
Ai Vai: Primeiramente, abra a massa fazer Seu OTServer
- Código:
<event type="login" name="aloot_reg" event="script" value="aloot.lua"/>
<event type="kill" name="aloot_kill" event="script" value="aloot.lua"/>
Logo los seguida, os dados VA massas NA / creaturescripts / scritps e CRIE UM ARQUIVO com o nomo de "aloot.lua"
e cole ISSO:
- Código:
OnLogin função (CID)
registerCreatureEvent (cid, "aloot_kill")
return true
final
armazenamento local = 7575
função autoloot (alvo, cid, pos)
doStack função local (cid, itemid, novo)
locais count = getPlayerItemCount (cid, itemid)
if (count> 100), em seguida
contador = contador - math.floor (contagem / 100) * 100
final
locais newCount = contador + novo
if (count ~ = 0) então
locais encontrar = getPlayerItemById (cid, verdadeira, itemid, count). uid
if (encontrar> 0) então
doRemoveItem (encontrar)
outro
newCount = new
final
final
locais item = doCreateItemEx (itemid, newCount)
doPlayerAddItemEx (cid, item, true)
final
Função local scanContainer (cid, uid, lista)
para k = (getContainerSize (uid) - 1), 0, -1 fazer
tmp local = getContainerItem (uid, k)
if (isInArray (lista, tmp.itemid)) então
se isItemStackable (tmp.itemid) e (getPlayerItemCount (cid, tmp.itemid)> 0) então
doStack (cid, tmp.itemid, tmp.type)
outro
item local = doCreateItemEx (tmp.itemid, tmp.type)
doPlayerAddItemEx (cid, item, true)
final
doPlayerSendTextMessage (cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Looted' .. tmp.type .. "" .. getItemNameById (tmp.itemid) .. '.')
doRemoveItem (tmp.uid)
elseif isContainer (tmp.uid) então
scanContainer (cid, lista, tmp.uid)
final
final
final
itens locais = {}
para i = getTileInfo (POS). itens, 1, -1 fazer
pos.stackpos = i
table.insert (itens, getThingFromPos (pos))
final
if (# itens == 0), então
voltar
final
cadáver local = -1
_ para o item, em ipairs (itens) fazer
nome local = getitemname (item.uid): diminuir ()
se o nome de: encontrar (meta: diminuir ()), em seguida
cadáver = item.uid
quebrar
final
final
if (cadáver ~ = -1) e isContainer (cadáver) então
scanContainer (cid, corpse tostring, (getPlayerStorageValue (cid, stor)): gsub ('_',''): explode (','))
final
final
função onKill (alvo, cid, lastHit)
se não isPlayer (alvo), então
informações sobre locais = getPlayerStorageValue (cid, stor)
if (infos == -1), então
return true
final
lista local = toString (infos): explode (',')
if (# lista == 0) então
return true
final
addEvent (autoloot, 150, getCreatureName, cid (alvo), getCreaturePosition (target))
final
return true
final
DEPOIS, dados VA massas NA / talkactions e abra o arquivo "talkactios. xml "
Nele, Guia Você Devera adicionar ISSO:
- Código:
<talkaction words="/aloot" event="script" hide="yes" value="aloot.lua"/>
E, POR FIM, dados VA massas NA / talkaction / scripts e CRIE UM ARQUIVO com o nomo de aloot.lua
E Cole ISSO:
- Código:
armazenamento local, limite = 7575, 5 - armazenamento, limitar a acrescentar.
locais allow_container = false - vazio! não saquearam com itens, pelo menos para agora.
função onSay (cid, palavras param,)
locais expl param =: explode (':')
ação local, rst = expl [1], expl [2]
if (ação: reduzir () == 'check'), então
informações sobre locais, lista = getPlayerStorageValue (cid, stor), {}
se (infos ~ = -1), então
lista = toString (infos): explode (',')
final
locais txt 'Lista autoloot: \ n' =
if (# lista> 0) então
para k, id em ipairs (lista) fazer
id = id: gsub ('_','')
se tonumber (ID), em seguida,
txt = txt .. getItemNameById (tonumber (id)) .. ((K <lista #) e '\ n' ou'')
final
final
outro
txt = 'vazio'
final
doPlayerPopupFYI (cid, txt)
elseif (ação: menor () == 'add'), então
informações sobre locais, lista = getPlayerStorageValue (cid, stor), {}
se (infos ~ = -1), então
lista = toString (infos): gsub ('_',''): explode (',')
final
if (lista #> = limite), então
voltar doPlayerSendCancel (cid, "Você já tem '.. limite ..' itens autolooting. ')
final
locais item = tonumber (RST)
se não o item, em seguida,
item de getItemIdByName = (rst, false)
se não o item, em seguida,
voltar doPlayerSendCancel (cid, "não item válido. ')
final
final
se não allow_container e isItemContainer (item) então
voltar doPlayerSendCancel (cid, "este item não pode ser autolooted. ')
final
locais attrs GetItemInfo = (item)
se não, então attrs
voltar doPlayerSendCancel (cid, "não item válido. ')
elseif não attrs.movable ou não attrs.pickupable então
voltar doPlayerSendCancel (cid, "este item não pode ser autolooted. ')
final
se isInArray (item da lista), então
voltar doPlayerSendCancel (cid, 'já adicionado.')
final
table.insert (lista tostring, (item))
local = novo''
para v, id em ipairs (lista) fazer
novo = new .. '_' .. id: gsub ('_','') .. ((V <lista #) e ',' ou'')
final
doPlayerSetStorageValue (cid, stor tostring, (novo))
doPlayerSendTextMessage (cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById (item) .. '<< foi adicionado à lista de autoloot.')
elseif (ação: reduzir () == 'remover') então
informações sobre locais, lista = getPlayerStorageValue (cid, stor), {}
se (infos ~ = -1), então
lista = toString (infos): gsub ('_',''): explode (',')
final
if (# lista == 0) então
voltar doPlayerSendCancel (cid, "Você não tem nenhum item adicionado. ')
final
if (lista #> = limite), então
voltar doPlayerSendCancel (cid, "Você já tem '.. limite ..' itens autolooting. ')
final
locais item = tonumber (RST)
se não o item, em seguida,
item de getItemIdByName = (rst, false)
se não o item, em seguida,
voltar doPlayerSendCancel (cid, "não item válido. ')
final
final
se não isInArray (item da lista), então
voltar doPlayerSendCancel (cid, "Este item não está na lista. ')
final
local = novo''
para v, id em ipairs (lista) fazer
if (tonumber (id) ~ = item), então
novo = new .. '_' .. id: gsub ('_','') .. ((V <lista #) e ',' ou'')
final
final
doPlayerSetStorageValue (cid, stor tostring, (novo))
doPlayerSendTextMessage (cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById (item) .. '<< removido da lista autoloot.')
final
return true
final
Como Funciona?
digite / aloot add: nome do item-> Para adicionar à Lista digite / aloot check-> Checar parágrafo SUA Lista de itens digite / aloot apagar: nome do item> Para deletar o artigo da Lista Obs:. Máximo 5 itens nd Lista