Results 1 to 4 of 4
  1. #1
    Procon Addict
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    501

    ProconRulz - VictimYell

    I do not know why the developer did not add VictimYell, but lets go try to fix it!
    Open your ProconRulz.cs via notepad++ and find "enum PartEnum" and after "PlayerSay" add this "VictimYell"
    It should look like this:
    Code:
    enum PartEnum 
    { Yell, Say, PlayerYell, PlayerSay, VictimYell, VictimSay, TeamYell, TeamSay, SquadYell, SquadSay,
        Log, Both, PlayerBoth, All, AdminSay, // various message actions
        // actions affecting 'target' e.g. playername in say text:
        TargetConfirm, TargetCancel, 
        Kill, Kick, PlayerBlock, Ban, TempBan, PBBan, PBKick,
        Execute, Continue, End,
        Headshot, Protected, Admin, Admins, Team, Teamsize,
        Map, MapMode,
        Kit, Weapon, Spec, Damage, TeamKit, TeamWeapon, TeamSpec, TeamDamage,
        Range,
        Count, PlayerCount, TeamCount, ServerCount,
        Rate, Text, TargetPlayer, Ping,
        Set, Incr, Decr, Test
    };
    Find "case "victimsay"" and after "break;" add this code:
    Code:
    case "victimyell": // e.g. "VictimYell No more Snipers!"
        if (part.Length < 12)
        {
            parse_error("VictimYell", parsed_rule.unparsed_rule); rule_fail = true; break;
        }
        new_action.part_type = PartEnum.VictimYell;
        parsed_int = false; // assume parsing yell_delay fails
        try
        {
            new_action.int1 = Int32.Parse(fragments[1]); // try and pick up yell delay (seconds)
            new_action.string_list.Add(String.Join(" ", fragments, 2, fragments.Length-2 )); // rest of string
            parsed_int = true;
        }
        catch { }
        if (!parsed_int) // we didn't parse a yell delay so use default
        {
            new_action.int1 = yell_delay;
            new_action.string_list.Add(part.Substring(11));
        }
        new_action.has_count = has_a_count(new_action);
        parsed_rule.parts.Add(new_action);
        break;
    It should look like this:
    Code:
    case "victimsay": // e.g. "VictimSay You were killed by %p%, range %r%!"
        if (part.Length < 11)
        {
            parse_error("VictimSay", parsed_rule.unparsed_rule); rule_fail = true; break;
        }
        new_action.part_type = PartEnum.VictimSay;
        new_action.string_list.Add(part.Substring(10));
        new_action.has_count = has_a_count(new_action);
        parsed_rule.parts.Add(new_action);
        break;
    case "victimyell": // e.g. "VictimYell No more Snipers!"
        if (part.Length < 12)
        {
            parse_error("VictimYell", parsed_rule.unparsed_rule); rule_fail = true; break;
        }
        new_action.part_type = PartEnum.VictimYell;
        parsed_int = false; // assume parsing yell_delay fails
        try
        {
            new_action.int1 = Int32.Parse(fragments[1]); // try and pick up yell delay (seconds)
            new_action.string_list.Add(String.Join(" ", fragments, 2, fragments.Length-2 )); // rest of string
            parsed_int = true;
        }
        catch { }
        if (!parsed_int) // we didn't parse a yell delay so use default
        {
            new_action.int1 = yell_delay;
            new_action.string_list.Add(part.Substring(11));
        }
        new_action.has_count = has_a_count(new_action);
        parsed_rule.parts.Add(new_action);
        break;
    Find "case PartEnum.PlayerYell" and after "break;" add this code:
    Code:
    case PartEnum.VictimYell:
    	if (!keywords.ContainsKey(SubstEnum.Victim)) break; // skip if we don't know player team
        ExecuteCommand("procon.protected.send",
            "admin.yell", message, a.int1.ToString(), "player", keywords[SubstEnum.Victim]);
        ExecuteCommand("procon.protected.chat.write", String.Format("(VictimYell {0}) ", keywords[SubstEnum.Victim]) + message);
        break;
    It should look like this:
    Code:
    case PartEnum.PlayerYell:
        ExecuteCommand("procon.protected.send",
            "admin.yell", message, a.int1.ToString(), "player", target);
        ExecuteCommand("procon.protected.chat.write",
            String.Format("(PlayerYell {0}) ", target) + message);
        break;
    	
    case PartEnum.VictimYell:
    	if (!keywords.ContainsKey(SubstEnum.Victim)) break; // skip if we don't know player team
        ExecuteCommand("procon.protected.send",
            "admin.yell", message, a.int1.ToString(), "player", keywords[SubstEnum.Victim]);
        ExecuteCommand("procon.protected.chat.write", String.Format("(VictimYell {0}) ", keywords[SubstEnum.Victim]) + message);
        break;
    Now you can create a message that will be shown to the person who was killed:
    Code:
    On Kill;VictimSay Test message;VictimYell 10 Test message

  2. #2
    Quote Originally Posted by Hodor View Post
    I do not know why the developer did not add VictimYell, but lets go try to fix it!
    Ah, I have a clue there... I decided at some point providing a TargetPlayer <name> command was more generally useful than specific player-targeted actions, but you're right a VictimYell command wouldn't have clashed with anything and would be simpler to use.

    But ProconRulz as-is supports VictimYell via

    TargetPlayer %v%; TargetAction PlayerYell YOU ARE A VICTIM (killed by %p%)


    There's an example similar to this in the ProconRulz docs - Basically TargetPlayer <partplayername> sets up the concept that for the rest of the rule there's a player that's a 'target' for actions, and TargetAction <ProconRulz Action> says apply this action to the player previously defined as the target (in this case the victim of a Kill as contained in %v%). So it's more general purpose than a specific VictimYell command but I admit that's simpler. Note that not all games that ProconRulz supports actually supports the PlayerYell command.

    The real genius (I'm kidding) in TargetPlayer is the *matching* used to get an actual player name. I.e. if you do "TargetPlayer bam" and I (bambam) am the *only* player in the game with those 3 letters in my name, the %t% will be set as exactly my player name. The command won't pick a player (i.e. the command will fail) if there is no player, OR MORE THAN ONE player, containing that string. This IMHO is infinitely better than other plugins (including Procon itself) which either do exact matching of the whole name or use some wanky nearest-match algorithm to try and guess right. That does NOT work if you have a hacker on the site called !!!1111llll|||lll11!!ll and you try and type the guy's name to kick them. With ProconRulz you only have to partial match the name and (assuming there isn't another player with the same partial match) the hacker can be kicked. E.g. you could "Kick 11".
    --------------------------------------------------------------
    For the ProconRulz Procon Plugin, always read the first post in the ProconRulz thread. See also the ONLINE DOCUMENTATION for information regarding writing your own rulz.

  3. #3
    Procon Addict
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    501
    I was got an error when i used TargetPlayer %v%; (Maybe I'm wrong, a lot of time has passed), Nevertheless, I did what I did and VictimYell works perfect for me.
    Also proconrulz now supports newline \n https://forum.myrcon.com/showthread....l=1#post137118
    Welcome back
    Last edited by Hodor; 18-01-2017 at 13:46.

  4. #4
    Procon Addict
    Join Date
    Mar 2014
    Location
    Russia, Moscow
    Posts
    501
    Quote Originally Posted by bambam View Post
    But ProconRulz as-is supports VictimYell via

    TargetPlayer %v%; TargetAction PlayerYell YOU ARE A VICTIM (killed by %p%)
    Rule:
    Code:
    On Kill;TargetPlayer %v%;TargetAction PlayerYell YOU ARE A VICTIM (killed by %p%);log Targetrule
    Error:
    Code:
    [17:06:08 97] ProconRulz: recoverable exception in process_part (ProconRulz will continue...)
    [17:06:08 97] ProconRulz: process_part rule.unparsed_rule = [On Kill;TargetPlayer %v%;TargetAction PlayerYell YOU ARE A VICTIM (killed by %p%);log Targetrule]
    [17:06:08 97] ProconRulz: process_part player_name = [xGruebelx]
    [17:06:08 97] ProconRulz: process_part p.part_type = TargetPlayer
    [17:06:08 97] ProconRulz: process_part k.Killer.SoldierName = [xGruebelx]
    [17:06:08 97] ProconRulz: System.Collections.Generic.KeyNotFoundException: Данный ключ отсутствует в словаре.
       в System.ThrowHelper.ThrowKeyNotFoundException()
       в System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       в PRoConEvents.ProconRulz.process_part(ParsedRule rule, PartClass p, String player_name, Kill k, String msg, Dictionary`2& keywords)

 

 

Posting Permissions

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