Results 1 to 9 of 9
  1. #1

    Insane Limits: Limit on mortars/XM - Need help

    Hi,

    Is there a way to make sure the count is reset to zero on new round for players? I think there is a slight bug in my code below. Someone was banned after one use of the XM. I need to ensure its reset on new round.

    Code:
    double count = limit.Activations(player.Name);
    
    if (limit.Data.issetBool(player.Name))
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been temp banned for using excessive XM/Mortar."));
    	 plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Temporary, player.Name, 60, plugin.R("You have been banned for using explosives. Timeout for an hour! "));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was temp banned for using excessive XM/Mortar."));
    	 limit.Data.unsetBool(player.Name);
    	}
    
    else if (count == 1)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 2)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 3)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #3 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 4)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 5)
    	{
    	 plugin.KillPlayer(player.Name);
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"),5);
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was killed for excessive XM/Mortar kills."));
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been killed for excessive XM/Mortar kills."));
    	}
    
    else if (count == 6)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been kicked out for using excessive XM/Mortar. Learn to read."));
    	 plugin.KickPlayerWithMessage(player.Name, plugin.R("Excessive XM/Mortar kills. Maximum of 4!!"));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% has been kicked for excessive XM/Mortar kills."));
             
             if (!limit.Data.issetBool(player.Name))
             limit.Data.setBool(player.Name, true);
    	}
    
     return false;
    Last edited by PapaCharlie9; 03-06-2014 at 17:46.

  2. #2
    Procon Addict
    Join Date
    Dec 2013
    Location
    Sydney, Australia
    Posts
    502
    Quote Originally Posted by cdd3068 View Post
    Hi,

    Is there a way to make sure the count is reset to zero on new round for players? I think there is a slight bug in my code below. Someone was banned after one use of the XM. I need to ensure its reset on new round.

    Code:
    double count = limit.Activations(player.Name);
    
    if (limit.Data.issetBool(player.Name))
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been temp banned for using excessive XM/Mortar."));
    	 plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Temporary, player.Name, 60, plugin.R("You have been banned for using explosives. Timeout for an hour! "));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was temp banned for using excessive XM/Mortar."));
    	 limit.Data.unsetBool(player.Name);
    	}
    
    else if (count == 1)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 2)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 3)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #3 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 4)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 5)
    	{
    	 plugin.KillPlayer(player.Name);
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"),5);
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was killed for excessive XM/Mortar kills."));
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been killed for excessive XM/Mortar kills."));
    	}
    
    else if (count == 6)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been kicked out for using excessive XM/Mortar. Learn to read."));
    	 plugin.KickPlayerWithMessage(player.Name, plugin.R("Excessive XM/Mortar kills. Maximum of 4!!"));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% has been kicked for excessive XM/Mortar kills."));
             
             if (!limit.Data.issetBool(player.Name))
             limit.Data.setBool(player.Name, true);
    	}
    
     return false;
    I'm pretty sure all you'd need to do is change the lines I've marked in red above to the following that is marked in red below:
    Code:
    double count = limit.Activations(player.Name);
    
    if (limit.RoundData.issetBool(player.Name))
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been temp banned for using excessive XM/Mortar."));
    	 plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Temporary, player.Name, 60, plugin.R("You have been banned for using explosives. Timeout for an hour! "));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was temp banned for using excessive XM/Mortar."));
    	 limit.RoundData.unsetBool(player.Name);
    	}
    
    else if (count == 1)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 2)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 3)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #3 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    else if (count == 4)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 5)
    	{
    	 plugin.KillPlayer(player.Name);
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"),5);
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was killed for excessive XM/Mortar kills."));
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been killed for excessive XM/Mortar kills."));
    	}
    
    else if (count == 6)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been kicked out for using excessive XM/Mortar. Learn to read."));
    	 plugin.KickPlayerWithMessage(player.Name, plugin.R("Excessive XM/Mortar kills. Maximum of 4!!"));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% has been kicked for excessive XM/Mortar kills."));
             
             if (!limit.RoundData.issetBool(player.Name))
             limit.RoundData.setBool(player.Name, true);
    	}
    
     return false;
    That should clear the data on the start of each round. I'm sure PapaCharlie will correct me if I'm wrong.

  3. #3
    Actually, remove all of the limit.Data stuff. The limit.Activations function is a per-round count already, resets at the end of every round. You'd have to use limit.ActivationsTotal to get a count that spans multiple rounds.
    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
    Quote Originally Posted by PapaCharlie9 View Post
    Actually, remove all of the limit.Data stuff. The limit.Activations function is a per-round count already, resets at the end of every round. You'd have to use limit.ActivationsTotal to get a count that spans multiple rounds.
    So this?
    Code:
    double count = limit.Activations(player.Name);
    
    if (count == 1)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 2)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 3)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #3 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 4)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 5)
    	{
    	 plugin.KillPlayer(player.Name);
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"),5);
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was killed for excessive XM/Mortar kills."));
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been killed for excessive XM/Mortar kills."));
    	}
    
    else if (count == 6)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been kicked out for using excessive XM/Mortar. Learn to read."));
    	 plugin.KickPlayerWithMessage(player.Name, plugin.R("Excessive XM/Mortar kills. Maximum of 4!!"));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% has been kicked for excessive XM/Mortar kills."));
    	}
    
    else if (count == 7)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been temp banned for using excessive XM/Mortar."));
    	 plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Temporary, player.Name, 60, plugin.R("You have been banned for using explosives. Timeout for an hour! "));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was temp banned for using excessive XM/Mortar."));
    	}
     return false;

  5. #5
    Quote Originally Posted by cdd3068 View Post
    So this?
    Yes, except that I would change (count == 7) to (count > 6). Just in case the round lasts more than 60 minutes and he comes back again.
    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
    Thank you very much

  7. #7
    Hello guys,

    Care to share the whole setup for this? I been looking for this limit for mortar on all maps? Appreciate so much if u can share.

  8. #8
    Quote Originally Posted by avengedthedead View Post
    Hello guys,

    Care to share the whole setup for this? I been looking for this limit for mortar on all maps? Appreciate so much if u can share.
    I'm assuming you want this for BF4. You can't detect mortar kills in BF3, they look like vehicle kills.

    Create a limit to evaulate OnKill, call it "no mortars".

    Set first_check to this Expression:

    Code:
    (kill.Weapon.Contains("M224"))
    Set second_check to this Code:

    Code:
    double count = limit.Activations(player.Name);
    
    if (count == 1)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #1 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 2)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #2 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 3)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #3 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 4)
    	{
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Kill #4 of #4! Using XM/Mortar! Maximum of 4!"),5);
    	
    	}
    
    else if (count == 5)
    	{
    	 plugin.KillPlayer(player.Name);
    	 plugin.SendPlayerMessage(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"));
    	 plugin.SendPlayerYell(player.Name, plugin.R ("Excessive XM/Mortar kills. Maximum of 4!"),5);
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was killed for excessive XM/Mortar kills."));
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been killed for excessive XM/Mortar kills."));
    	}
    
    else if (count == 6)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been kicked out for using excessive XM/Mortar. Learn to read."));
    	 plugin.KickPlayerWithMessage(player.Name, plugin.R("Excessive XM/Mortar kills. Maximum of 4!!"));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% has been kicked for excessive XM/Mortar kills."));
    	}
    
    else if (count > 6)
    	{
    	 plugin.SendGlobalMessage(plugin.R("%p_n% has been temp banned for using excessive XM/Mortar."));
    	 plugin.EABanPlayerWithMessage(EABanType.EA_GUID, EABanDuration.Temporary, player.Name, 60, plugin.R("You have been banned for using explosives. Timeout for an hour! "));
    	 plugin.PRoConChat(plugin.R("[Sniper Kicker] > %p_n% was temp banned for using excessive XM/Mortar."));
    	}
     return false;
    You can change the messages and remove "XM/", since you only want mortar kills.
    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.

  9. #9
    Awesome thanks papa. I'll give it a try.

 

 

Posting Permissions

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