Script Clan

phardole
em Scripts

phardole

Aprendendo :D
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/05/10Posts: 69Char no Tibia: Pedro

Alguém me ajuda com esse script?

 

 

function onSay(cid, words, param)


local clans = {"Volcanic", "Seavell", "Orebound", "Wingeon", "Malefic", "Gardestrike", "Psycraft", "Naturia", "Raibolt"}

local t = string.explode(param, ",")

if words == "!entrarclan" then

if param == "" then
return doPlayerSendCancel(cid, "Estão faltando os parâmetros!")
end

local clan = t[1]

if getPlayerLevel(cid) < 80 then
return doPlayerSendCancel(cid, "Você precisa ser level 80 para entrar em um clan.")
end

if not isInArray(clans, t[1]) then
return doPlayerSendCancel(cid, ""..clan.." não é um clan válido.")
end

if getPlayerStorageValue(cid, 86228) >= 1 then
return doPlayerSendCancel(cid, "Você já está em um clan.")
end

setPlayerClan(cid, clan)
doPlayerSendTextMessage(cid, 19, "Agora você pertence ao Clan ["..clan.."], rank: 1")
setPlayerClanRank(cid, 1)

elseif words == "!rankclan" then



if param == "" then
return doPlayerSendTextMessage(cid, 19, "[Clan] Digita o Numero ex: !rankclan 1!")
end

local ta = {

[2] = {level = 100},
[3] = {level = 125},
[4] = {level = 150},
[5] = {level = 200},
}
local money = 2160
local qntt = 5


local levels = ta[(getPlayerStorageValue(cid, 862281) + 1)]
local lv = levels.level

if getPlayerStorageValue(cid, 862281) >= tonumber(t[1]) then
return doPlayerSendTextMessage(cid, 19, "[Clan] Você já passou desse rank.")
end

if tonumber(t[1]) >= tonumber((getPlayerStorageValue(cid, 862281)) + 2) then
return doPlayerSendTextMessage(cid, 19, "[Clan] Você não pode fazer isso!")
end

if getPlayerStorageValue(cid, 86228) <= 1 then
return doPlayerSendTextMessage(cid, 27, "[Clan] Você nao tem Clan!")

end


if getPlayerLevel(cid) < lv then
return doPlayerSendTextMessage(cid, 19,"[Clan] Você não possui o level necessário.")
end

if getPlayerItemCount(cid, money) >= qntt then
doPlayerRemoveItem(cid, money, qntt)
else
return doPlayerSendTextMessage(cid, 19,"[Clan] Você não Tem [5] Thousand Dollars Para Avançar de Rank!.")
end


setPlayerClanRank(cid, getPlayerStorageValue(cid, 862281) + 1)
doPlayerSendTextMessage(cid, 27, "[Clan] Você avançou de rank! Rank atual: ["..getPlayerStorageValue(cid, 862281).."].")

elseif words == "!trocarclan" then

local item = 2160 --ID do item.
local qnt = 1 --Quantidade do item.
local to_go = t[1]

if param == "" then
return doPlayerSendCancel(cid, "Estão faltando os parâmetros!")
end

if not isInArray(clans, t[1]) then
return doPlayerSendCancel(cid, ""..t[1].." não é um clan válido.")
end

if getPlayerStorageValue(cid, 86228) < 1 then
return doPlayerSendCancel(cid, "Você não pertence a clan algum!")
end

if getPlayerItemCount(cid, item) >= qnt then
doPlayerRemoveItem(cid, item, qnt)
doPlayerSendTextMessage(cid, 27, "Você trocou de clan, pertencendo agora ao clan: "..t[1]..".")
setPlayerClan(cid, to_go)
setPlayerClanRank(cid, 1)
else
return doPlayerSendCancel(cid, "Você não tem o item necessário! ITEM: "..item.." QUANTIDADE: "..qnt..".")
end
end
return true

end

 

 

ta dando esse erro quando uso o comando.

 

[05/10/2015 15:45:39] [Error - TalkAction Interface]
[05/10/2015 15:45:39] data/talkactions/scripts/cl.lua:onSay
[05/10/2015 15:45:39] Description:
[05/10/2015 15:45:39] data/talkactions/scripts/cl.lua:52: attempt to index local 'levels' (a nil value)
[05/10/2015 15:45:39] stack traceback:
[05/10/2015 15:45:39] data/talkactions/scripts/cl.lua:52: in function <data/talkactions/scripts/cl.lua:1>

 

Rep + pra quem ajudar

joshua8822

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/09/15Posts: 17

function onSay(cid, words, param)


