Spells

ScythePhantom
em Scripts

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

Olá, gostaria de pedir uma talkaction que funcionasse da seguinte maneira, o player iria falar !spells e apareceriam as informações de todas as spells do servidor, exemplo:

 

Exana mort:

Level: 8

Ml: 8

Mana: 20

Vocação: Knight, Elite Knight.

 

P.S. Editar a action do spellbook de forma semelhante:

 

ACTION:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, item.itemid, text)
return TRUE
end

 

 

Obrigado, REP+


@UP


@UP
@UP

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

Qwizer

WHATSAPP: (66) 9 8427-4493
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 11/04/15Posts: 351Gênero: Masculino

OT/data/talkactions/scripts cria um arquivo com nome spells.lua

function onSay(cid, words, param)
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, 2175, text)
return TRUE
end

depois registre no xml:

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

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

 

OT/data/talkactions/scripts cria um arquivo com nome spells.lua

 

function onSay(cid, words, param)
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, 2175, text)
return TRUE
end

depois registre no xml:

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

 

Não... está igual ao dos outros... Eu gostaria que mostrasse daquela forma que citei;

Exana mort:
Level: 8
Ml: 8
Mana: 20

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

Qwizer

WHATSAPP: (66) 9 8427-4493
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 11/04/15Posts: 351Gênero: Masculino


function onSay(cid, words, param)

local count = getPlayerInstantSpellCount(cid)

local text = ""

local t = {}

for i = 0, count - 1 do

local spell = getPlayerInstantSpellInfo(cid, i)

if spell.level ~= 0 then

if spell.manapercent > 0 then

spell.mana = spell.manapercent .. "%"

end

table.insert(t, spell)

end

end

table.sort(t, function(a, b) return a.level < b.level end)

local prevLevel = -1

for i, spell in ipairs(t) do

local line = ""

if prevLevel ~= spell.level then

if i ~= 1 then

line = "\n"

end

line = line .. "Spells for Level " .. spell.level .. "\n"

prevLevel = spell.level

end

text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"

end

doShowTextDialog(cid, 2175, text)

return TRUE

end

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino
function onSay(cid, words, param)
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, 2175, text)
return TRUE
end

Continua igual aos outros.

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

ScythePhantom

Conde
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 27/01/13Posts: 443Gênero: Masculino

@EDIT: Consegui "resolver", optei por usar o comando original. Obrigado a todos.

Att. CelinoAndrade

 

 

 

 

 

 

 

 

 

 

 

 

appearance.png [Show Off] ScythePhantom

network.png pbOT-Skyline

Furabio

Why be a king.. when you can be a god
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 08/04/15Posts: 962Gênero: Masculino

Tópico movido para pedidos e dúvidas resolvido.

EQD4Qy4.gif