É um script simples, que troca ou um helmet por outro, ou uma boots por outra. ( Configurável )
O player precisará de dinheiro para fazer as trocas.
Em data/talkactions/scripts crie um arquivo com o nome de trocaritems.lua e adicione:
function onSay(cid, words, param)
local money = 500
local table = {
["helmet"] = {id = 2457, toid = 2491},
["boots"] = {id = 2643, toid = 2645},
}
if param == "helmet" then
if getPlayerItemCount(cid, table["helmet"].id) >= 1 then
if getPlayerMoney(cid) >= money then
doPlayerSendTextMessage(cid, 22, "Você fez uma troca de items!")
doPlayerRemoveMoney(cid, money)
doPlayerRemoveItem(cid, table["helmet"].id, 1)
doPlayerAddItem(cid, table["helmet"].toid, 1)
else
doPlayerSendCancel(cid, " Você não tem dinheiro suficiente!")
end
else
doPlayerSendCancel(cid, " Você não tem o item necessário!")
end
return true
end
if param == "boots" then
if getPlayerItemCount(cid, table["boots"].id) >= 1 then
if getPlayerMoney(cid) >= 500 then
doPlayerSendTextMessage(cid, 22, "Você fez uma troca de items!")
doPlayerRemoveMoney(cid, 500)
doPlayerRemoveItem(cid, table["boots"].id, 1)
doPlayerAddItem(cid, table["boots"].toid, 1)
else
doPlayerSendCancel(cid, " Você não tem dinheiro suficiente!")
end
else
doPlayerSendCancel(cid, " Você não tem o item necessário!")
end
end
return true
end
info
Grupo: Marquês
Registrado: 18/05/11
Posts: 1.1k
Reputação: +150
Gênero: Masculino
Trocar Items
E ai galera, beleza?
É um script simples, que troca ou um helmet por outro, ou uma boots por outra. ( Configurável )
O player precisará de dinheiro para fazer as trocas.
Em data/talkactions/scripts crie um arquivo com o nome de trocaritems.lua e adicione:
function onSay(cid, words, param) local money = 500 local table = { ["helmet"] = {id = 2457, toid = 2491}, ["boots"] = {id = 2643, toid = 2645}, } if param == "helmet" then if getPlayerItemCount(cid, table["helmet"].id) >= 1 then if getPlayerMoney(cid) >= money then doPlayerSendTextMessage(cid, 22, "Você fez uma troca de items!") doPlayerRemoveMoney(cid, money) doPlayerRemoveItem(cid, table["helmet"].id, 1) doPlayerAddItem(cid, table["helmet"].toid, 1) else doPlayerSendCancel(cid, " Você não tem dinheiro suficiente!") end else doPlayerSendCancel(cid, " Você não tem o item necessário!") end return true end if param == "boots" then if getPlayerItemCount(cid, table["boots"].id) >= 1 then if getPlayerMoney(cid) >= 500 then doPlayerSendTextMessage(cid, 22, "Você fez uma troca de items!") doPlayerRemoveMoney(cid, 500) doPlayerRemoveItem(cid, table["boots"].id, 1) doPlayerAddItem(cid, table["boots"].toid, 1) else doPlayerSendCancel(cid, " Você não tem dinheiro suficiente!") end else doPlayerSendCancel(cid, " Você não tem o item necessário!") end end return true endEm talkactions.xml adicione a tag:
Configuração
Aqui você irá editar os items:
ID será o item que o player tem e toid será o item que ele irá ganhar.
E aqui o dinheiro:
Para executar, é só usar !trocar helmet ou !trocar boots
É isso galera, espero que sirva pra algo.
Abraços!
Editado Maio 1 por PsyMcKenzie