View difference between Paste ID: eWeXhrGT and YeXU0jzB
SHOW: | | - or go back to the newest paste.
1
-- http://emudevs.com/showthread.php/394-Draw-a-geometrical-form
2
local UNIT_FIELD_FLAGS = 0x0006 + 0x0035 -- Size: 1, Type: INT, Flags: PUBLIC
3
local UNIT_FLAG_NOT_SELECTABLE = 0x02000000 -- 26    33554432  cannot select the unit
4
local INVISIBLE_DUMMY = 24417 --invisible man + cannot select the unit
5-
local function test5(event, player, msg, lang, typ)
5+
local BEAM_SPELL = 33535
6-
	if(msg == "test5") then
6+
local DISTANCE = 5
7-
	local BEAM_SPELL = 33535
7+
local DELAY = 5000
8-
	local k = 6; -- Scale
8+
local CORNERS = 5
9-
	local t = 10000 -- Time in ms
9+
10-
	
10+
local function Buffcommand(event, player, msg, Type, lang)
11-
	local p = {};
11+
	if(tonumber(msg)) then
12-
	local pPlayer = {};
12+
        CORNERS = tonumber(msg)
13-
	
13+
        local T = {}
14-
	pPlayer["X"] = player:GetX();
14+
        for i = 0, CORNERS*2-1 do
15-
	pPlayer["Y"] = player:GetY();
15+
            local rads = math.pi*2/CORNERS*i
16-
	pPlayer["Z"] = player:GetZ();
16+
            local X, Y = player:GetRelativePoint(DISTANCE, rads)
17-
	
17+
            local guard = player:SummonGuardian( INVISIBLE_DUMMY, X, Y, player:GetHeight(X, Y), rads, DELAY)
18-
	p[1] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"], pPlayer["Y"]+k, pPlayer["Z"]-1.5,0, t);
18+
            guard:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
19-
	p[2] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*0.95, pPlayer["Y"]+k*0.31, pPlayer["Z"]-1.5,0, t);
19+
            guard:SetRooted(true)
20-
	p[3] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*0.59, pPlayer["Y"]+k*(-0.81), pPlayer["Z"]-1.5,0, t);
20+
            table.insert(T, guard)
21-
	p[5] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*(-0.95), pPlayer["Y"]+k*0.31, pPlayer["Z"]-1.5,0, t);
21+
        end
22-
	p[4] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*(-0.59), pPlayer["Y"]+k*(-0.81), pPlayer["Z"]-1.5,0, t);
22+
        for i = 1, #T/2 do
23-
	p[6] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*0.95, pPlayer["Y"]+k*0.31, pPlayer["Z"]-1.5,0, t);
23+
            T[i]:CastSpell(T[i+1], BEAM_SPELL)
24-
	p[7] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*0.95, pPlayer["Y"]+k*0.31, pPlayer["Z"]-1.5,0, t);
24+
        end
25-
	p[8] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*0.59, pPlayer["Y"]+k*(-0.81), pPlayer["Z"]-1.5,0, t);
25+
        for i = #T/2+1, #T-2 do
26-
	p[9] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*0.59, pPlayer["Y"]+k*(-0.81), pPlayer["Z"]-1.5,0, t);
26+
            T[i]:CastSpell(T[i+2], BEAM_SPELL)
27-
	p[10] = player:SummonGuardian( INVISIBLE_DUMMY, pPlayer["X"]+k*(-0.59), pPlayer["Y"]+k*(-0.81), pPlayer["Z"]-1.5,0, t);
27+
        end
28-
	
28+
        T[#T-1]:CastSpell(T[1], BEAM_SPELL)
29-
	for i = 1,10 do
29+
        T[#T]:CastSpell(T[2], BEAM_SPELL)
30-
	p[i]:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
30+
        return false
31-
	p[i]:SetRooted(true);
31+
32-
		if(i <= 5) then
32+
33-
			if(i == 5) then
33+
RegisterServerHook(18, Buffcommand)