Page 1 of 20 12311 ... LastLast
Results 1 to 10 of 191
  1. #1

    [Insane Limits V0.9.8.0] [0.2.1.1 Reserve Slot for Server Starter]

    [BF4]

    It has come to my attention, mainly through fellow server owners and clan members, that it can be very difficult to start a server from empty. With this set of limits, I aim to reward anyone who help start my server with a reserved slot so that if and when they come back to the server when it is full, they do not have to queue to get in.

    Thank you PapaCharlie9 for you Tag and Player name exclusions

    The BF3 one is on post No2 here

    View on GItHub

    How it works:

    It starts off by creating a temp list of players on the server when the server population is 4 or more.

    If the server population drops below 4 the list is destroyed.

    If the server population gets above 20 then it copies the first 10 players from the temp list that are still in the server to reserve list, and gives them a potential 5 days on the reserve slot but the slot is not given to them yet. The temp list is also destroyed at this point. These potential 5 days expire day by day.

    If a player comes back within 5 days to help again then he is given another 5 days on top of whatever days he has left and is now rewarded with a reserve slot. There are some yell messages in here to but you can find them in the code.

    This limit set has an expiry that if the player stop helping to start the server once they have a reserve slot then their name will be taken off the reserve slot after their days are up.

    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 = 10;  //Number of players to be copied to reserve list
    int triggertransfer = 20;  //When the players list is copied over
    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";
    string logdir = "Logs\\InsaneLimits\\ReserveList_" +host+ "_" +port+ "dump_file.txt";
    if (!Directory.Exists(Path.GetDirectoryName(logdir))) Directory.CreateDirectory(Path.GetDirectoryName(logdir));
    
    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 <= triggertransfer) && (!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 > triggertransfer) && (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[] tempcount = tempname.Split(':');
          if ((listofplayers.Contains(tempcount[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[] rescount = resname.Split(':');
                  //checks if the reserve name equals the player name in temp
                if (rescount[0] == tempcount[0])
                  {
                  //stops multiple rewards per day
                  if(rescount[1] != datestring)
                    {
                    //add on the reward
                    int value = Convert.ToInt32(rescount[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, rescount[0]+":"+ datestring +":"+value.ToString()+":"+rescount[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(rescount[0]))
                        {
                        plugin.ServerCommand("reservedSlotsList.add", rescount[0]);
                        plugin.ServerCommand("reservedSlotsList.save");
                        plugin.PRoConChat(rescount[0] + " got added to ReserveSlot successfully with " + value.ToString() + " day(s) remaining.");
                        plugin.Log(logdir, rescount[0] + " got added to the ReserveSlot successfully with " + value.ToString() + " day(s) remaining.");
                        }
                      //message player
                      plugin.SendPlayerYell(rescount[0], rescount[0] + ": You have been awarded a reserve slot for helping to start the server, it will expire in approximately "+value+" days unless you help again.", 5);
                      }
                    }
                  //notify you that a player tried to help twice or more on a day to start server 
                  else {plugin.ConsoleWrite(rescount[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)
                  {
                  string newlist = resnamecheck + ", " + tempcount[0] +":" + datestring +":"+ rewarddays +":"+ datestring;
                  File.WriteAllText(dir2, newlist);
                  plugin.PRoConChat("New Player," + tempcount[0] + "added to end of the reserve slot list.");
                  plugin.Log(logdir, "New Player," + tempcount[0] + "added to end of the reserve slot list with " + rewarddays.ToString() + " day(s) remaining.");
                  }
                }
              }
            //if reserve list doesnt exist, creates list with first entry
            else 
              {
              string newlist = "Blank, "+tempcount[0] +":"+ datestring +":"+ rewarddays +":"+ datestring;
              File.WriteAllText(dir2, newlist);
              plugin.PRoConChat("Reserve slot list created with first player," + tempcount[0] + ".");
              plugin.Log(logdir, "Reserve slot list created with first player," + tempcount[0] + ".");
              }
            }
          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:

    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)) {
            // 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[] tempcount = tempname.Split(':');
            if (tempcount[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[] rescount = resname.Split(':');
          if (rescount[3] != datestring)
            {
            int value = Convert.ToInt32(rescount[2]);
            value--;
            if ((value == RSOffThresh) && (plugin.GetReservedSlotsList().Contains(rescount[0])))
              {
              plugin.ServerCommand("reservedSlotsList.remove", rescount[0]);
              plugin.ServerCommand("reservedSlotsList.save");
              plugin.ConsoleWrite(value.ToString());
              namecheck = namecheck.Replace(resname, rescount[0]+":"+ rescount[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, rescount[0]+":"+ rescount[1] +":"+value.ToString() +":"+ datestring);
              plugin.ConsoleWrite(namecheck);
              File.WriteAllText(dir, namecheck);
              }
            }
          }
        }
      }
    return false;
    List #1 Res

    Set list_1_name to Res
    Set list_1_comparison to CaseSensitive
    list_1_data is to contain a list of clan tags or soldier names that should be excluded from this reward, separated by commas, for example:

    Code:
    SLAG, SL4G, PapaCharlieNiner
    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 Secont_check to this Code:

    Code:
    if (limit.Activations(player.Name) > 1) return false;
    
    string path = "Logs/InsaneLimits/GUID.log";
    if (!Directory.Exists(Path.GetDirectoryName(path))) Directory.CreateDirectory(Path.GetDirectoryName(path));
    
    plugin.Log(path, plugin.R("[%date% %time%] [%p_ct% - %p_n%]    >>EA GUID:    %p_eg%<<         and         >>PB GUID:    %p_pg%<<     and      >>IP:    %p_ip%<<"));
    //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.SendPlayerMessage(player.Name, "Type !rules for Server Rules");
    
    // 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[] rescount = resname.Split(':');
        if (rescount[0] == player.Name)
          {
          if (plugin.GetReservedSlotsList().Contains(rescount[0]))
            {
            int value = Convert.ToInt32(rescount[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 supermillhouse; 28-02-2014 at 15:59.

  2. #2
    Original one for BF3

    It has come to my attention, mainly through fellow server owners and clan members, that it can be very difficult to start a server from empty. With this set of limits, I aim to reward anyone who help start my server with a reserved slot so that if and when they come back to the server when it is full, they do not have to queue to get in.

    How it works:

    It starts off by creating a temp list of players on the server when the server population is 4 or more.

    If the server population drops below 4 the list is destroyed.

    If the server population gets above 10 then it copies the first 6 players from the temp list that are still in the server to reserve list, and gives them a potential 5 days on the reserve slot but the slot is not given to them yet. The temp list is also destroyed at this point. These potential 5 days expire day by day.

    If a player comes back within 5 days to help again then he is given another 5 days on top of whatever days he has left and is now rewarded with a reserve slot. There are some yell messages in here to but you can find them in the code.

    This limit set has an expiry that if the player stop helping to start the server once they have a reserve slot then their name will be taken off the reserve slot after their days are up.

    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\\BF3\\TempList_" +host+ "_" +port+ ".txt";
    string done = "Plugins\\BF3\\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\\BF3\\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.SendPlayerYell(rescont[0], "You have been awarded a reserve slot for helping to start the server, it will expire in approximately "+value+" days unless you help again." , 5);
                      }
                    }
                  //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 Player");
                  string newlist = resnamecheck + ", " + tempcont[0] +":" + datestring +":"+ rewarddays +":"+ datestring;
                  File.WriteAllText(dir2, newlist);
                  }
                }
              }
            //if reserve list doesnt exist, creates list with first entry
            else 
              {
              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:

    Please change the tag "SLAG" in line 13 to that of your clan to stop your clan members names getting added to the temp 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)
      {
    //Change SLAG to your clan tag which probably all members have reserve slots anyway. 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")) && (p.Tag != "SLAG"))
        {
        string dir = "Plugins\\BF3\\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("New Player");
              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
          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\\BF3\\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;
    List #1 Res

    Set list_1_name to Res
    Set list_1_comparison to CaseSensitive
    list_1_data is to contain your permanently reserved players names who do not have your clan tag


    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 Secont_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\\BF3\\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 supermillhouse; 02-12-2013 at 18:02.

  3. #3
    nice, this is very interesting limit, learned a lot from it and i will implement it to my servers soon.

    i love how you made clear notes in the code.

    just a quick question, wouldn't a stand alone plugin be better ?
    Feeding is my job.

  4. #4
    Quote Originally Posted by HexaCanon View Post
    just a quick question, wouldn't a stand alone plugin be better ?
    Probably but I don't know how to code. Any tips on were to start?
    Last edited by supermillhouse; 21-03-2013 at 20:50.

  5. #5
    Sticky: [BF3] Getting started with this bare bones plugin template



    Ironically, doing anything with a timer is harder to do with a standalone plugin. Insane Limits has spoiled you all for that.
    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. #6
    Senior Member
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    391
    trying this out now, great work millhouse

  7. #7
    Senior Member
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    391
    looks like its working, question, on the next day/time the server gets going are people added to the list of is it just those 6 at one time?

  8. #8
    Quote Originally Posted by Tomgun View Post
    looks like its working, question, on the next day/time the server gets going are people added to the list of is it just those 6 at one time?
    line 6 to 9 of the first code has some options you might want to look at.
    Feeding is my job.

  9. #9
    i have it on all of my servers at the moment, just a question: does the limit track how many times someone helped ? is it possible to do so ? was wondering if someone helps 10 times (10 days) then i can give him more awards. you can make so that when someone helps X times an email is sent to admin telling him the player name.. just an idea.
    Feeding is my job.

  10. #10
    Quote Originally Posted by Tomgun View Post
    looks like its working, question, on the next day/time the server gets going are people added to the list of is it just those 6 at one time?
    Many people will get added to the list, it is not limited to 6.

 

 

Posting Permissions

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