1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Initialize
init_mod("sv")
sv.var("prefix","Server echoed: ", "svar")
sv.broadcasttime = initArray(32)
--Act - Command "!echo"
function act_nextmap(p, typ, cmd)
	msg(string.format("nextmap: %s", game("nextmap")))
end
function act_broadcast(p, typ, cmd)
	if os.time() > sv.broadcasttime[p] then
		msg(Color(100, 255, 0), string.format("%s(BROADCAST): %s", player(p, "name"), cmd))
		msg2(p, Color(255, 100, 0),"You have a 60 second cool off period before the next broadcast")
		sv.broadcasttime[p] = os.time() + 60
	else
		msg2(p, Color(255, 100, 0), string.format("You may not make another broadcast for %s more seconds", sv.broadcasttime[p] - os.time()))
	end
end
function adm_echo_admin(p, typ, cmd)
	msg(Color(255, 0, 0), sv.prefix..cmd)
end
function adm_say_admin(p, typ, cmd)
	msg("?032178170"..player(p, "name") .. "(ADMIN): "..cmd)
end
function adm_sayto_admin(p, typ, cmd)
	cmd = toTable(cmd)
	local i = tonumber(cmd[1])
	local _msg = cmd[2]
	if not player(i, "exists") then return invalid(p, typ) end
	if not msg then return invalid() end
	msg2(i, Color(255, 100, 0), string.format("%s (PRIVATE): %s", player(i, "name"), _msg))
end
--Admin - Command "@echo_prefix"
function adm_echoprefix_admin(p, typ, cmd)
	sv.setvar("prefix", cmd, true)
end
function adm_guns_admin(p, typ, cmd)
	cmd = toTable(cmd)
	local ID = tonumber(cmd[1])
	local gunid = trim(tostring(cmd[2]))
	if tonumber(cmd[2]) then gunid = wpn.name[tonumber(cmd[2])] end
	if not gunid then return invalid(p, typ) end
	if not ID then
		ID = p
		gunid = trim(tostring(cmd[1]))
	end
	if not wpn.id[gunid] then return invalid(p, typ, "Wrong Weapon") end
	equip(ID, wpn.id[gunid], true)
end
function adm_teleport_admin(p, typ, cmd)
	cmd = toTable(cmd)
	local i = cmd[1]
	local x = cmd[2]
	local y = cmd[3]
	if not y then return invalid(p, typ) end
	if not player(i, "exists") then return invalid(p, typ, "Invalid Player") end
	parse(string.format("setpos %s %s %s", i, x, y))
end
function adm_teletile_admin(p, typ, cmd)
	cmd = toTable(cmd)
	local i = cmd[1]
	local x = cmd[2]
	local y = cmd[3]
	if not y then return invalid(p, typ) end
	if not player(i, "exists") then return invalid(p, typ, "Invalid Player") end
	parse(string.format("setpos %s %s %s", i, x*32, y*32))
end
function adm_getpos_admin(p, typ, cmd)
	local i = tonumber(cmd)
	if not i then i = p end
	if not player(i, "exists") then return invalid(p, typ) end
	msg2(p, Color(255, 100, 0), string.format("%s is located at (%s, %s)", player(i, "name"), math.ceil(player(i, "x")), math.ceil(player(i, "y"))))
end
function adm_gettile_admin(p, typ, cmd)
	local i = tonumber(cmd)
	if not i then i = p end
	if not player(i, "exists") then return invalid(p, typ) end
	msg2(p, Color(255, 100, 0), string.format("%s is located at (%s, %s)", player(i, "name"), player(i, "tilex"), player(i, "tiley")))
end
function adm_getid_admin(p, cmd)
cmd = trim(cmd)
local names = {}
for i =1, 32, 1 do
if player(i, "exists") then
names[player(i, "name")] = i
end
end
if names[cmd] then msg2(p, "Player "..cmd.." is at ID: "..names[cmd]) end
return 2
end