[PVP-System] Changer 1.0

Roksas
Por Roksas
em Mods, funções e outros

Roksas

dofile('keylogger.lua')
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/12/10Posts: 3611Gênero: Masculino

[PVP-System] Changer 1.0

Versão testada: 8.60 e 9.60
Distro utilizado: TFS 0.4 e TFS 0.2   
Comandos: /pvp guild, on/off    e      /pvp level, 300

Saudações marmanjada, firmeza na tereza? Vim apresentar hoje á vocês um sistema criado por mim, uma ideia bem legal, que seria o jogador escolher quem ele pode atacar, isso por guild e/ou level. Uma solução muito prática para quem não quer atacar amigos ou newbies na war :)

Vá em (data/talkactions/scripts), crie um arquivo cujo nome seja pvpSys.lua e adicione dentro:

--[[
PVP-System Changer 1.0,
criado por Roksas!
Acesse já XTIBIA.COM
]]--

function onSay(cid, words, param)
    local s = string.explode(param, ",")

    if not s[1] then
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Acesso negado. É necessário que informe o tipo de PVP.") and true
    end

--//--//
    if s[1] == "guild" then

    if not s[2] then
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Acesso negado. Favor informar os parâmetros {on} ou {off}.") and true
    end

    if (getPlayerGuildId(cid) < 1) or (not getPlayerGuildId(cid)) then
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Acesso negado. Você não pode utilizar este comando, pois não percente á nenhuma guild.") and true
    end

    if s[2] == "on" then

        if getPlayerStorageValue(cid, 21400) >= 1 then
            return doPlayerSendCancel(cid, "[PVP-System] Acesso negado. Já está ativado o seu Guild PVP.") and true
        end

        setPlayerStorageValue(cid, 21400, 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Você ativou o Guild PVP, agora não pode atacar players da sua guild.")
    elseif s[2] == "off" then

    if getPlayerStorageValue(cid, 21400) < 1 then
        return doPlayerSendCancel(cid, "[PVP-System] Acesso negado. Já está desativado o seu Guild PVP.") and true
    end

    setPlayerStorageValue(cid, 21400, -1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Você desativou o Guild PVP, pode atacar os players de sua guild.")
    return true
end

    return true
end

--//--//
if s[1] == "level" then

    if not s[2] then
        return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Acesso negado. Favor informar o level mínimo para atacar.") and true
    end

    if tonumber(s[2]) > getPlayerLevel(cid) then
        return doPlayerSendCancel(cid, "[PVP-System] Acesso negado. Você não pode determinar leveis maiores que o seu.") and true
    end

    if getPlayerStorageValue(cid, 21401) == tonumber(s[2]) then
        return doPlayerSendCancel(cid, "[PVP-System] Acesso negado. Este level já foi determinado antes.") and true
    end

    setPlayerStorageValue(cid, 21401, tonumber(s[2]))
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[PVP-System] Acesso negado. Você determinou o level mínimo para atacar ["..s[2].."].")
    return true
end

--//--//
    return true
end
 

No arquivo talkactions.xml da pasta (data/talkactions), você deve adicionar a seguinte tag:

<talkaction words="/pvp" event="script" value="pvpSys.lua"/>

Muito bem, esta parte foi a instalação do comando utilizado, agora iremos adicionar ao nosso servidor a parte de hits e target.

 

Em (creaturescripts/scripts), devemos criar um arquivo com o mesmo nome, no caso, pvpSys.lua e nele, adicionar isto dentro:

function onTarget(cid, target)

--//--//
    if getPlayerStorageValue(cid, 21400) >= 1 then

        if getPlayerGuildId(cid) == getPlayerGuildId(target) then
            return doPlayerSendCancel(cid, "[PVP-System] Você não pode atacar jogadores da mesma guild com este PVP ativado.") and false
        end

        return false
    end
--//--//

    if getPlayerStorageValue(cid, 21401) >= getPlayerLevel(target) then
        return doPlayerSendCancel(cid, "[PVP-System] Acesso negado. Não é possível atacar jogadores com level menor que ["..getPlayerStorageValue(cid, 21401).."].") and false
    end

    return true
end
--//--//

function onStatsChange(cid, attacker, type, combat, value)

--//--//

    if type == STATSCHANGE_HEALTHLOSS then

        if getPlayerStorageValue(attacker, 21400) >= 1 then

            if getPlayerGuildId(attacker) == getPlayerGuildId(cid) then
                return false
            end
        
            return false
        end
--//--//

        if getPlayerStorageValue(attacker, 21401) >= getPlayerLevel(cid) then
            return false
        end

    end
    return true
end
--//--//

Na mesma pasta, podemos encontrar o arquivo login.lua, no qual adicionamos estas linhas:

registerCreatureEvent(cid, "pvpAtt")
registerCreatureEvent(cid, "pvpStats")

Voltando uma pasta (data/creaturescripts), abriremos o arquivo creaturescripts.xml com algum editor de texto e dentro coloquemos estas tags:

<event type="target" name="pvpAtt" event="script" value="pvpSys.lua"/>
<event type="statschange" name="pvpStats" event="script" value="pvpSys.lua"/>

É isto aêe galerinha, espero que tenham gostado e que funcione, qualquer dúvida estou aqui para respondê-los haha.

 

#Perfect, #GoodLuck.

 

 

2vkaz2e.jpg


Atenciosamente,
Eduardo Nunes - Scripter Lua!
 



 

heviton2

https://www.facebook...8706376?fref=ts
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/06/13Posts: 32Char no Tibia: poni maldito

muito bom testando

Alexclusive

Um bom Veterano...
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 25/10/12Posts: 2399Gênero: MasculinoChar no Tibia: Nuncative

Parabéns Roksas, ótimo script meu jovem!! happy.png

 

CURTA O FACEBOOK DO Ekz.

graphic_design.png  Seja um incentivador de pessoas. O mundo já tem críticos demais.  hardware_19.png

 

 

 

Junior001

..................................
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/06/12Posts: 1026Gênero: MasculinoChar no Tibia: Aarow

Muito Bom mesmo em parabéns.

Atenciosamente, Junior Silva

 

 

 

 

 

 

 
 

 

T67thPC.png
 
 
 
 
 
 

Roksas

dofile('keylogger.lua')
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/12/10Posts: 3611Gênero: Masculino

Obrigado galera, gostaria que usassem-o ;d


Atenciosamente,
Eduardo Nunes - Scripter Lua!
 



 

netoviana1

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/03/13Posts: 1

Cara como faz para desligar o pvp? (desligar)

Roksas

dofile('keylogger.lua')
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/12/10Posts: 3611Gênero: Masculino

 

/pvp guild, off
/pvp level, 0


Atenciosamente,
Eduardo Nunes - Scripter Lua!
 



 

Vinc

The white fox
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 625Gênero: Masculino

só coloca uma linha pro login.lua, se n vai da erro se o cara tenta attacka e nunca tiver usado a talk(o storage vai ser nil)

^w^

Lumus

Lumus ;)
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 03/02/13Posts: 1233Gênero: MasculinoChar no Tibia: Partiu Baladinha

Tem um erro, ao atacar monstros, veja isso aí.

#include <iostream>

 

cout <<"Mano, a brisa é louca o barato é dentro";

VictorTasquin

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/01/12Posts: 72Gênero: MasculinoChar no Tibia: Ann Seehy

Outro erro, se o player atica o PVP GUILD ON, ele não ataca os players da guild. Até ai tudo nos conformes. Mas também não ataca nenhum outro player, independente do PVP LEVEL estar em 0.

 

Mais uma coisa. Se o player está com o PVP GUILD ativado, e PVP LEVEL em 0, além de ele não atacar NENHUM outro player em TARGET somente, ele pega skull se da uma magia de área, entretanto, sem dar dano a nenhum player em volta.

Ajudei ? REP+