[Help] Potion Por Alavanca Sem Bp

180209
Por 180209
em Scripts

180209

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/08/11Posts: 10

Boa Noite Galera... Sou Novoo Aqui, preciso de uma ajudinha basica *-*

 

Tenho um script de Potion Por Alavanca Só que com BP e to querendo um Sem Bp.. Segue o Scrip a Baixo :

 

ghp_id = 7591 -- Item a ser vendido

backpackghp_id = 2000 -- Backpack

custoghp_id = 3800 -- Valor

cargasghp_id = 20 -- Cargas

 

local name = getItemNameById(ghp_id)

----- End Config -----

function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveMoney(cid, custoghp_id) == TRUE then

local bag = doPlayerAddItem(cid, backpackghp_id, 1)

doSendAnimatedText(fromPosition, "", TEXTCOLOR_YELLOW)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased a backpack of ".. name .."s for ".. custoghp_id .." gold.")

for i=1,20 do

doAddContainerItem(bag, ghp_id, cargasghp_id)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custoghp_id .." gold coins for a backpack of ".. name .."s.")

end

return FALSE

end

Newtonnotwen

Só quero saber o porque, o resto são detalhes.
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 04/08/12Posts: 762

Tenta assim:

backpackghp_id = 0 -- Backpack

 

-Vermelho: Ponha 0

 

---------------------------

 

Se não funcionar ponha:

ghp_id = 7591 -- Item a ser vendido

backpackghp_id = 2000 -- Backpack

custoghp_id = 3800 -- Valor

cargasghp_id = 20 -- Cargas

 

local name = getItemNameById(ghp_id)

----- End Config -----

function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveMoney(cid, custoghp_id) == TRUE then

local bag = doPlayerAddItem(cid, 7591, 20)

doSendAnimatedText(fromPosition, "", TEXTCOLOR_YELLOW)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased a backpack of ".. name .."s for ".. custoghp_id .." gold.")

for i=1,20 do

doAddContainerItem(bag, 7591, 0)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custoghp_id .." gold coins for a backpack of ".. name .."s.")

end

return FALSE

end

Editando:

 

-Vermelho: Id do item

-Verde: Quantidade

b5feb15da83eca8bd379039567f3992860f398f765aea98c57dcd2a1ffb0d35ca20603caaf7d9f03da39a3ee5e6b4b0d3255bfef95601890afd807098c4de7dfec2a3351efcdaa9ed8451e6c.gif

LuckOake

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 23/07/12Posts: 1104Gênero: MasculinoChar no Tibia: Luck Oake

Fica mais simples assim o script:

 

 

ghp_id = 7591 -- Item a ser vendido

backpackghp_id = 2000 -- Backpack

custoghp_id = 3800 -- Valor

cargasghp_id = 20 -- Cargas

 

local name = getItemNameById(ghp_id)

----- End Config -----

function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveMoney(cid, custoghp_id) == TRUE then

doSendAnimatedText(fromPosition, "", TEXTCOLOR_YELLOW)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased 20 of ".. name .."s for ".. custoghp_id .." gold.")

for i=1,20 do

doPlayerAddItem(cid, ghp_id, cargasghp_id)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custoghp_id .." gold coins for a backpack of ".. name .."s.")

end

return FALSE

end

 

180209

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/08/11Posts: 10

Testei os dois scripts mais o 1 º da o seguinte erro:

 

[09/08/2012 22:02:24] [Error - Action Interface]

[09/08/2012 22:02:24] data/actions/scripts/tools/greathp.lua:onUse

[09/08/2012 22:02:24] Description:

[09/08/2012 22:02:24] (luaDoAddContainerItem) Container not found

 

O 2º as Pot's Cai no chão .. sleep.png

LuckOake

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 23/07/12Posts: 1104Gênero: MasculinoChar no Tibia: Luck Oake

@Mylaah

 

Você tem que ter espaço na backpack. Libera 20 slots ou dá /i backpack duas vezes e tenta.

180209

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/08/11Posts: 10

Bom Agora deu o Mesmo Erro do 1 º script

[09/08/2012 22:14:11] [Error - Action Interface]

[09/08/2012 22:14:11] data/actions/scripts/tools/greathp.lua:onUse

[09/08/2012 22:14:11] Description:

[09/08/2012 22:14:11] (luaDoAddContainerItem) Container not found

LuckOake

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 23/07/12Posts: 1104Gênero: MasculinoChar no Tibia: Luck Oake

Você deve ter esquecido de colocar o meu script novamente, pois nele não tem nenhuma função doAddContainerItem.

 

Substitua seu script por esse.

 

ghp_id = 7591 -- Item a ser vendido

custoghp_id = 3800 -- Valor

cargasghp_id = 20 -- Cargas

 

local name = getItemNameById(ghp_id)

----- End Config -----

function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveMoney(cid, custoghp_id) == TRUE then

doSendAnimatedText(fromPosition, "", TEXTCOLOR_YELLOW)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased 20 of ".. name .."s for ".. custoghp_id .." gold.")

for i=1,20 do

doPlayerAddItem(cid, ghp_id, cargasghp_id)

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custoghp_id .." gold coins for 20 of ".. name .."s.")

end

return FALSE

end

 

180209

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/08/11Posts: 10

É não deu mais o erro, porém vem 1 bp com potion até a cap do player acabar, e no caso queria um que viesse só com as 100 potion ...

LuckOake

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 23/07/12Posts: 1104Gênero: MasculinoChar no Tibia: Luck Oake

Ah sim, tá aqui o script:

 

 

ghp_id = 7591 -- Item a ser vendido

custoghp_id = 3800 -- Valor

cargasghp_id = 100 -- Cargas

local name = getItemNameById(ghp_id)

 

----- End Config -----

function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveMoney(cid, custoghp_id) == TRUE then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased 20 of ".. name .."s for ".. custoghp_id .." gold.")

doPlayerAddItem(cid, ghp_id, cargasghp_id)

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custoghp_id .." gold coins for 20 of ".. name .."s.")

end

return FALSE

end

 

180209

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/08/11Posts: 10

Hehehe, Brigada !!! s2

Newtonnotwen

Só quero saber o porque, o resto são detalhes.
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 04/08/12Posts: 762

Pedido atendido.

 

By: LuckOake.

b5feb15da83eca8bd379039567f3992860f398f765aea98c57dcd2a1ffb0d35ca20603caaf7d9f03da39a3ee5e6b4b0d3255bfef95601890afd807098c4de7dfec2a3351efcdaa9ed8451e6c.gif