local clans = {"Volcanic", "Seavell", "Orebound", "Wingeon", "Malefic", "Gardestrike", "Psycraft", "Naturia", "Raibolt"}

local t = string.explode(param, ",")

if words == "!entrarclan" then

if param == "" then
return doPlayerSendCancel(cid, "Estão faltando os parâmetros!")
end

local clan = t[1]

if getPlayerLevel(cid) < 80 then
return doPlayerSendCancel(cid, "Você precisa ser level 80 para entrar em um clan.")
end

if not isInArray(clans, t[1]) then
return doPlayerSendCancel(cid, ""..clan.." não é um clan válido.")
end

if getPlayerStorageValue(cid, 86228) >= 1 then
return doPlayerSendCancel(cid, "Você já está em um clan.")
end

setPlayerClan(cid, clan)
doPlayerSendTextMessage(cid, 19, "Agora você pertence ao Clan ["..clan.."], rank: 1")
setPlayerClanRank(cid, 1)

elseif words == "!rankclan" then



if param == "" then
return doPlayerSendTextMessage(cid, 19, "[Clan] Digita o Numero ex: !rankclan 1!")
end

local ta = {

[2] = {level = 100},
[3] = {level = 125},
[4] = {level = 150},
[5] = {level = 200},
}
local money = 2160
local qntt = 5


local levels = ta[(getPlayerStorageValue(cid, 862281) + 1)
local lv = levels.level

if getPlayerStorageValue(cid, 862281) >= tonumber(t[1]) then
return doPlayerSendTextMessage(cid, 19, "[Clan] Você já passou desse rank.")
end

if tonumber(t[1]) >= tonumber((getPlayerStorageValue(cid, 862281)) + 2) then
return doPlayerSendTextMessage(cid, 19, "[Clan] Você não pode fazer isso!")
end

if getPlayerStorageValue(cid, 86228) <= 1 then
return doPlayerSendTextMessage(cid, 27, "[Clan] Você nao tem Clan!")

end


if getPlayerLevel(cid) < lv then
return doPlayerSendTextMessage(cid, 19,"[Clan] Você não possui o level necessário.")
end

if getPlayerItemCount(cid, money) >= qntt then
doPlayerRemoveItem(cid, money, qntt)
else
return doPlayerSendTextMessage(cid, 19,"[Clan] Você não Tem [5] Thousand Dollars Para Avançar de Rank!.")
end


setPlayerClanRank(cid, getPlayerStorageValue(cid, 862281) + 1)
doPlayerSendTextMessage(cid, 27, "[Clan] Você avançou de rank! Rank atual: ["..getPlayerStorageValue(cid, 862281).."].")

elseif words == "!trocarclan" then

local item = 2160 --ID do item.
local qnt = 1 --Quantidade do item.
local to_go = t[1]

if param == "" then
return doPlayerSendCancel(cid, "Estão faltando os parâmetros!")
end

if not isInArray(clans, t[1]) then
return doPlayerSendCancel(cid, ""..t[1].." não é um clan válido.")
end

if getPlayerStorageValue(cid, 86228) < 1 then
return doPlayerSendCancel(cid, "Você não pertence a clan algum!")
end

if getPlayerItemCount(cid, item) >= qnt then
doPlayerRemoveItem(cid, item, qnt)
doPlayerSendTextMessage(cid, 27, "Você trocou de clan, pertencendo agora ao clan: "..t[1]..".")
setPlayerClan(cid, to_go)
setPlayerClanRank(cid, 1)
else
return doPlayerSendCancel(cid, "Você não tem o item necessário! ITEM: "..item.." QUANTIDADE: "..qnt..".")
end
end
return true

end

local levels = ta[(getPlayerStorageValue(cid, 862281) + 1)] - um ] de mais.

 

Teste, eu nao e testado.

phardole

Aprendendo :D
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/05/10Posts: 69Char no Tibia: Pedro

Ainda da o erro. :(


Consegui aqui vlws.. usei o meu mesmo.. acho que tava dando erro porque estava tentando usar em char que ja tava rank 5..

porem foi pego rank 5 por outra storage.. ai devia tar dando conflito.

ai criei outro char e testei e não deu mais.

Mudrock

Eternal Liers
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 24/12/09Posts: 1002Gênero: MasculinoChar no Tibia: Necromanser

Tópico movido para dúvidas / pedidos resolvidos.

Antenciosamente, Mudrock

Mensagens privadas somente sobre outros assuntos!

Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.

 
 

tumblr_ntxzlfQp3v1uyo57xo8_500.gif (500×225)

 

MudrockAprova#

- EkzGuard

 

soltore

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 01/10/15Posts: 72

oque seria esse sistema de clan ? como funciona ? seria um estilo de guild ?