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
addhook("say", "position_say")
--Admin Usgn Id List--
admins = {}
admins[15345] = true
--keep listing the admins in this pattern
--String.Split - splits a string into a table based on spaces or other delimiters.
function string.split(t, b)
local cmd = {}
local match = "[^%s]+"
if b then
match = "%w+"
end
if type(b) == "string" then match = "[^"..b.."]+" end
if not t then return invalid() end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
--Resolves USGN to the current game's Player IDs, if not found, returns nil
function resolve_usgn(usgn)
if usgn < 1 then return end
for i=1,32 do
if player(i, 'usgn') == usgn then return i
end
end
end
--Finds the location of the player at id and msg2's it to the player at orig
function get_position(id, orig)
if id < 1 then return end
local msg = "sv_msg2 %s The player is at %s %s in pixels and %s %s in tiles"
parse(msg:format(orig, player(id, 'x'), player(id, 'y'), player(id, 'tilex'), player(id, 'tiley')))
end
--Broadcasts the position of the other_player to all of the admins
function broadcast_admins(other_player)
for admin in pairs(admins) do
local id = resolve_usgn(admin)
if id then get_position(other_player, id) end
end
end
--Say hook
function position_say(id, text)
if not admins[player(id, 'usgn')] then return end
local cmd = text:split()
if cmd[1] == "!position" then
local _id_ = tonumber(cmd[2])
if not _id_ then return end
broadcast_admins(_id_)
return 1
end
end
1
2
3
4
5
6
addhook("spray","spraytxty")
function spraytxty(id)
parse("sv_msg ©017213149 "..player(id,"name").." put a spray at "..player(id,"tilex").." "..player(id,"tiley").." !")
end