~~> /buy list, você vera os itens que pode ser comprados e o preço deles.
~~> /buy check, verifica quantos de cash você tem.
Instalando o sistema !
1ª: Entre na pasta data/creaturescripts/scripts, e crie um arquivo chamado cash.lua, cole este código dentro:
function onKill(cid, target, lastHit)
local cash = 150 -- O tanto de cash que ira ganhar ao matar o player
if isPlayer(cid) and isPlayer(target) then
if getPlayerIp(target) ~= getPlayerIp(cid) then
setPlayerStorageValue(cid, 45550, (getPlayerStorageValue(cid, 45550)+cash))
end
end
return TRUE
end
2ªa: Agora em creaturescripts/creaturescripts.xml bote a tag:
2ªb:Agora em creaturescripts/scripts , localize login.lua (antes do ultimo return true) e cole isto dentro:
registerCreatureEvent(cid, "Kill_Cash")
3ª:Voltando em data/talkactions/scripts crie um arquivo com o nome de cash.lua e cole isto dentro:
-- Script by: thalia --
local item = {
["plate armor"] = {cash=150, id=2463, amount=1},
["plate legs"] = {cash=150, id=2647, amount=1},
}
function onSay(cid, words, param)
itens = item[param]
if param == "check" then
return doPlayerSendTextMessage(cid,19,'Your total cash is '..getPlayerStorageValue(cid, 45550)..'.')
elseif param == "list" then
str = nil
for name, tab in pairs(item) do
str = str == nil and "Item name: "..name.." - Price: "..tab.cash .. "\n" or str .. "Item name: "..name.." - Price: "..tab.cash .. "\n"
end
doShowTextDialog(cid, 2160, str)
return true
end
if (itens ~= nil) then
if getPlayerStorageValue(cid, 45550) >= itens.cash then
doSendMagicEffect(getThingPos(cid),28)
doPlayerAddItem(cid,itens.id,itens.amount)
setPlayerStorageValue(cid, 45550, (getPlayerStorageValue(cid,45550)-itens.cash))
return doPlayerSendTextMessage(cid,19,'Your total cash now is '..getPlayerStorageValue(cid, 45550)..'.')
else
return doPlayerSendCancel(cid,"Sorry, cash insufficient.")
end
else
return doPlayerSendCancel(cid,"Sorry, this item is not for sale.")
end
return TRUE
end
4ª:Agora em talkactions/talkactions.xml bote está tag:
info
Grupo: Artesão
Registrado: 03/07/07
Posts: 104
Reputação: +280
Nome: Ganhe cash ao matar alguem.
Versão: Testada tfs 0.3.6 (8.54), provavelmente funfa em 8.54 +
Créditos: Eu e para o demonbholder por me ajudar a fazer a lista.
Como funciona?
Quando você mata um player você ganha 100 cash (Pode ser alterado no script), e falano:
~~> /buy nome_do_item (Exemplo: /buy plate armor), você automaticamente comprara o item.
~~> /buy list, você vera os itens que pode ser comprados e o preço deles.
~~> /buy check, verifica quantos de cash você tem.
Instalando o sistema !
1ª: Entre na pasta data/creaturescripts/scripts, e crie um arquivo chamado cash.lua, cole este código dentro:
2ªa: Agora em creaturescripts/creaturescripts.xml bote a tag:
2ªb:Agora em creaturescripts/scripts , localize login.lua (antes do ultimo return true) e cole isto dentro:
3ª:Voltando em data/talkactions/scripts crie um arquivo com o nome de cash.lua e cole isto dentro:
-- Script by: thalia -- local item = { ["plate armor"] = {cash=150, id=2463, amount=1}, ["plate legs"] = {cash=150, id=2647, amount=1}, } function onSay(cid, words, param) itens = item[param] if param == "check" then return doPlayerSendTextMessage(cid,19,'Your total cash is '..getPlayerStorageValue(cid, 45550)..'.') elseif param == "list" then str = nil for name, tab in pairs(item) do str = str == nil and "Item name: "..name.." - Price: "..tab.cash .. "\n" or str .. "Item name: "..name.." - Price: "..tab.cash .. "\n" end doShowTextDialog(cid, 2160, str) return true end if (itens ~= nil) then if getPlayerStorageValue(cid, 45550) >= itens.cash then doSendMagicEffect(getThingPos(cid),28) doPlayerAddItem(cid,itens.id,itens.amount) setPlayerStorageValue(cid, 45550, (getPlayerStorageValue(cid,45550)-itens.cash)) return doPlayerSendTextMessage(cid,19,'Your total cash now is '..getPlayerStorageValue(cid, 45550)..'.') else return doPlayerSendCancel(cid,"Sorry, cash insufficient.") end else return doPlayerSendCancel(cid,"Sorry, this item is not for sale.") end return TRUE end4ª:Agora em talkactions/talkactions.xml bote está tag:
Prontinho, script istalado...
Ai vocês me pergunta: Como adicionar mais itens?
E eu respondo:
Simples
Nesta parte:
È só adicionar:
BOM È ISSO
COMENTEM O QUE ACHARAM!
È só fazer isso um em baixo do outro.