Results 1 to 4 of 4
  1. #1

    Warning system that uses variables

    Hello guys,

    I have a server that only runs Noshahr Canals TDM on BF3. We have the rule that going on crane is forbidden. So if people get on there, my moderators have a specific command to get them down.
    I made the following in proconrulz to make this command:

    On Round;Set %warnings% 0
    On Say;Admin;Text !w;Incr %warnings%

    On Say;Admin;Text !w;If %warnings% == 1;TargetPlayer;TargetAction Kill;Say ############ %t% NO CRANE, FIRST WARNING!############
    On Say;Admin;Text !w;If %warnings% == 2;TargetPlayer;TargetAction Kill;Say ############ %t% NO CRANE, SECOND WARNING!############
    On Say;Admin;Text !w;If %warnings% == 3;TargetPlayer;TargetAction Kick;Say ############ %t% NO CRANE, THIRD WARNING (KICKING)!############

    I want to have the server adding the amount of warnings and when it reaches 3 for a player, it will kick him.
    Though i run in a problem i can't seem to fix. That is that at some point the command doesn't work anymore for a moderator. We can't determine how and when this occurs.

    I hope someone can help me fix this problem

    Thanks in advance
    Smellblood95
    Admin of Virtual Killers

  2. #2
    Community Contributor
    Join Date
    Nov 2011
    Posts
    3,011
    You have numerous issues.

    Here is one:
    On Say;Admin;Text !w;Incr %warnings%
    There is no targetplayer in that line and therefore it is not increasing the number of warnings for that player. It is actually increasing the admin's warnings.

    Here is another:
    On Say;Admin;Text !w;If %warnings% == 1;TargetPlayer;TargetAction Kill...
    It is checking to see how many warnings the admin has.

    This is not necessary:
    On Round;Set %warnings% 0
    All variables are already set to 0 automatically when a round starts.



    Here you go:

    On Say;Admin;Text !w;TargetPlayer
    Incr %server_warnings[%t%]%
    TargetAction Kill;Say ###### %t% NO CRANE, WARNING %c%! ######
    If %server_warnings[%t%]% >= 3;TargetAction Kick %t% NO CRANE!



    %server_warnings[%t%]% is a server-wide variable instead of a per-player variable. It is actually a variable containing an array of variables for each player due to the %t% targetplayer inside of it. It's easiest to use this method to use a targeted variable in logic. This is necessary so that the "If" logic targets the correct player instead of targeting the admin who triggers the rule by the admin's text.

    Another problem with your rules is that it would have kicked them for their third offense (if the other issues were corrected and it worked at all), but if they came back to the server during the same round and kept violating the rules, they would not have been kicked any more. I used ">=" in the "If" logic so that when they return during the same round, they will be kicked again for their 4th offense and so on.

    I also made the rules considerably shorter by incorporating "multi-line rulz" and using things like %c% to repeat the warning message each time instead of making a new rule for each individual offense. Additionally, I added a message in the kick reason so that players with in-game chat "muted" will know why they were kicked. Without a kick reason, players with muted in-game chat will have no idea why they were kicked because they won't see the warning messages in the server chat leading up to their kick punishment.
    Last edited by ty_ger07; 24-05-2015 at 06:10.

  3. #3
    Wow thanks man, I notice that I am still a noob in this

  4. #4
    There seems to bea bug, where it does not count the amount of warnings to the player, but towards the admin. So the amount warnings that the admin gives will just go up. It now says that someone has 9 warnings for example

    Also it doesnt kick whenever the amount of 3 is reached!

    I have changed %c% with %server_warnings[%t%]%, maybe this will help.

    EDIT: It works now after the following changes

    Change "%c%" with "%server_warnings[%t%]%"

    Put "If %server_warnings[%t%]% >= 3;TargetAction Kick %t% NO CRANE!" before
    "TargetAction Kill;Say ###### %t% NO CRANE, WARNING %server_warnings[%t%]%! ######"

    Add ";Say ###### %t% NO CRANE, WARNING %server_warnings[%t%]%! ######" at the end of
    "If %server_warnings[%t%]% >= 3;TargetAction Kick %t% NO CRANE!"

    End result:

    On Say;Admin;Text !w;TargetPlayer
    Incr %server_warnings[%t%]%
    If %server_warnings[%t%]% >= 3;TargetAction Kick %t% NO CRANE!;Say ###### %t% NO CRANE, WARNING %server_warnings[%t%]%! ######
    TargetAction Kill;Say ###### %t% NO CRANE, WARNING %server_warnings[%t%]%! ######

    Fully tested and worked perfectly! thx again for bringing me on the right path!
    Last edited by Smellblood95; 24-05-2015 at 18:00.

 

 

Posting Permissions

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