Reserving playernames?

Technical issues discussion about your computer and Deus Ex games.

Moderator: Forum Guards

Reserving playernames?

Postby Shinobi » Mon Jul 25, 11 11:57 am

Is it possible to create something to disallow certain playernames? i.e. reserve a playername to an ip range or domain name?
So we beat on, boats against the current, borne back ceaselessly into the past.
User avatar
Shinobi
Master
 
Posts: 1503
Joined: Tue Jul 10, 07 12:10 pm
Location: Wales

Postby Aidan » Tue Jul 26, 11 12:50 am

I'm pretty sure this has already been invented.

Check the download archives.
Psychokiller, spelled incorrectly.
User avatar
Aidan
CandyMan
 
Posts: 6270
Joined: Wed Aug 02, 06 8:57 am
Location: True North Strong & Free

Postby Shinobi » Thu Jul 28, 11 12:50 am

Okay thanks. *looks*
So we beat on, boats against the current, borne back ceaselessly into the past.
User avatar
Shinobi
Master
 
Posts: 1503
Joined: Tue Jul 10, 07 12:10 pm
Location: Wales

Postby Dae » Thu Jul 28, 11 10:25 am

I also think I've seen this feature, but I don't remember what mutator implements it.
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby ~DJ~ » Thu Jul 28, 11 12:32 pm

I thought of having a quick go.. haven't tested this but something like this should do the trick..
Code: Select all
class NameChecker extends Mutator;

var() config string NameToCheck;
var() config string IPToCheck;
var PlayerPawn Player;

function PreBeginPlay()
{
    Level.Game.BaseMutator.AddMutator(Self);

    Super.PreBeginPlay();
    SetTimer(0.1);
}

function Timer()
{
local string IP;


if(DeusExPlayer(Player).PlayerReplicationInfo.PlayerName~=NameToCheck))
      {


      IP = DeusExPlayer(Player).GetPlayerNetworkAddress();
      IP = Left(IP, InStr(IP, ":"));

      Log(Player.PlayerReplicationInfo.PlayerName$"("$IP$") Found.");

         if(IP!=IPToCheck)
         {
            Player.ClientMessage("You're not allowed to use this name");
            //Player.ConsoleCommand("debug gpf");
            //-- Perhaps even rename?
            Player.ConsoleCommand("setname IM-STOPEED");
         }
         else if(IP==IPToCheck)
         {
            Player.ClientMessage("Welcome, "$NameToCheck$);
         }
      }

      Super.Timer();
}

defaultproperties
{
    NameToCheck="Shinobi"
    IPToCheck="127.0.0.1"
}


It's untested..

Can't say it would work definitely.. but I see nothing wrong, Tommorow I'll test it just incase.
Last edited by ~DJ~ on Thu Jul 28, 11 12:33 pm, edited 2 times in total.
User avatar
~DJ~
Forum Super Hero
 
Posts: 3766
Joined: Tue May 22, 07 12:23 pm

Postby Shinobi » Thu Jul 28, 11 1:19 pm

Can you make it so it can check against a domain (i have dynamic ip) eg: shinobidx87@servebeer.com

would that work? I could try the one above now, i'll let u know if u dont test it before me
So we beat on, boats against the current, borne back ceaselessly into the past.
User avatar
Shinobi
Master
 
Posts: 1503
Joined: Tue Jul 10, 07 12:10 pm
Location: Wales

Postby Alex » Thu Jul 28, 11 1:39 pm

~DJ~ wrote:I thought of having a quick go.. haven't tested this but something like this should do the trick..
Code: Select all
class NameChecker extends Mutator;


It's untested..

Can't say it would work definitely.. but I see nothing wrong, Tommorow I'll test it just incase.

Don't you think that will totally spam the serverlog & player ever 0.1 second? =/ It doesn't remember if it checked a player or not. Thus if someone enters with a name in the list, and he HAS the correct IP address, it keeps saying "WELCOME!" x10 per second.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Dae » Thu Jul 28, 11 2:01 pm

~DJ~ wrote:I thought of having a quick go.. haven't tested this but something like this should do the trick..

It's a better idea to use a function such as ModifyPlayer which is called every time player respawns, instead of Timer().
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby ~DJ~ » Thu Jul 28, 11 4:24 pm

Ooh.. yeah.. dint thought about that...thanks Alex for pointing out. :oops:

I actually edited one of the stuff I did for IP stuff.

Thanks for the ModifyPlayer thingie, Dae; Although I was just pointing out a basic idea anyhow, something like that doing the trick. :oops:

Shinobi wrote:Can you make it so it can check against a domain (i have dynamic ip) eg: shinobidx87@servebeer.com


Well.. that's the problem. This IP stuff isn't generally used because of people having dynamic IPs. I'm not sure but I suppose it's not possible..

Are IPs THAT THAT dynamic? I thought only the last digits change.. last I checked it's possible to add a wildcard in an IP ban manually on the DeusEx.ini.. wonder if that would be possible on checking IP.. Not sure how would I get a wildcard on a string though. :o
User avatar
~DJ~
Forum Super Hero
 
Posts: 3766
Joined: Tue May 22, 07 12:23 pm

Postby Alex » Thu Jul 28, 11 4:42 pm

~DJ~ wrote:Are IPs THAT THAT dynamic? I thought only the last digits change.. last I checked it's possible to add a wildcard in an IP ban manually on the DeusEx.ini.. wonder if that would be possible on checking IP.. Not sure how would I get a wildcard on a string though. :o

Just read the code that checks if a joining player is banned or not:
Code: Select all
function bool CheckIPPolicy(string Address)
{
   local int i, j, LastMatchingPolicy;
   local string Policy, Mask;
   local bool bAcceptAddress, bAcceptPolicy;
   
   // strip port number
   j = InStr(Address, ":");
   if(j != -1)
      Address = Left(Address, j);

   bAcceptAddress = True;
   for(i=0; i<50 && IPPolicies[i] != ""; i++)
   {
      j = InStr(IPPolicies[i], ",");
      if(j==-1)
         continue;
      Policy = Left(IPPolicies[i], j);
      Mask = Mid(IPPolicies[i], j+1);
      if(Policy ~= "ACCEPT")
         bAcceptPolicy = True;
      else
      if(Policy ~= "DENY")
         bAcceptPolicy = False;
      else
         continue;

      j = InStr(Mask, "*");
      if(j != -1)
      {
         if(Left(Mask, j) == Left(Address, j))
         {
            bAcceptAddress = bAcceptPolicy;
            LastMatchingPolicy = i;
         }
      }
      else
      {
         if(Mask == Address)
         {
            bAcceptAddress = bAcceptPolicy;
            LastMatchingPolicy = i;
         }
      }
   }

   if(!bAcceptAddress)
      Log("Denied connection for "$Address$" with IP policy "$IPPolicies[LastMatchingPolicy]);
      
   return bAcceptAddress;
}
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Shinobi » Thu Jul 28, 11 9:17 pm

Does this work?
So we beat on, boats against the current, borne back ceaselessly into the past.
User avatar
Shinobi
Master
 
Posts: 1503
Joined: Tue Jul 10, 07 12:10 pm
Location: Wales


Return to Technical issues

Who is online

Users browsing this forum: No registered users and 12 guests