Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11
    Hey,

    Thanks again first of all.

    For some reason, it does not work all the time when its in "normal play" where two teams fight eachother (as in it does not register it all, even though the if statement would return true), but it does work perfectly when testing it alone. Makes me feel like it can't keep up with the processing, so it skips events? Or is that not possible?

  2. #12
    Quote Originally Posted by W00dyR View Post
    Hey,

    Thanks again first of all.

    For some reason, it does not work all the time when its in "normal play" where two teams fight eachother (as in it does not register it all, even though the if statement would return true), but it does work perfectly when testing it alone. Makes me feel like it can't keep up with the processing, so it skips events? Or is that not possible?
    No, it's definitely not about having too many events of whatever.

    So in normal play, you don't see any messages at all, not even in the Event log? Do you have event logging enabled?

    Try this debugging version. It's going to spam an event for every kill, but it won't spam any chat.

    Code:
    double TimeAllowedSeconds = 13; // CHANGE, number of seconds to count kills
    int MaxKills = 5; // CHANGE, max kills within TimeAllowedSeconds
    int MaxToBan = 10; // CHANGE, kill count to round ban
    
    if (killer.Name == victim.Name || String.IsNullOrEmpty(killer.Name) || killer.Name == " ") {
        plugin.PRoConEvent("Skipping " + victim.Name + ", same as killer.Name", "Insane Limits");
        return false; // don't count suicides
    }
    
    String kCountPrefix = "Kill Count Stabby_";
    String kTimePrefix = "Kill Time Stabby_";
    
    String kCount = kCountPrefix + killer.Name;
    String kTime = kTimePrefix + killer.Name;
    
    DateTime now = DateTime.Now;
    
    if (!victim.RoundData.issetInt(kCount))
        victim.RoundData.setInt(kCount, 0);
    if (!victim.RoundData.issetObject(kTime))
        victim.RoundData.setObject(kTime, (Object)now);
    
    int count = victim.RoundData.getInt(kCount);
    DateTime last = (DateTime)victim.RoundData.getObject(kTime);
    
    double elapsed = now.Subtract(last).TotalSeconds;
    
    // Update kill time
    victim.RoundData.setObject(kTime, (Object)now);
    
    // FOR DEBUGGING
    plugin.PRoConEvent("Debug: " + killer.Name + " killed " + victim.Name + " with count " + count + " after " + elapsed.ToString("F1") + " secs of " + TimeAllowedSeconds.ToString("F0"), "DEBUG");
    
    if (elapsed > TimeAllowedSeconds) {
        return false; // nothing to do
    }
    
    // kill done within allowed time, increase count
    count = count + 1;
    victim.RoundData.setInt(kCount, count);
    
    if (count >= MaxToBan) {
        plugin.PRoConEvent("Round banning " + killer.Name + " for spawnkilling", "Insane Limits"); // CHANGE
        plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Round, killer.Name, 1, "Too much spawn killing!"); // CHANGE
    } else if (count >= MaxKills) {
        plugin.PRoConEvent("Warning " + count + " for " + killer.Name + " for spawnkilling " + victim.Name, "Insane Limits"); // CHANGE
        plugin.SendPlayerMessage(killer.Name, killer.Name + ": Killing you for ignoring warnings! DO NOT SPAWNKILL OR BE BANNED!"); // CHANGE
        plugin.SendPlayerYell(killer.Name, killer.Name + ": Killing you for ignoring warnings! DO NOT SPAWNKILL OR BE BANNED!", 5); // CHANGE
        plugin.KillPlayer(killer.Name, 1);
    } else {
        plugin.PRoConEvent("Warning " + count + " for " + killer.Name + " for spawnkilling " + victim.Name, "Insane Limits"); // CHANGE
        plugin.SendPlayerMessage(killer.Name, killer.Name + ": Warning " + count + " of " + MaxKills + " against " + victim.Name + ", DO NOT SPAWNKILL!"); // CHANGE
        plugin.SendPlayerYell((killer.Name, killer.Name + ": Warning " + count + " of " + MaxKills + " against " + victim.Name + ", DO NOT SPAWNKILL!", 5); // CHANGE
    }
    
    return false;
    After running a round of normal play, post the Event log messages. Should look something like this:

    Ideally attach the entire event.log file if you can find it (in procon/Logs/your_ip_port/YYYMMDD_event.log). If you can't figure that out, just screenshot the event Tab, like this:

    eventsss.png

    I want to see the event lines that have DEBUG in it.
    Last edited by PapaCharlie9; 24-01-2015 at 18:21.
    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.

 

 

Posting Permissions

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