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
--Script by Ranw--
commands = {}
permit = 0
addhook("say","ranwsay", 999)
addhook("sayteam","ranwsay", 999)
white = "\169255255255"
red = "\169255000000"
green = "\169000255000"
function errranw(id, txt)
if id == 0 then
msg("" .. red .. "[Error]:" .. white .. " "..txt)
else
msg2(id, "" .. red .. "[Error]:" .. white .. " "..txt)
end
end
function sucranw(id, txt)
if id == 0 then
msg("" .. green .. "[Success]:" .. white .. " "..txt)
else
msg2(id, "" .. green .. "[Success]:" .. white .. " "..txt)
end
end
function ranwcheck(id, txt)
local cmd = txt:match("^([!][%w]+)[%s]?")
if not cmd then return end
cmd = string.lower(cmd)
local sc = shortcuts[cmd]
if sc ~= nil then cmd = sc end
local aftercmd = txt:match("[%s](.*)")
ranwprocess(id, cmd, aftercmd)
return 1
end
function ranwprocess(id, cmd, txt)
local arguments = {}
if txt ~= nil then
txt = escapeString(txt)
for word in txt:gmatch("[^%s]+") do
table.insert(arguments, word)
end
end
local ret
if #arguments > 0 then
ret = commands[cmd].func(id, arguments)
else
ret = commands[cmd].func(id)
end
if ret ~= nil then
if ret == false then
errranw(id, "Something went wrong")
else
errranw(id, ret)
end
return
end
end
function ranwsay(id, txt)
	local ret = ranwcheck(id, txt)
	if ret == 1 then
	return 1
end
end
shortcuts = {
["!rs"] = "!resetscore",
}
commands["!resetscore"] = {
arguments = 0,
func = function(id, arguments)
if player(id,'deaths') > 0 or player(id,'score') > 0 or player(id,'assists') > 0 or player(id,'mvp') > 0 then
parse("setscore " .. id .. " 0")
parse("setdeaths " .. id .. " 0")
parse("setassists " .. id .. " 0")
parse("setmvp " .. id .. " 0")
sucranw(id,'Scores reset.')
else
errranw(id,'No need to reset your score.')
end
return
end
}