SP

Comprar Itens Com !buy

Por Special_Forces, 20 de mar. de 2008 em Actions e Talkactions

script
7
2.9k
20 de março de 2008 às 10:58

Eu configurei pra comprar só algumas coisas, se quiser adicionar mais eu vou explicar no final do tópico:

 

Em data\talkactions\scripts\buy.lua:

-----------------------By Nahruto--------------------------

-------------------http://otfans.net/----------------------

function getPlayerMoney(cid)

gold = getPlayerItemCount(cid,2148)

plat = getPlayerItemCount(cid,2152)*100

crys = getPlayerItemCount(cid,2160)*10000

money = gold + plat + crys

return money

end

local items = {

["aol"] = {cash=10000, id=2173, amount=1},

["food"] = {cash=1000, id=2671, amount=100},

["uh"] = {cash=1000, id=2273, amount=100},

["sd"] = {cash=1000, id=2268, amount=100},

["mr"] = {cash=1000, id=2280, amount=100},

["ice rapier"] = {cash=50000, id=2396, amount=1},

["dragon ham"] = {cash=10000, id=2672, amount=100},

["backpack"] = {cash=100, id=1988, amount=1},

["great mana potion"] = {cash=150, id=7590, amount=1},

["strong mana potion"] = {cash=100, id=7589, amount=1},

["great health potion"] = {cash=150, id=7591, amount=1},

["strong health potion"] = {cash=100, id=7588, amount=1}

}

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

function onSay(cid, words, param)

bitem = items[param]

if (bitem ~= nil) then

if getPlayerMoney(cid) >= bitem.cash then

doPlayerAddItem(cid,bitem.id,bitem.amount)

doPlayerRemoveMoney(cid,bitem.cash)

else

doPlayerSendCancel(cid,"Desculpe, Dinheiro Insuficiente")

end

else

doPlayerSendCancel(cid, "Esse Item não é vendido.")

end

return 1

end

 

Para Adicionar outros itens, copie 1 desses, o Cash é o preço, ID é o id do item, e AMOUNT é a quantidade, ex da backpack, ela custará 100gp e só vira uma. PS: NÃO SE ESQUEÇA DE COLOCAR VIRGULAS DEPOIS DOS ITENS, APENAS O ULTIMO NÃO TEM VIRGULA.

 

Em data\actions\talkactions.xml:

-- Comprar com !buy

<talkaction words="!buy" script="buy.lua" />

 

Créditos do OTFans e meu por repassar

1 mês depois...
Matheus galloM
04 de abril de 2008 às 17:27

bem legal :D

TwopacT
04 de abril de 2008 às 18:21

Mt Bom...

vlw kra...

:thumbsupsmiley:

XKronusXX
04 de abril de 2008 às 18:27

Olha, é bastante interessante, mas não sei se vai ser impregado.

Acho melhor quando se usa npcs, fica um pouco mais RPG.

Bom, de qualquer forma, to bão.

Abraço

 

//Kronus

KullerK
07 de abril de 2008 às 18:04

NÃO CONSIGO COMPRAR

QUAL É OO COMANDO PRA COMPRA AOL POR EXEMPLO??

SchiavinatoS
13 de abril de 2008 às 21:08

Axo q eh tpw assim...

vc ker aol..

vc fala:

!buy aol

ou

!buyaol

nao sei..

soh testando

x)

faveladoF
15 de abril de 2008 às 10:12

Kkkkkkkkkk.

mais se colocar alguns itens bobo pra vende ficaria legal! ;P

 

Vlw ae cara!