Hi!
We have a semi-Public Antistasi Server and some of the people think, shooting through the bottom of an APC or Tank is fun to capture it. We have rules but there isn't everytime someone around to check if they "legally" obtained it or not. I also searched for some scripts or mods that help with this problem but I couldn't find a single one that would prevent this (how is that not a problem someone already fixed?)
I now wanted to create a serverside mod that adds an EventHandler to all players, because I can't edit the mission itself (and don't want to because of updates etc).
My initial code looks like this:
_firedHandler = {
_player = _x;
_position = eyePos _player;
_positionAbove = _position + [0, 0, 1];
_objects = lineIntersectsWith [_position, _positionAbove];
{
if ((_x isKindOf "APC" || _x isKindOf "Tank")) then {
_player setPos (_position + [1, 0, 0]);
};
} forEach _objects;
};
if(isPlayer _x) then {_x addEventHandler ["Fired", _firedHandler];} forEach allPlayers;
but I can't figure out how this can work on a dedicated server. I have almost zero knowledge in coding and just googled the most of it and used the wiki. Other solutions or directions how this could be archived are welcome
It would be very helpful if someone could help me out. I can't understand how to make this work :(