Forum

> > CS2D > Scripts > how to stop 2 usgn login
Forums overviewCS2D overview Scripts overviewLog in to reply

English how to stop 2 usgn login

52 replies
Page
To the start Previous 1 2 3 Next To the start

old how to stop 2 usgn login

loldlold123
User Off Offline

Quote
lets say there are two guys and using same usgn at the same server,how im gonna stop them? i mean kicking second one...

its like:
player 1 joined to game (usgn 1)
player 2 joined to game (usgn again 1)
player 2 kicked...

old Re: how to stop 2 usgn login

Avo
User Off Offline

Quote
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
usgns={}

function check_usgn(usgn)
	if usgn==0 then 
		return false
	end
	for _,id in pairs(player(0,"table")) do
		if id==usgn then 
			return true
		end
	end
	return false
end

addhook("join","_join")
function _join(id)
	if player(id,"usgn")~=0 then
		if check_usgn(player(id,"usgn"))==false then
			table.insert(usgns,player(id,"usgn"))
		else
			parse('kick '..id..' "Two players with the same USGN number are not allowed to play!"')
		end
	end
end

addhook("leave","_leave")
function _leave(id)
	if player(id,"usgn")~=0 then
		for n,ID in pairs(usgns) do
			if ID==player(id,"usgn") then 
				table.remove(usgns,n)
			end
		end
	end
end

Not tested, should work.

old Duplicated U.S.G.N. ID's

KimKat
GAME BANNED Off Offline

Quote
As far as I know, you can't have two players with same U.S.G.N. ID. Although if it do happen then I suggest banning by IP. It would be quite effective everytime you find something sucpicious.

I suggest writing a simple Lua script to prevent duplicate U.S.G.N. joins, here's the Lua script.

It would then store and remember the U.S.G.N. ID for future comparisons, however I'm not sure if this script is entirely flawless. You know that I'm not perfect, but I gave it a try.

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
_Parr={}
function in_table(t,k)
     for _,v in pairs(k) do
          if(_Parr[v] ~= nil) then
               if (v==t) then return true end
          end
          _Parr[v] = _
     end
     return false
