Page 3 of 20 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 191
  1. #21
    BF4 as far as I know doesn't have working Reserve slots at the moment but I will update when DICE get their finger out.

  2. #22
    It would be nice if this would still work for BF4. Even though the reserve system doesn't work; there's the VIP/Reversed Slots that work for/with other plugins; like a custom message for them when they logon and special recognition. I'd appreciate it if this could just go ahead and do it... so it'll just work when it's enabled on DICE/EA side of things... since we already have those files we can be writing to.

    But, I was curious if there was a way to copy/paste this once it was setup on one of my servers... then to all of my other servers. Without having to manually set each of them up again? Or maybe I should be asking that in the main plugin thread.

  3. #23
    Quote Originally Posted by supermillhouse View Post
    BF4 as far as I know doesn't have working Reserve slots at the moment but I will update when DICE get their finger out.
    Been using reserved slots since R10. It's working.

  4. #24
    Quote Originally Posted by Strikes View Post
    It would be nice if this would still work for BF4. Even though the reserve system doesn't work; there's the VIP/Reversed Slots that work for/with other plugins; like a custom message for them when they logon and special recognition. I'd appreciate it if this could just go ahead and do it... so it'll just work when it's enabled on DICE/EA side of things... since we already have those files we can be writing to.

    But, I was curious if there was a way to copy/paste this once it was setup on one of my servers... then to all of my other servers. Without having to manually set each of them up again? Or maybe I should be asking that in the main plugin thread.
    I was able to figure out how to copy the settings from server to server; that can be disregarded.

    I'm now curious about the Yell - I do believe that's still disabled/not working yet. Does anyone know the text to substitute to get a 'Say' to work?

  5. #25
    At the request of IAF SDS, I've modified supermillhouse's code to handle the case where a clan tag is part of the player's name, rather than a separate item set in Battlelog. I also changed all the file paths from BF3 to BF4 and changed all of the clan tag and friends checking to use the "Res" list. This means that you only have to change the contents of the list to add more friends or clans to ignore, instead of the code. I also changed the yell to a chat message.

    This is a copy of post #1 with my modifications added inline to the code.

    Limit #1 Add to Res

    Set limit to evaluate OnJoin

    Set first_check to this Code:

    Code:
    List<PlayerInfoInterface> players = new List<PlayerInfoInterface>();
    players.AddRange(team1.players);
    players.AddRange(team2.players);
    if (team3.players.Count > 0) players.AddRange(team3.players);
    if (team4.players.Count > 0) players.AddRange(team4.players);
    
    int RSThresh = 5;    //When the player should get a reserve slot, when he has this number of days or more.
    int numoftemps = 6;  //Number of players to be copied to reserve list
    int RSCap = 30;      //Max number of reserve slot days
    int rewarddays = 5;  //Number of days rewarded for helping to start the server once
    
    int totaltcount = server.PlayerCount;
    int i = 0;
    string port = server.Port;
    string host = server.Host;
    string dir = "Plugins\\BF4\\TempList_" +host+ "_" +port+ ".txt";
    string done = "Plugins\\BF4\\Done_" +host+ "_" +port+ ".txt";
    
    List<String> listofplayers = new List<String>();
    
    foreach (PlayerInfoInterface p in players)
      {
      listofplayers.Add(p.Name);
      }
    
    
    //check if server population is more than 4
    if ((totaltcount >= 4) && (totaltcount <=10) && (!File.Exists(done)))return true;
    //if server population is less than 4 then delete temp file if it exists
    else if(totaltcount < 4)
      {
      if (File.Exists(dir)) File.Delete(dir);
      if (File.Exists(done)) File.Delete(done);
      }
    //check if server population is more than 10 then transfer to ReserveList
    else if((totaltcount > 10) && (File.Exists(dir)))
      {
    
      int runcount = 0;
    
      if(File.Exists(dir))
        {
        //read names on temp list
        string namecheck = File.ReadAllText(dir);
        //split names on temp list at ", "
        string[] tempnames = Regex.Split(namecheck, ", ");
        //check each split name and add to reserve slot list
        foreach (string tempname in tempnames)
          {
          //split the name at ":" in to array, 1st is player name, 2nd is date last updated
          string[] tempcont = tempname.Split(':');
          if ((listofplayers.Contains(tempcont[0]) && runcount < numoftemps))
            {runcount++;
            plugin.ConsoleWrite(tempname);
            DateTime now = DateTime.Now;
            string datestring = now.ToString("d");
    
            string dir2 = "Plugins\\BF4\\ReserveList_" +host+ "_" +port+ ".txt";
            if(File.Exists(dir2))
              {
              //read names on reserve list
              string resnamecheck = File.ReadAllText(dir2);
              plugin.ConsoleWrite(resnamecheck);
              //split names on temp list at ", "
              string[] resnames = Regex.Split(resnamecheck, ", ");
              //finds last entry
              string reslastitem = resnames[resnames.Length - 1];
              //check each split name that is in the reserve list and updates if it is in the temp list
              foreach (string resname in resnames)
                {
                //split the reserve name at ":" in to array, 1st is player name, 2nd is the last date participated in seeding, 3rd is the number of days reward if he is on the reserve list, 4th is a date used for expiry
                //the 4th entry is used to subtract 1 digit a day off of the 3rd entry
                string[] rescont = resname.Split(':');
                  //checks if the reserve name equals the player name in temp
                if (rescont[0] == tempcont[0])
                  {
                  //stops multiple rewards per day
                  if(rescont[1] != datestring)
                    {
                    //add on the reward
                    int value = Convert.ToInt32(rescont[2]);
                    value = value + rewarddays;
                    //cap the reserve slot days at RSCap
                    if (value > RSCap) value = RSCap;
                    //save the new data
                    string newlist = resnamecheck.Replace(resname, rescont[0]+":"+ datestring +":"+value.ToString()+":"+rescont[3]);
                    File.WriteAllText(dir2, newlist);
                    //adds player to reserve slot if the have helped enough and are not on it.
                    if (value >= RSThresh)
                      {
                      if (!plugin.GetReservedSlotsList().Contains(rescont[0]))
                        {
                        plugin.ServerCommand("reservedSlotsList.add", rescont[0]);
                        plugin.ServerCommand("reservedSlotsList.save");
                        }
                      //message player
                      plugin.SendPlayerMessage(rescont[0], rescont[0] + ": You have been awarded a reserved slot for helping to start the server, it will expire in approximately "+value+" days unless you help again.");
                      plugin.ConsoleWrite(rescont[0] + ": Notified, " + value + " days to help again");
                      }
                    }
                  //notify you that a player tried to help twice or more on a day to start server 
                  else {plugin.ConsoleWrite(rescont[0] + " helped on the same day with no second reward.");}
                  break;
                  } 
                //if not in reserve list adds player and info to end of list.
                else if (resname == reslastitem)
                  {
                  plugin.ConsoleWrite("New Reward " + tempcont[0]);
                  string newlist = resnamecheck + ", " + tempcont[0] +":" + datestring +":"+ rewarddays +":"+ datestring;
                  File.WriteAllText(dir2, newlist);
                  }
                }
              }
            //if reserve list doesnt exist, creates list with first entry
            else 
              {
              plugin.ConsoleWrite("New Reward File " + tempcont[0]);
              string newlist = "Blank, "+tempcont[0] +":"+ datestring +":"+ rewarddays +":"+ datestring;
              File.WriteAllText(dir2, newlist);
              }
            }
          else if (runcount >= numoftemps)break;
          }
        }
    //deletes temp list after transfer to reserve list
      File.Delete(dir);
      File.WriteAllText(done, "DONE");
      }
    
    return false;
    Set second_check to this Code (this has most of the changes for handling clan tags and the "Res" list):

    Code:
    List<PlayerInfoInterface> players = new List<PlayerInfoInterface>();
    players.AddRange(team1.players);
    players.AddRange(team2.players);
    if (team3.players.Count > 0) players.AddRange(team3.players);
    if (team4.players.Count > 0) players.AddRange(team4.players);
    
    string port = server.Port;
    string host = server.Host;
    
    foreach (PlayerInfoInterface p in players)
      {
      // New tag extraction code by PapaCharlie9
      String tag = p.Tag;
    
        if (String.IsNullOrEmpty(tag) && !p.StatsError) {
            // Maybe they are using [_-=]XXX[=-_]PlayerName[_-=]XXX[=-_] format
            Match tm = Regex.Match(p.Name, @"^[=_\-]*([^=_\-]{2,4})[=_\-]");
            if (tm.Success) {
                tag = tm.Groups[1].Value;
            } else {
                tm = Regex.Match(p.Name, @"[^=_\-][=_\-]([^=_\-]{2,4})[=_\-]*$");
                if (tm.Success) { 
                    tag = tm.Groups[1].Value;
                } else {
                    tag = String.Empty;
                }
            }
        }
    
    //This stops your clan members and any other clan friends in the "Res" list being added to the reward and them possibly later getting removed
    
      if ((!plugin.isInList(p.Name, "Res")) && (!plugin.isInList(tag, "Res")))
        {
        string dir = "Plugins\\BF4\\TempList_" +host+ "_" +port+ ".txt";
        if(File.Exists(dir))
          {
          string namecheck = File.ReadAllText(dir);
    //    plugin.ConsoleWrite(namecheck);
          string[] tempnames = Regex.Split(namecheck, ", ");
          string templastitem = tempnames[tempnames.Length - 1];
          //stops the names being repeatedly entered in to the list every time it runs
          foreach (string tempname in tempnames)
            {
            string[] tempcont = tempname.Split(':');
            if (tempcont[0] == p.Name)
              {
              break;
              }    
            else if (tempname == templastitem)
              {
              //add new player
              plugin.ConsoleWrite("Templist New Player: " + p.FullName);
              DateTime now = DateTime.Now;
              string datestring = now.ToString("d");
              string newlist = namecheck + ", " + p.Name +":" + datestring;
              File.WriteAllText(dir, newlist);
              }
            }
          }
        else
          {
          //create new temp file with player
          plugin.ConsoleWrite("Tempfile New Player: " + p.FullName);
          DateTime now = DateTime.Now;
          string datestring = now.ToString("d");
          string newlist = "Blank, "+p.Name +":"+ datestring;
          File.WriteAllText(dir, newlist);
          }
        }
      }
    return false;

    Limit #2 Remove from Res

    Set limit to evaluate OnIntervalServer, set evaluation_interval to 1800

    Set first_check to this Code:

    Code:
    int RSOffThresh = 0;   //Remove Reserve slot on number of days
    int RSDellThresh = -1; //Remove from Reserve list on number of days
    
    string port = server.Port;
    string host = server.Host;
    string dir = "Plugins\\BF4\\ReserveList_" +host+ "_" +port+ ".txt";
    if(File.Exists(dir))
      {
      string namecheck = File.ReadAllText(dir);
      plugin.ConsoleWrite(namecheck);
      string[] resnames = Regex.Split(namecheck, ", ");
      DateTime now = DateTime.Now;
      string datestring = now.ToString("d");
      foreach (string resname in resnames)
        {
        if (resname != "Blank")
          {
          string[] rescont = resname.Split(':');
          if (rescont[3] != datestring)
            {
            int value = Convert.ToInt32(rescont[2]);
            value--;
            if ((value == RSOffThresh) && (plugin.GetReservedSlotsList().Contains(rescont[0])))
              {
              plugin.ServerCommand("reservedSlotsList.remove", rescont[0]);
              plugin.ServerCommand("reservedSlotsList.save");
              plugin.ConsoleWrite(value.ToString());
              namecheck = namecheck.Replace(resname, rescont[0]+":"+ rescont[1] +":"+value.ToString()+":"+ datestring);
              plugin.ConsoleWrite(namecheck);
              File.WriteAllText(dir, namecheck);
              }
            else if(value <= RSDellThresh)
              {
              plugin.ConsoleWrite(value.ToString());
              namecheck = namecheck.Replace(", "+resname, "");
              plugin.ConsoleWrite(namecheck);
              File.WriteAllText(dir, namecheck);
              }
              else
              {
              plugin.ConsoleWrite(value.ToString());
              namecheck = namecheck.Replace(resname, rescont[0]+":"+ rescont[1] +":"+value.ToString() +":"+ datestring);
              plugin.ConsoleWrite(namecheck);
              File.WriteAllText(dir, namecheck);
              }
            }
          }
        }
      }
    return false;
    "Res" list

    Create a new list, call it Res, change the comparison to CaseSensitive, add a list of clan tags or soldier names that should be excluded from this reward, separated by commas, for example:

    Code:
    SLAG, PapaCharlieNiner, IAF

    Some Bonus Code:

    This is code I use to do some yelling on first spawn, first yell is "Type !rules for Server Rules"
    Second yell is, if applicable, "You have a reserve slot for helping to start the server, it will expire in approximately ?? day(s) unless you help again"

    Limit #3 Yell !Rules & Res

    Set limit to evaluate OnSpawn

    Set first_check to this Expression:

    Code:
    (  true  )
    Set second_check to this Code:

    Code:
    if (limit.Activations(player.Name) > 1) return false;
    
    
    //The thread code below allows me to delay the reward message on first spawn because directly below this text is a !rules yell. It then yells the reward message 5 seconds later
    
    //simple yell to start for type !rules for server rules
    plugin.SendPlayerYell(player.Name, "Type !rules for Server Rules" , 5);
    
    // Closure bindings for the delegate
    string port = server.Port;
    string host = server.Host;
    string yellMsg = null;
    string dir = "Plugins\\BF4\\ReserveList_" +host+ "_" +port+ ".txt";
    if(File.Exists(dir))
      {
      //read names on reserve list
      string namecheck = File.ReadAllText(dir);
      //plugin.ConsoleWrite(namecheck);
      //split names on Reserve list at ", "
      string[] resnames = Regex.Split(namecheck, ", ");
      //check each split name 
      foreach (string resname in resnames)
        {
        //split the name at ":" in to array, 1st is player name, 2nd is date last updated, 3rd can be ignored, was extra code in second check
        string[] rescont = resname.Split(':');
        if (rescont[0] == player.Name)
          {
          if (plugin.GetReservedSlotsList().Contains(rescont[0]))
            {
            int value = Convert.ToInt32(rescont[2]);
            yellMsg = "You have a reserve slot for helping to start the server, it will expire in approximately "+value+" day(s) unless you help again.";
            break;
            }
          }
        }
      }
    
    // Thread delegate
    
    ThreadStart AdminYell = delegate  {
    //5 second delay before yelling the reward message
      Thread.Sleep(5*1000);
      plugin.SendPlayerYell(player.Name, yellMsg , 5);
      };
    
    // Main thread code
    if (yellMsg != null)
      {
      Thread t = new Thread(AdminYell);
      t.Start();
      Thread.Sleep(10);
      }
    return false;
    Last edited by PapaCharlie9; 01-12-2013 at 21:56.
    Don't send me private messages (PMs) unless you really need privacy, like your game server password. If you just have a question or need help, post in one of the threads. It's extra work for me to answer questions and give help in private messages and no one else gets the benefit of the answer.

  6. #26
    Thank you supermillhouse for creating this reserve limit, and thank you Papa for your updates to make it work with my clan's tag system. The above modification now works like MULTIbalancer, where it will read the clan tags when they are part of the name itself. It's nice to have the res list include both the clan tags as well as non-clan member names.

    Very nice work guys, especially to you supermillhouse for this idea and the limit's initial creation.
    Last edited by IAF SDS; 02-12-2013 at 00:57.

  7. #27
    Procon 2 Alpha Test Group - Senior Leader Tester - Alpha Division
    Join Date
    Oct 2011
    Location
    Canberra, Australia
    Posts
    199
    Does the yell section actually yell, or does it need to be modified for BF4?

  8. #28
    Quote Originally Posted by k4n30 View Post
    Does the yell section actually yell, or does it need to be modified for BF4?
    As of R12, there is no yell in BF4, so the bonus code doesn't do anything.

    You can use the following limit instead to tell new players about the reserved slot reward:

    https://forum.myrcon.com/showthread....eeting-Message
    Last edited by PapaCharlie9; 02-12-2013 at 17:54.
    Don't send me private messages (PMs) unless you really need privacy, like your game server password. If you just have a question or need help, post in one of the threads. It's extra work for me to answer questions and give help in private messages and no one else gets the benefit of the answer.

  9. #29
    Officially updated to BF4 thanks to PC9

    To first post

  10. #30
    Fixed typo in Add Res Second Check, Thanx IAF SDS

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •