Ir para conteúdo

Magia So Para Reset


Hired

Posts Recomendados

ok,

aqui vai o meu:

 

 

--[[ SCRIPTING> MarcelloMkez <scriptING ]]

 

--[[ [Advanced Reset System]

Autor: MarcelloMkez

Versão: 1.0

Testado em: 8.50, TFS 0.3.6

Fórum: www.xtibia.com/forum

 

[Características]

~ Versão 1.0 ~

 

- Resets no Look;

- Premium Account ou não;

- Mudar Vocação;

- Limite de Resets;

- Opções para Abilitar e Desabilitar Condições;

 

[Em Construção]

 

- Stages Free e Premium;

- 'Talvez' um novo sistema de mudar Vocação;

sem data para postagem. ]]

 

 

 

function onSay(cid, words, param)

 

--[Configurações de Condição]__

config = {

 

needPa = false, -- Precisa de Premium Account? [true / false]

needPz = true, -- Precisa estar em Protection Zone? [true / false]

battle = false, -- Precisa estar sem Batlle para Resetar? [true / false]

withe = false, -- Players PK Withe pode Resetar? [true / false] --[[verdadeiro / Falso]]

red = false, -- Players PK Red pode Resetar? [true / false]

tp = true, -- Teleportar para o Templo após o reset? [true / false]

look = true, -- Mostrar Resets no Look do Player? [true / false]

addLimite = false, -- Abilitar Limite de Resets? [true / false]

setClasse = true, -- Mudar Vocação do player quando resetar? [true / false]

storage = 2310, -- Storage [valor]

 

 

--[Configurações do Reset]__

resetStatus = {

 

player = getPlayerGUID(cid), -- Não Mude.

lvl = 150 , -- Level Nessesário para Resetar. [valor]

lvlreset = 8, -- Level que retornará após o Reset. [valor]

limite = 15, -- Máximo de resets que um player pode chegar. [valor]

newClasse = 13, -- Id da Nova Vocação após o Reset. [valor]

tempo= 5 -- Tempo para o Player deslogar para Resetar. Em segundos. [valor]

},

}

 

--[Funções]__

 

--[ Funçoes de promotion Criada a parte ]

 

function promReseting(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function promnoTeleporting(cid)

 

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

 

return TRUE

end

 

function promnoLook(cid)

 

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

 

return TRUE

end

 

function promsetClasse(cid)

 

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

 

return TRUE

end

 

--[/ fim Functions de promotion criadas a parte]

 

 

function Reseting(cid)

local query = db.getResult("SELECT `vocation` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

local twoQuery = db.getResult("SELECT `promotion` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

 

if twoQuery:getDataInt("promotion") >= 1 then

addEvent(promReseting, 1000, cid)

return TRUE

 

 

elseif resets = getResets(cid) then

setPlayerStorageValue(cid,config.storage,resets+1)

setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid)+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

end

return TRUE

end

 

function noAll(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

return TRUE

end

 

function noTeleporting(cid)

 

local query = db.getResult("SELECT `vocation` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

local twoQuery = db.getResult("SELECT `promotion` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

 

if twoQuery:getDataInt("promotion") >= 1 then

addEvent(promnoTeleporting, 1000, cid)

return TRUE

 

elseif resets = getResets(cid) then

setPlayerStorageValue(cid,config.storage,resets+1)

setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid)+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

end

return TRUE

end

 

function noLook(cid)

 

local query = db.getResult("SELECT `vocation` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

local twoQuery = db.getResult("SELECT `promotion` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

 

if twoQuery:getDataInt("promotion") >= 1 then

addEvent(promnoLook, 1000, cid)

return TRUE

 

elseif resets = getResets(cid) then

setPlayerStorageValue(cid,config.storage,resets+1)

setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid)+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

end

return TRUE

end

 

function noClasse(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function setClasse(cid)

local query = db.getResult("SELECT `vocation` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

local twoQuery = db.getResult("SELECT `promotion` FROM `players` WHERE `id` = "..config.resetStatus.player..";")

 

if twoQuery:getDataInt("promotion") >= 1 then

addEvent(promsetClasse, 1000, cid)

return TRUE

 

elseif resets = getResets(cid) then

setPlayerStorageValue(cid,config.storage,resets+1)

setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid)+1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

end

return TRUE

end

 

function look(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function teleporting(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function getResets(cid)

resets = getPlayerStorageValue(cid,config.storage)

 

if resets < 0 then

resets = 0

end

return resets

 

end

 

--[Estrutura]__

 

local resets = getResets(cid)

local needLvl ="Você precisa de "..config.resetStatus.lvl-getPlayerLevel(cid).." level's para resetar."

local msg ="~~[Reset: "..getResets(cid).."]~~ 'Sucesso ao Resetar! Você será deslogado em 5 Segundos."

 

 

 

--[Condiçoes]__

 

 

 

if(config.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then

doPlayerSendTextMessage(cid,22,"Você Precisa estar em Protection Zone Para Resetar.")

return TRUE

 

elseif(config.addLimite == true) and (getResets(cid) == config.resetStatus.limite) then

doPlayerSendTextMessage(cid, 22, "Você ja atingiu o Limite de Resets.")

return TRUE

 

elseif(config.withe == false) and (getCreatureSkullType(cid) == 3) then

doPlayerSendTextMessage(cid,22,"Você ta PK White, por isso não pode resetar.")

return TRUE

 

elseif(config.red == false) and (getCreatureSkullType(cid) == 4) then

doPlayerSendTextMessage(cid,22,"Você ta PK Red, por isso não pode resetar.")

return TRUE

 

elseif(config.needPa == true) and not isPremium(cid) then

doPlayerSendTextMessage(cid,22,"Você Precisa ser Premium Account para Resetar.")

return TRUE

 

elseif(config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then

doPlayerSendTextMessage(cid,22,"Você Precisa estar sem Battle para Resetar.")

return TRUE

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == true) then

addEvent(Reseting, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == false) then

addEvent(noAll, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == true) then

addEvent(noTeleporting, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == true) then

addEvent(noLook, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == false) then

addEvent(noClasse, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == true) then

addEvent(setClasse, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == false) then

addEvent(look, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == false) then

addEvent(teleporting, config.resetStatus.tempo* 1000, cid)

 

elseif doPlayerSendCancel(cid, needLvl) then

doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)

return TRUE

end

 

if doPlayerPopupFYI(cid, msg) then

 

end

return TRUE

 

end

 

--[by: MarcelloMkez]__

 

 

Link para o comentário
Compartilhar em outros sites

exemplo:

 

function getResets(cid)
resets = getPlayerStorageValue(cid,2310) 
if resets < 0 then 
resets = 0 
end 
return resets
end

local min_reset = 5 -- quantidade de reset que precisa ter para usar a magia

function onCastSpell(cid, var)
if getResets(cid) < min_reset then
doPlayerSendTextMessage(cid, 23, "Sorry, you need a ".. min_reset .." reset's to use this.")
end
doCombat(cid, acombat, var)
return TRUE
end

Link para o comentário
Compartilhar em outros sites

  • 6 months later...
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...