Announcement

Collapse
No announcement yet.

Get list of players from interaction class...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get list of players from interaction class...

    I want to get a list of all players in a game by pressing a key.

    Ok, so in a typical class, lets say mutator, you can use the following code:
    PHP Code:
    for( Level.ControllerList!= NoneC.nextController ) {
        if( 
    C.IsA('PlayerController') || C.IsA('xBot')) {
            
    LOG("Player: "$C.PlayerReplicationInfo.PlayerName);
        }

    Well from my understanding, this doesn't work in the interactions class, and this is what I've come up with for there:
    PHP Code:
    foreach ViewportOwner.Actor.DynamicActors(class'Pawn'P) {
        
    viewportowner.Actor.Pawn.ClientMessage("Player: "$P.PlayerReplicationInfo.PlayerName);

    Problem is, this only lists players that are in direct line of sight, or behind one wall. If a player is clear across the map in CTF, it does not list them until I get close to them.

    End result, I want a list of all players in the interaction class. I don't know if there's a way to pull in info from another class function or anything. Thanks for any help you can provide.

    #2
    and I know how to simply add a keybind to get a player list....the thing is that I need the list in the interaction because I intend on doing other things to it there.

    Comment


      #3
      Not sure if this is of any help but:
      Level.GRI.PRIArray

      Holds an array of all PRI's in a level (so it does not hold bots..)

      Comment


        #4
        Originally posted by Hsoolien
        Not sure if this is of any help but:
        Level.GRI.PRIArray

        Holds an array of all PRI's in a level (so it does not hold bots..)
        It does include bots.

        Comment


          #5
          I'llbe damned it does... I'm confused now though... cause I have a function based off that that does not work with bots...

          Comment


            #6
            PHP Code:
                          viewportowner.Actor.Pawn.ClientMessage(GRI.PRIArray.Length);
                          for (
            playercount=0;playercount<(GRI.PRIArray.Length);playercount++) {
                                
            viewportowner.Actor.Pawn.ClientMessage(GRI.PRIArray[playercount].playername); 
                          }
            //FOLLOWING CODE WORKS GREAT IF TARGET IS VISIBLE....
            //            foreach ViewportOwner.Actor.DynamicActors(class'Pawn', P) {
            //                 if( len(P.PlayerReplicationInfo.PlayerName) >= 3) {
            //                      viewportowner.Actor.Pawn.ClientMessage("Player: "$P.PlayerReplicationInfo.PlayerName);
            //                }
            //                } 

            The above code simply puts a "0" on the screen for the lenght of the list being 0 items long. What can I do to make it work?

            Comment


              #7
              Use LEVEL.GRI.PRIArray...


              Your missing LEVEL...

              Comment


                #8
                That's the problem, in an interaction class, I cannot start with "Level". If I type Level.anythingunderit I get missing parameter 1 in the simple call for the clientmessage. Any other tips?

                Comment


                  #9
                  OK, THANK YOU SO MUCh for your help, all your tips were dead on, I just needed to tweak. I added this line above it....

                  GRI = viewportowner.Actor.GameReplicationInfo;



                  I already had GRI declared as a var(), but I hadn't set GRI = anything. Never would have gotten it without your help, thanks again guys. It even lists webamin, weird.

                  Comment


                    #10
                    I guess interactions do not automatically set LEVEL.... weird...

                    Comment


                      #11
                      Ok, so I can get a list of every player in the game through the interaction class now. Is it possible to get their locations too or no?

                      Comment

                      Working...
                      X