Jump to content
  • 0

Server Side Custom Script - Check Players Position


Donnovan

Question

I will try to make a server side script that check all players position each second and make a alert or, preferably, disconnect player that moved more than 100 m in a second.

 

1) But how i access the "player" object for each player in the server?

 

2) Also, how can i disconnect a player?

 

Thanks in advance!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Raymix, about endMission, how can i do it for a specific player, from server side?

Since there is no parameter to specify the player unit, can't see another way other than execute it localy, on the mission folder, for the player i want to send to the lobby.

Link to comment
Share on other sites

  • 0

Thanks raymix, i apreciate, but seens its local, i will take a better look.
 
Already did the code but not tested it, and to gain me some more motivation i will post it here. My lovely lovely small code.

 

Intended to be server side. It check players average speed each second and kill who had more than 120 meters/second average speed.
 

_don_max_speed = 120 //Max speed in meters per second
_don_admins = ["123456789","987654321","192837465","564738291"];

while {true} do {
	don_ah_units = playableUnits;
	sleep 1;
	don_ah_units_pos = playableUnits;
	
	for "_up" from 0 to count don_ah_units_pos do {
		for "_u" from 0 to count don_ah_units do {
			if ((don_ah_units_pos select _up) !in _don_admins) && isPlayer (don_ah_units_pos select _up) && (don_ah_units_pos select _up) == (don_ah_units select _u)) then {
				_don_travel_m = (don_ah_units_pos select _up) distance (don_ah_units select _u); //distance moved in 1 second (see "sleep 1;" on line 6)
				if (_don_travel_m > _don_max_speed) then {
					(don_ah_units_pos select _up) setDamage 1.0;
				};
			};
		};
	};
};
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...