Page 6 of 6 FirstFirst ... 456
Results 51 to 60 of 60
  1. #51
    Senior Member
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    154
    there are two gunmaster modes, GunMaster0 and GunMaster1. the second command looking for "GunMaster"

  2. #52
    In other words it just looks for GunMaster, regardless of the number afterwards, it matches both GunMaster1 and GunMaster0.
    ____

  3. #53
    Senior Member
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    154
    Thanks ColColonCleaner

  4. #54
    Quote Originally Posted by Grovax View Post
    Thats not correct, you must use the code of this post: https://forum.myrcon.com/showthread....l=1#post132499
    // Insane Limits - Sniperlimit by Grovax v1.5

    if (Regex.Match(server.Gamemode, @"(Gunmaster)").Success) {
    return false;
    }


    // Set max. snipers/dmrs each team
    int maxSnipers = 3;

    // Set kills for timeban
    // Info: at 3 the user get 2 warnings before being timebanned
    int warnKick = 2;

    // ReservedSlots Player can use sr/dmr without sniperslot
    // 0 = not allowed | 1 = allowed
    int vipAllowed = 1;

    // Admins can use sr/dmr without sniperslot
    // 0 = not allowed | 1 = allowed
    int adminAllowed = 1;

    //Whitelist
    if (plugin.isInWhitelist(player.Name)) return false;;

    // Set (main) allowed weapons and weaponcategory
    bool sniperLimit = (kill.Category == "SniperRifle" || kill.Category == "DMR");

    // Set (second) allowed weapons and weaponcategory
    bool sniperAllowed = (kill.Category == "Handgun" || kill.Category == "Explosive" || kill.Weapon == "Melee" || Regex.Match(kill.Weapon, @"(?:Shorty)").Success);

    // Allowed all vehicles
    bool vehiclesAllowed = (Regex.Match(kill.Weapon, @"(?eath|Roadkill|AMTRAC|Vehicle|Jeep|Growler|MRAP|Bug gy|Venom|APC|Anti-Air|PGZ-95|HIMARS|MBT|Tank|Jet|Heli|AC-130|Lancer|Xian|Global|CB90|DV-15|RHIB|Bird)", RegexOptions.IgnoreCase).Success);


    // Dont edit
    if (vipAllowed == 1) {
    List<String> ReservervedSlots = plugin.GetReservedSlotsList();
    if (ReservervedSlots.Contains(killer.Name)) return false;
    }

    if (adminAllowed == 1) {
    bool isAdmin = false;
    bool bKill = false;
    bool bKick = false;
    bool bBan = false;
    bool bMove = false;
    bool bLevel = false;
    if (plugin.CheckAccount(player.Name, out bKill, out bKick, out bBan, out bMove, out bLevel)) {
    if (bKill && bKick && bBan) return false;
    }
    }

    String globalMessage = null;
    String globalMessage2 = null;
    String privateMessage = null;
    String playerKey = "sl_" + killer.Name;
    String factionName = null;
    int warnings = 0;
    int countSnipers = 0;

    if (plugin.RoundData.issetInt(playerKey)) warnings = plugin.RoundData.getInt(playerKey);

    if (!plugin.RoundData.issetInt("sniperSlots")) plugin.RoundData.setInt("sniperSlots", maxSnipers);

    if (!plugin.RoundData.issetObject("slEntries1")) plugin.RoundData.setObject("slEntries1", new List<String>());
    if (!plugin.RoundData.issetObject("slEntries2")) plugin.RoundData.setObject("slEntries2", new List<String>());
    List<String> sniperTeam1 = (List<String>)plugin.RoundData.getObject("slEntrie s1");
    List<String> sniperTeam2 = (List<String>)plugin.RoundData.getObject("slEntrie s2");

    if (killer.TeamId == 1) countSnipers = sniperTeam1.Count;
    else if (killer.TeamId == 2) countSnipers = sniperTeam2.Count;

    if (server.GetFaction(player.TeamId) == 0) factionName = "US";
    else if (server.GetFaction(player.TeamId) == 1) factionName = "RU";
    else if (server.GetFaction(player.TeamId) == 2) factionName = "CN";

    if (sniperTeam1.Contains(killer.Name) || sniperTeam2.Contains(killer.Name)) {
    if (!sniperLimit && !sniperAllowed && !vehiclesAllowed) {
    globalMessage = "(" + factionName + ") " + killer.Name + " has lost his SNIPER/DMR slot! (used "+ plugin.FriendlyWeaponName(kill.Weapon).Name + ")";
    globalMessage2 = "(" + factionName + ") " + killer.Name + " has lost his SNIPER/DMR slot! (change team)";
    privateMessage = "You have lost your SNIPER/DMR slot!";

    if (killer.TeamId == 1 && sniperTeam1.Contains(killer.Name)) {
    sniperTeam1.Remove(killer.Name);
    plugin.SendTeamMessage(killer.TeamId, globalMessage);
    plugin.PRoConChat("Sniperlimit > TeamSay > " + globalMessage);
    plugin.SendPlayerYell(killer.Name, privateMessage, 10);
    plugin.PRoConChat("Sniperlimit > PlayerYell[10] > " + killer.Name + " > " + privateMessage);
    } else if (killer.TeamId == 1 && sniperTeam2.Contains(killer.Name)) {
    sniperTeam2.Remove(killer.Name);
    plugin.SendTeamMessage(2, globalMessage2);
    plugin.PRoConChat("Sniperlimit > TeamSay > " + globalMessage2);
    plugin.SendPlayerYell(killer.Name, privateMessage, 10);
    plugin.PRoConChat("Sniperlimit > PlayerYell[10] > " + killer.Name + " > " + privateMessage);
    } else if (killer.TeamId == 2 && sniperTeam2.Contains(killer.Name)) {
    sniperTeam2.Remove(killer.Name);
    plugin.SendTeamMessage(killer.TeamId, globalMessage);
    plugin.PRoConChat("Sniperlimit > TeamSay > " + globalMessage);
    plugin.SendPlayerYell(killer.Name, privateMessage, 10);
    plugin.PRoConChat("Sniperlimit > PlayerYell[10] > " + killer.Name + " > " + privateMessage);
    } else if (killer.TeamId == 2 && sniperTeam1.Contains(killer.Name)) {
    sniperTeam1.Remove(killer.Name);
    plugin.SendTeamMessage(1, globalMessage2);
    plugin.PRoConChat("Sniperlimit > TeamSay > " + globalMessage2);
    plugin.SendPlayerYell(killer.Name, privateMessage, 10);
    plugin.PRoConChat("Sniperlimit > PlayerYell[10] > " + killer.Name + " > " + privateMessage);
    }
    return false;
    }
    return false;
    } else if (sniperLimit) {
    if (countSnipers < maxSnipers) {
    if (killer.TeamId == 1) sniperTeam1.Add(killer.Name);
    else if (killer.TeamId == 2) sniperTeam2.Add(killer.Name);
    countSnipers += 1;
    warnings = 0;
    globalMessage = "(" + factionName + ") " + killer.Name + " has now a SNIPER/DMR Slot! (" + countSnipers + "/" + maxSnipers + ")";
    privateMessage = "You have now a SNIPER/DMR slot! (" + countSnipers + "/" + maxSnipers + ")";
    plugin.SendTeamMessage(killer.TeamId, globalMessage);
    plugin.PRoConChat("Sniperlimit > TeamSay > " + globalMessage);
    plugin.SendPlayerYell(killer.Name, privateMessage, 10);
    plugin.PRoConChat("Sniperlimit > PlayerYell[10] > " + killer.Name + " > " + privateMessage);
    return false;
    } else {
    if (limit.Activations(killer.Name, TimeSpan.FromSeconds(2)) > 1) return false;
    warnings += 1;
    plugin.RoundData.setInt(playerKey, warnings);
    if (warnings <= (warnKick-1)) {
    privateMessage = "You are killed by SNIPER/DMR LIMIT! Warning (" + warnings + "/" + warnKick +") Type !sinfo for more information";
    plugin.SendPlayerMessage(killer.Name, privateMessage);
    plugin.SendPlayerYell(killer.Name, privateMessage, 10);
    plugin.KillPlayer(killer.Name, 1);
    plugin.PRoConChat("Sniperlimit > PlayerSay/Yell[10] > " + killer.Name + " > " + privateMessage);
    return false;
    } else if (warnings == warnKick) {
    globalMessage = "Timeban for ignoring warnings of SNIPER/DMR LIMIT!";
    plugin.EABanPlayerWithMessage(EABanType.Name, EABanDuration.Temporary, killer.Name, 20, globalMessage);
    return false;
    }
    }
    }

    return false;
    This code not work in ganmaster

  5. #55
    Senior Member
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    154
    test this line:
    Code:
    if (Regex.Match(server.Gamemode, @"(Gunmaster0|Gunmaster1)").Success) return false;
    if that does not work. then i have no idea

  6. #56
    Senior Member
    Join Date
    Apr 2013
    Location
    Russia
    Posts
    245
    Quote Originally Posted by Grovax View Post
    test this line:
    Code:
    if (Regex.Match(server.Gamemode, @"(Gunmaster0|Gunmaster1)").Success) return false;
    if that does not work. then i have no idea
    Maybe it would be better to ignore the case?
    Code:
    if (Regex.Match(server.Gamemode, @"(GunMaster0|GunMaster1)", RegexOptions.IgnoreCase).Success) return false;

  7. #57
    GunMaster0|GunMaster1
    -this is GM presets?

  8. #58
    Senior Member
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    154
    Quote Originally Posted by steep100 View Post
    -this is GM presets?
    no, thats are Gamemodes

  9. #59
    if (Regex.Match(server.Gamemode, @"(GunMaster0|GunMaster1)", RegexOptions.IgnoreCase).Success) return false;
    This script work fine, thank you man!!!

  10. #60
    Senior Member
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    154
    Very good

 

 

Tags for this Thread

Posting Permissions

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