Új parancs fun serverbe.

Indította Samurai, 2016-05-27, 17:12:54

2016-05-27, 17:12:54 Utolsó szerkesztés: 2016-05-27, 17:42:58 Szerző: Samurai
Sziasztok itt egy új funkció fun szerverekhez:


quest:

quest allahu_akbar begin
state start begin
when 20092.chat."Allahu akbar" begin
say_title("Hello world!")
say("We are ISIS.")
say("ALLAHU AKBAAR")
say_reward("You kill some people?")
local s = select("Yes","No","Cancel")
if s = 1 then
command("allahu_akbar")
notice_all(""..pc.get_name.." kill all people.")
elseif s = 2 then
command("allahu_akbar")
notice_all(""..pc.get_name.." kill all people.")
else
command("allahu_akbar")
notice_all(""..pc.get_name.." kill all people.")
end
end
end
end


cmd.cpp

ACMD(do_allahu_akbar);

    { "allahu_akbar",        do_allahu_akbar,        0,    POS_DEAD,    GM_PLAYER  },


cmd_gm.cpp

struct FuncAllahuakbar
{
    LPCHARACTER m_ch;

    FuncAllahuakbar(LPCHARACTER ch):
        m_ch(ch)
    {}

    void operator()(LPENTITY ent)
    {
        if (ent->IsType(ENTITY_CHARACTER))
        {
            LPCHARACTER ch = (LPCHARACTER) ent;

            if (!ch->IsPC() || m_ch == ch || ch->IsGM() || ch->IsDead() || ch->GetHP() <= 0)
                return;

            float fDist = DISTANCE_APPROX(m_ch->GetX() - ch->GetX(), m_ch->GetY() - ch->GetY());
            if (fDist > 7000.f)
                return;

            int damage = ch->GetHP()+number(1, 4250);
            ch->EffectPacket(SE_CRITICAL);
            ch->PointChange(POINT_HP, -damage, false);
            ch->Dead();
        }
    }
};

ACMD(do_allahu_akbar)
{
    LPSECTREE pSec = ch->GetSectree();
    if (pSec)
    {
        FuncAllahuakbar f(ch);
        pSec->ForEachAround(f);
    }
}
ElsÅ' az elsÅ'k között, Az emberek istent játszanak engedély nélkül.