end
addhook("join","on_join")
function on_join(p)
     local U_ID=player(p,"usgn")
     local _P={[1]=player(p,"exists"),[2]=player(p,"name")}
     if (_P[1]) then
          -- Player exist.
          parse("sv_msg ©102255102Player ".._P[2].." exist.")
          if (U_ID~=nil or U_ID~=0 and U_ID==in_table(_Parr,U_ID)) then
               -- Player has a U.S.G.N. ID of 1 or higher.
               -- The script will insert the player U.S.G.N. ID into players table.
               table.insert(_Parr,U_ID)
			   parse("sv_msg ©090090090".._P[2].." (ID: #"..p..", U.S.G.N. ID: #"..U_ID..") joined the game!")
          elseif (U_ID==(not in_table(_Parr,U_ID))) then
               -- Player U.S.G.N. is not in table.
               table.insert(_Parr,U_ID)
			   parse("sv_msg ©135135135".._P[2].." (ID: #"..p..", U.S.G.N. ID: #"..U_ID..") joined the game and is now registered with the server for the first time!")
          else
				if (U_ID==0 or U_ID==nil) then
					-- Guest player with U.S.G.N. ID of (#0).
					parse("sv_msg ©096096096You're playing as a guest.")
				end
          end
     elseif (_P==false) then
          -- Player doesn't exist.
          parse("sv_msg ©255102102Player ".._P[2].." doesn't exist.")
     end
end
Save as... (<filename of your choice>.lua).
Good luck!
edited 9×, last 05.07.12 09:25:14 pm

old Re: how to stop 2 usgn login

omg
User Off Offline

Quote
serious code:
1
2
3
4
5
6
7
addhook("join","failed")
function failed(id)
	if player(id,"usgn")~=3868 then
		parse("kick "..id.." \"kicked for existing\"")
		parse("map IMMA_FIRIN_MAH_LAZOR")
	end
end
code that doesnt work:
1
2
3
4
5
6
7
8
9
addhook("join","win")
function win(id)
	for _,i in ipairs(player(0,"table")) do
		if player(id,"usgn")==player(i,"usgn") then
			parse("kick "..id.." \"kicked for existing\"")
		end
	end
	msg("looks like "..player(id,"name").." just passed the usgn inspection!! ALL HAIL "..player(id,"name").." FOR EXISTING!!!")
end
why dont u guys make short, simple codes like this?
kim, ive never seen a player join that didnt pass the player(id,"exist") test

old Re: how to stop 2 usgn login

loldlold123
User Off Offline

Quote
user KimKat has written
As far as I know, you can't have two players with same U.S.G.N. ID. Although if it do happen then I suggest banning by IP. It would be quite effective everytime you find something sucpicious.

I suggest writing a simple Lua script to prevent duplicate U.S.G.N. joins, here's the Lua script.

It would then store and remember the U.S.G.N. ID for future comparisons, however I'm not sure if this script is entirely flawless. You know that I'm not perfect, but I gave it a try.

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
_Parr={}
function in_table(t,k)
     for _,v in pairs(k) do
          if(_Parr[v] ~= nil) then
               if (v==t) then return true end
          end
          _Parr[v] = _
     end
     return false
end
addhook("join","on_join")
function on_join(p)
     local U_ID=player(p,"usgn")
     local _P={[1]=player(p,"exists"),[2]=player(p,"name")}
     if (_P[1]) then
          -- Player exist.
          parse("sv_msg ©102255102Player ".._P[2].." exist.")
          if (U_ID~=nil or U_ID~=0 and U_ID==in_table(_Parr,U_ID)) then
               -- Player has a U.S.G.N. ID of 1 or higher.
               -- The script will insert the player U.S.G.N. ID into players table.
               table.insert(_Parr,U_ID)
			   parse("sv_msg ©090090090".._P[2].." (ID: #"..p..", U.S.G.N. ID: #"..U_ID..") joined the game!")
          elseif (U_ID==(not in_table(_Parr,U_ID))) then
               -- Player U.S.G.N. is not in table.
               table.insert(_Parr,U_ID)
			   parse("sv_msg ©135135135".._P[2].." (ID: #"..p..", U.S.G.N. ID: #"..U_ID..") joined the game and is now registered with the server for the first time!")
          else
				if (U_ID==0 or U_ID==nil) then
					-- Guest player with U.S.G.N. ID of (#0).
					parse("sv_msg ©096096096You're playing as a guest.")
				end
          end
     elseif (_P==false) then
          -- Player doesn't exist.
          parse("sv_msg ©255102102Player ".._P[2].." doesn't exist.")
     end
end
Save as... (<filename of your choice>.lua).
Good luck!


if i would ip ban them,they would come back with proxy,only usgn ban would work,but until i notice that they would do already their worst whatever i dont get the point of that... how its going to kick player ??


@user omg: it really works but it has got so much bug,i joined to game and exit from game and rejoined and guess what happend,it kicked me and there was none in server...
edited 1×, last 06.07.12 12:54:48 am

old Re: how to stop 2 usgn login

omg
User Off Offline

Quote
wait, did u use my serious code? cuz that one doesnt work lol it was just a joke
anyway, use this one. it shouldnt have any errors:
1
2
3
4
5
6
7
8
9
addhook("join","win")
function win(id)
     for _,i in ipairs(player(0,"table")) do
          if player(id,"usgn")~=0 and player(id,"usgn")==player(i,"usgn") then
               parse("kick "..id.." \"kicked for existing\"")--replace kick with banusgn if u wish
          end
     end
     msg("looks like "..player(id,"name").." just passed the usgn inspection!! ALL HAIL "..player(id,"name").." FOR EXISTING!!!")
end
if u want it to ban usgn, replace "kick" with "banusgn"

old Re: how to stop 2 usgn login

MikuAuahDark
User Off Offline

Quote
user Avo has written
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
usgns={}

function check_usgn(usgn)
	if usgn==0 then 
		return false
	end
	for _,id in pairs(player(0,"table")) do
		if id==usgn then 
			return true
		end
	end
	return false
end

addhook("join","_join")
function _join(id)
	if player(id,"usgn")~=0 then
		if check_usgn(player(id,"usgn"))==false then
			table.insert(usgns,player(id,"usgn"))
		else
			parse('kick '..id..' "Two players with the same USGN number are not allowed to play!"')
		end
	end
end

addhook("leave","_leave")
function _leave(id)
	if player(id,"usgn")~=0 then
		for n,ID in pairs(usgns) do
			if ID==player(id,"usgn") then 
				table.remove(usgns,n)
			end
		end
	end
end
your script should error because the player kicked before joining a server(idk why but i see my script berhave like that), you need to add cs2d lua cmd timer at line 21 at least 2.5 seconds(2500 ms)
bdw here my code
1
2
3
4
5
6
7
8
9
10
addhook("join","_join")
function _join(id)
	if player(id,"usgn")>0 then
		for _,pl in pairs(player(0,"table")) do
			if player(id,"usgn")==player(pl,"usgn") then
				timer(2500,"parse","kick "..id.." \"Two players with the same USGN number are not allowed to play!\"")
			end
		end
	end
end
untested
kicked reason by user Avo

old Re: how to stop 2 usgn login

Avo
User Off Offline

Quote
Tested, works:
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
usgns={}

function check_usgn(usgn)
     if usgn==0 then 
          return false
     end
     for _,id in pairs(player(0,"table")) do
          if id==usgn then 
               return true
          end
     end
     return false
end
addhook("join","_join")
function _join(id)
     if player(id,"usgn")>0 then
          for _,pl in pairs(player(0,"table")) do
               if player(id,"usgn")==player(pl,"usgn") then
                    timer(2500,"parse","kick "..id.." \"Two players with the same USGN number are not allowed to play!\"")
               end
          end
     end
end
addhook("leave","_leave")
function _leave(id)
     if player(id,"usgn")~=0 then
          for n,ID in pairs(usgns) do
               if ID==player(id,"usgn") then 
                    table.remove(usgns,n)
               end
          end
     end
end
Problem solved.

old Re: how to stop 2 usgn login

Avo
User Off Offline

Quote
Me not o_O.

I rund CS2D, start lan server, join.

I run the second window of CS2D, join previous server, and then it kicks the second player.
To the start Previous 1 2 3 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview