Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Oct 2010
    Location
    Leicester UK
    Posts
    205

    Server seeder reserved slot request.

    Hi guys

    Could somone modify this code from the "server seeder reserved slot script by supermillhouse" to send no message on 1st spawn and then the reserved slot message on 2nd spawn only?

    I have xpkillers stats logger using the current 1st spawn slot.

    Many Thanks

    ToM


    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 ToM666; 03-05-2014 at 22:17.

  2. #2
    Senior Member
    Join Date
    Oct 2010
    Location
    Leicester UK
    Posts
    205
    Could an admin move this to "Plugin development please.

    I'll get it right one of these days

    I'm 47 going on 60 I think.

  3. #3
    It would make more sense to merge this into supermillhouse's thread, wouldn't it? Since its a request for a modification of that code.
    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.

  4. #4
    Senior Member
    Join Date
    Oct 2010
    Location
    Leicester UK
    Posts
    205
    Quote Originally Posted by PapaCharlie9 View Post
    It would make more sense to merge this into supermillhouse's thread, wouldn't it? Since its a request for a modification of that code.
    I did originally put it there then thought it was in the wrong place so moved it here.

    I'll move it back.

  5. #5
    Senior Member
    Join Date
    Oct 2010
    Location
    Leicester UK
    Posts
    205
    Someone delete this thread please.

    Thanks

    ToM

 

 

Posting Permissions

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