Forum

> > CS2D > General > Ban IP+USGN+Steam
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Ban IP+USGN+Steam

5 replies
To the start Previous 1 Next To the start

old Re: Ban IP+USGN+Steam

jerezinho
User Off Offline

Quote
1
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

old Re: Ban IP+USGN+Steam

Quattro
GAME BANNED Off Offline

Quote
Wait, if you can ban steam... You can add a lua command to kick player who has no steam name? Is this correct?

old Re: Ban IP+USGN+Steam

GeoB99
Moderator Off Offline

Quote
@user jerezinho: Always declare your
adminlist
table as local. Some administration scripts use global tables with similar names and that might cause conflicts with each other.

old Re: Ban IP+USGN+Steam

Nekomata
User Off Offline

Quote
user jerezinho has written
1
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
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
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview