Jump to content

[Release] VoN-Kick v0.1


Yurifag

Recommended Posts

VoN-Kick v0.1
 

What it does

VoN-Kick is a small script which kicks players to the server's lobby, if they talk on the side channel for too long.
 

Installation

Copy this script into a new .sqf file. You can name it however you want, "von_kick.sqf" for example.

private ["_seconds","_maxSeconds","_countdown"];

//CONFIG
_maxSeconds = 5; //how many seconds players can talk on side channel before they get kicked to lobby
_msg = "NO VOICE ON SIDE CHANNEL!"; //message to be displayed to the user
_countdown = true; //show countdown in chat
//CONFIG END

_seconds = 0;
while {true} do {
  waitUntil {(!isNull findDisplay 55) and (!isNull findDisplay 63) and (ctrlText ((findDisplay 63) displayCtrl 101) == localize "STR_SIDE_CHANNEL")};
  //wait until microphone icon is showing (IDD 55) and channel label is displayed (IDD 63) and channel label says "Side channel"
  
  cutText [_msg,"PLAIN"]; //notify user
  if(_countdown) then {
    systemChat format["Returning to lobby in: %1",_maxSeconds - _seconds]; //countdown in chat
  };
  
  if (_seconds >= _maxSeconds) then {
    endMission "LOSER"; //return to lobby
  };
  
  _seconds = _seconds + 1;
  sleep 1;
};

Place the file in your mission folder or any subdirectory of your mission folder.


Now add this line inside the "if (!isDedicated) then {" code block of your init.sqf:

[] execVM "path\to\von_kick.sqf";

Change the path to wherever you placed the von_kick.sqf.
That's all, you're done.
 

 

A small note from me

I'm pretty new to Arma's scripting language sqf, but I worked with other languages like Python, PHP and Javascript/Node.js before.

So I wanted to start with something small and since I haven't found a working script that simply kicks players when they talk on side channel I created my own.

I didn't really liked the solution of Infistar and many other user scripts, because mostly they all use an infinite while loop with a 1 second sleep timer that checks the VoN state each time.

It might not be much of a performance hit anyway, but I decided to use waitUntil {} to stop the thread's execution until the player starts talking on the side channel to save some resources and I want to share this script on here, because this forum already helped me greatly to get into this whole Arma 2 scripting stuff.

 

Also, this script doesn't really kick players, it's simply returning them to lobby. I might work on this script some time in the future and implement more features, but for now I just wanted to have something to stop these annoying players who constantly talk on side channel.

So I hope you can find any use for my script. Feel free to use this code or parts of it in your own project.

If you can't figure out how to install it or if something isn't working, just ask for help in this thread. I'll take a look into it.

Link to comment
Share on other sites

Thanks a lot for this.

A smal note:

sleep 1; actually sleeps for 1.03.

 

Not really a big matter tho, nobody will notice that!

 

Also, instead of running cutText five times, maybe put it outside the loop and uside PlainDown with a 5 secs timer :)

 

titleCut [_msg, "PLAIN DOWN", 5];
Link to comment
Share on other sites

you better read through the whole post ;)

 

A small note from me

...

I didn't really liked the solution of Infistar and many other user scripts, because mostly they all use an infinite while loop with a 1 second sleep timer that checks the VoN state each time.

It might not be much of a performance hit anyway, but I decided to use waitUntil {} to stop the thread's execution until the player starts talking on the side channel to save some resources and I want to share this script on here, because this forum already helped me greatly to get into this whole Arma 2 scripting stuff.

...

and not all owners use infistar 

Link to comment
Share on other sites

Thanks for your comments guys.

 

 

 

Thanks a lot for this.

A smal note:

sleep 1; actually sleeps for 1.03.

 

Not really a big matter tho, nobody will notice that!

 

Also, instead of running cutText five times, maybe put it outside the loop and uside PlainDown with a 5 secs timer :)

 

titleCut [_msg, "PLAIN DOWN", 5];

ok, nice to know that. I thought about using uiSleep instead of sleep as it's not based on frames and might be a bit more accurate I guess? Not like it really matters.

The third parameter of cutText/titleCut is actually not the time how long the text stays on the screen, but how long it takes for the text to fade in. So if I set 5 as third parameter it would take 5 seconds until the text has no transparency anymore. The default value is 1.

You might know that you can set the layer on which the text should be displayed. You just put a number before the cutText command. It seems like texts on the same layer get automatically overwritten if you show another text on the same layer. This creates a nice flashing effect that grabs the player's attention, because when the text has finished to fade in it displays a new one that also takes 1 second to fade in.

Also, I use "PLAIN" instead of "PLAIN DOWN", because I think it's better to have such a warning in the middle of the screen instead of the bottom.

 

 

This VON kick can be used to dupe.
change the endmission "LOOSER" to any public variable that isn't in your battleye filters. this will kick them back to the Multiplayer :)

I'm terribly sorry for this. As said I'm new to Arma scripting so I didn't think of that.

I can confirm that you can dublicate items by simply disconnecting from internet, putting items into storage, getting kicked by this script and reconnecting again.

Thanks for the advice to use battleye filters. I'll update the script tomorrow or later today maybe.

 

 

 

No need for this, Infistar has this covered.

you better read through the whole post ;)

and not all owners use infistar 

Of course many people have no use for this since their anticheat probably handles it for them. (I only used Infistar as an example, because it's so widely used.)

But I don't use Infistar and most other scripts I found hurt or killed the player which wasn't what I wanted. I know this script is only a small, simple snipped, but I thought sharing it might be a good idea.

Link to comment
Share on other sites

  • 3 weeks later...

I used something similar to this for a while,

Didn't stop people much. And had issues with people using it to bypass the anti-dupe. 

 

so then I modified mine to two warnings telling the player they would be killed

and then instead of end mission. 

 

player setDamage 5; 

 

added the battleye filter for it, and all of a sudden the von spam stopped.

 

i also use log this to rpt so i can deal with repeat offenders.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...