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
--Helper Variables
local click_users = {}
local commands = {
CT = {"Don't do that!", "Don't break your cuffs!", "Return to your cell!", "Follow me!", "Halt!", "Last warning!", "Drop everything!", "Go there!", "Go scan!"},
T = {"Sorry!", "I need health.", "I don't need to go there.", "I don't have anything", "I'm not your prisoner!", "I'm not armed!", "Please open this!", "Please stop shooting!", "Please let me have freetime!"},
CT_Title = "CT Commands",
T_Title = "T Commands"
}
local Menu_CTCommands = commands.CT_Title .. "," .. table.concat(commands.CT, ",")
local Menu_TCommands = commands.T_Title .. "," .. table.concat(commands.T, ",")
--Helper Functions
function IsDoubleUse(id)
if click_users[id] == os.time() then
click_users[id] = nil
return true
end
click_users[id] = os.time()
return false
end
function say(id, message)
local messageColor = "\169255220000"
local nameColor = player(id,"team") == 1 and "\169255025000" or player(id,"team") == 2 and "\169050150255" or messageColor
local name = nameColor .. player(id, "name") .. messageColor .. (player(id,"health") == 0 and " *DEAD*" or "")
local message = messageColor .. message
msg(name .. ": " .. message)
end
--Init Hooks
addhook('menu', 'hook_Menu')
addhook('use', 'hook_Use')
--Hook Callbacks
function hook_Use(id, event)
if event == 0 and IsDoubleUse(id) and player(id, 'health') > 0 then
if player(id, 'team') > 1 then
menu(id, Menu_CTCommands)
else
menu(id, Menu_TCommands)
end
end
end
function hook_Menu(id, title, button)
if title == commands.CT_Title then
say(id, commands.CT[button])
elseif title == commands.T_Title then
say(id, commands.T[button])
end
end