Hello, i'm a beginner in scripting, just gaving myself some stuff for training and im struggling with this one,
_unitwep = player;
bulletinair = false;
bulletinairpos = [];
_unitwep addeventhandler ["Fired",
{
_this spawn {
_unit = player;
if (!bulletinair) then {
bulletinair = true;
_bullet = _this select 6;
_pos = getPosATL _bullet;
while {alive _bullet} do {_pos = getPosATL _bullet; bulletinairpos = getposATL _bullet};
_roundpos = [(round (_pos select 0)),(round (_pos select 1)),(round (getposATL _bullet select 2))];
_null = (_pos select 0) + (_pos select 1) + (_pos select 2);
if (_null == 0) then {hint format ["Error: pos = %1",_pos]} else {_unit setpos [_pos select 0, _pos select 1,0.5]; hint format ["Teleported to: %1",_roundpos]};
waitUntil {!alive _bullet};
bulletinair = false;
bulletinairpos = [];
} else {hint format ["Wait for bullet to hit the ground, its %1M from the ground",(round (bulletinairpos select 2))]};
};
}];
It teleports you where ever you shoot, the problem is i just dont know how to rebuild it so it will teleport everyone where i shoot and it doesnt mean the bullet has to land, i was thinking about such a sleep like 0.5 after i shoot there all players would be telerported including me. Its just for training purpose, i tried myself to remake it with no success