Hello there.
I want some lua script codes , that is !report command
which can report every detail about the target player who is reported.
Example :
!report <Target> <Information>
When player A use !report to player B then player B is reported
After reported then write a .txt file in sys/lua/report
Name of any files are report1 , report2 , 3 , 4 , etc.
In .txt file recorded this detail about player B
1
2
3
4
5
6
7
8
9
report99.txt - Notepad :ugly:
Name : player B
USGN : 0
Information : He is using speedhack.
Date : 99.99.9999 <<If possible , make this please
Report by : player A <<If possible , make this please
USGN : 00 <<If possible , make this please
I have no idea about how to make this hell possible , help me please
Thank you in advance and sorry for my bad English
and sorry for wrong section Admin/mod comment
As you pointed out yourself, wrong section. Moved. 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
if not kr then kr = {} end
function totable(t,match)
local cmd = {}
if not match then
match = "[^%s]+"
else
match = "[^"..match.."]+"
end
for word in string.gmatch(t,match) do
table.insert(cmd,word)
end
return cmd
end
function kr.f_exists(file)
	f = io.open(file)
	if (f) then
		f:close()
		return true
	end
	return false
end
addhook("say","kr.say")
function kr.say(id,txt)
	txt = totable(txt)
	local info = ""
	if(txt[1] == "!report") then
		if(txt[2]) then
			txt[2] = tonumber(txt[2])
			if(player(txt[2],"exists")) then
				if(txt[2] ~= id) then
					for i,v in ipairs(txt) do
						if(i > 2) then
							info = info.." "..v
						end
					end
				else
					msg2(id,"©255000000You can't report yourself!")
					return 1
				end
				if(info) then
					local fn = 1
					while true do
						if not(kr.f_exists("sys/lua/report/report"..fn..".txt")) then
							break
						end
						fn = fn+1
					end
					f = io.open("sys/lua/report/report"..fn..".txt","w+")
					if(f) then
						f:write("Name : "..player(txt[2],"name").."\nUsgn : "..player(txt[2],"usgn").."\nInformation : "..info.."\nDate : "..os.date("%x - %H:%M:%S").."\n\nReported by : "..player(id,"name").."\nUsgn : "..player(id,"usgn"))
						f:close()
						msg2(id,"©000255000Your report has been sent!")
						return 1
					else
						print("Attempt to open the report file failed")
					end
				else
					return 1
				end
			else
				msg2(id,"Player does not exist!")
				return 1
			end
		end
	end
end
It's work , Thank you Kirby7