Page 1 of 1

Name Searching Switch

PostPosted: Sun Mar 05, 06 7:11 pm
by Allan
Ok, i've decided to move into the exiting world of stuff involving the PlayerReplicationInfo (For those who dont know, it controlles scoreboard, Name, ID number, anything to do with MP practically :) ), and i decided to make a switch only allowing those who have their name on the list to enter.

However, i have come across a problem. The code has a list of players in, but i can't get the code to check the list of players, so only the ones entered manually in the code can enter(Just me). I want it so the button reads the whole list of people, and if it finds the person who pushes it's name on the list, opens the door or whatever it's event is. But in the codes current state, it cannot accept the list where it needs to go, and i have no idea how to fix it. Any help here, Top Notch Editing Specialists?

(Oh, here's the code :P )
Code: Select all
//===================
// NameTestSwitch.
//===================
class NameTestSwitch expands Switch2;

Var(Names) String PlayerList[32];

function Frob(Actor Frobber, Inventory frobWith)
{
      local DeusExPlayer Player;
Player = DeusExPlayer(Frobber); 
If(Player.PlayerReplicationInfo.PlayerName=="Allan")
{
   Super.Frob(Frobber, frobWith);
}
}

Re: Name Searching Switch

PostPosted: Sun Mar 05, 06 7:53 pm
by MainMan
Code: Select all
//===================
// NameTestSwitch.
//===================
class NameTestSwitch expands Switch2;

Var(Names) String PL[32];

function Frob(Actor Frobber, Inventory frobWith)
{
      local DeusExPlayer Player;
      local int i;

      Player = DeusExPlayer(Frobber);

      for (i=0; i<32; i++)
      {
           If(Player.PlayerReplicationInfo.PlayerName==PL[i])
           {
                Super.Frob(Frobber, frobWith);
           }
      }
}

defaultproperties
{
     PL(0)="MainMan"
     PL(1)="Allan"
     PL(2)=
     PL(3)=
     PL(4)=
     PL(5)=
}


I don't know if this will work, I just thought it off the top of my head.

PostPosted: Sun Mar 05, 06 9:06 pm
by Allan
Well, thank the top of your head, it works like a charm :)

PostPosted: Sun Mar 05, 06 9:50 pm
by MainMan
Lol no problem Allan, happy to help 8)

PostPosted: Mon Mar 06, 06 6:30 pm
by ~ô¿ô~Nobody~
the code itself will work but it would screw up in the case that the name is in the list 2 times
so i'd suggest a action-after-check

Code: Select all
//===================
// NameTestSwitch.
//===================
class NameTestSwitch expands Switch2;

Var(Names) String PL[32];

function Frob(Actor Frobber, Inventory frobWith)
{
      local DeusExPlayer Player;
      local int i;
      local bool bFound;

      Player = DeusExPlayer(Frobber);

      for (i=0; i<32; i++)
      {
           If(Player.PlayerReplicationInfo.PlayerName==PL[i])
           {
                bFound=true;
           }
      }
      if(bFound)
        Super.Frob(Frobber, frobWith);
}

defaultproperties
{
     PL(1)="Nobody"
     PL(1)="MainMan"
     PL(2)="Allan"
     PL(3)=
     PL(4)=
     PL(5)=
}

PostPosted: Mon Mar 06, 06 6:32 pm
by MainMan
Always the perfectionist :P

PostPosted: Mon Mar 06, 06 8:11 pm
by Allan
Better a perfectionist than an idiot (Not that i'm calling anyone an idiot).

TY Main & Nobody :P (I see you keep adding your names to the Default properties list, i suppose you want the access from it, as you made it :P, PM me your main used names in game, and i'll add you to the list :) )

PostPosted: Mon Mar 06, 06 8:38 pm
by Spiderbot01
Spiderbot01... :P (Well I did make a map for his mods to be hostified soon) (And hes a buddy of mine) (And hes cool) (And he made the all time most splendiforous map ever) (I am reffering to, of course, evillab).

PostPosted: Mon Mar 06, 06 8:43 pm
by Wasted
Sheesh, Ill pm u mine l8er dont worry.. :)

P.S. WHat is some aliases :s