Forum
CS2D General Ban IP+USGN+SteamBan IP+USGN+Steam
5 replies 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
adminlist = {956} addhook("say","banplayer") function banplayer(id,txt) for i=1,#adminlist do if player(id,"usgn") == adminlist[i] then if txt:lower():sub(1, 4) == "!ban" then local PlayerBan = tonumber(txt:sub(6)) if player(PlayerBan, "exists") then parse("banip " .. PlayerBan) parse("banusgn " .. PlayerBan) parse("bansteam " .. PlayerBan) parse("banname " .. PlayerBan) return 1 end end end end end
adminlisttable as local. Some administration scripts use global tables with similar names and that might cause conflicts with each other.
j0kER aR has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
adminlist = {956} addhook("say","banplayer") function banplayer(id,txt) for i=1,#adminlist do if player(id,"usgn") == adminlist[i] then if txt:lower():sub(1, 4) == "!ban" then local PlayerBan = tonumber(txt:sub(6)) if player(PlayerBan, "exists") then parse("banip " .. PlayerBan) parse("banusgn " .. PlayerBan) parse("bansteam " .. PlayerBan) parse("banname " .. PlayerBan) return 1 end end end end end
This is incorrect. banip bans the IP, banusgn bans the USGN ID, and so on; not the player's ID.
Reference
http://cs2d.com/help.php?cat=all&cmd=banip#cmd
http://cs2d.com/help.php?cat=all&cmd=banname#cmd
http://cs2d.com/help.php?cat=all&cmd=bansteam#cmd
http://cs2d.com/help.php?cat=all&cmd=banusgn#cmd
Here's the corrected code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
local adminlist = {956} function banplayer(id, txt) 	for i=1, #adminlist do 	if player(id, "usgn") == adminlist[i] then 	if txt:lower():sub(1, 4) == "!ban" then 		local PlayerBan = tonumber(txt:sub(6)) 		if player(PlayerBan, "exists") then 			PlayerBanIP = player(PlayerBan, "ip") 			PlayerBanUSGN = player(PlayerBan, "usgn") 			PlayerBanName = player(PlayerBan, "name") 			PlayerBanSteam = player(PlayerBan, "steamid") 			parse('banip ' .. PlayerBanIP) 			parse('banusgn ' .. PlayerBanUSGN) 			parse('banname ' .. PlayerBanName) 			parse('bansteam ' .. PlayerBanSteam) 			return 1 		end 	end end
edited 1×, last 02.04.18 02:14:45 am
1