Jump to content
Sign in to follow this  
PH CWB

[QUESTION] Why does this code crash my mp server?

Recommended Posts

Hello everyone,

 

This code below used to work back in the days (I'm about two years without login in, so perhaps some things have changed?):

 

waitUntil {!isNull player && alive player && {vehicle player != player}};
 
while {alive player} do {
    waitUntil {vehicle player != player};
    vehicle player addEventHandler ["IncomingMissile", {        params ["_target", "_ammo", "_vehicle"];
        [_target, "smokeLauncher"] call BIS_fnc_fire;
        private _newTarget = createVehicle [["laserTargetW","laserTargetE"] select (side _target getFriend WEST < 0.6),getpos _target vectorAdd [0,0,5],[],0,"can_collide"];
        private _missile = (getpos _vehicle nearestObject _ammo);
        [_target, [0,0,0]] remoteExec ["setVehicleTIPars",0];
        _missile setMissileTarget _newTarget;
        [_missile,_target,_newTarget] spawn {
            params ["_missile","_target","_newTarget"];
            while {!isNull _missile && alive _target} do {
                if (_missile distance _target < 150) then {deleteVehicle _missile};
            };
            deleteVehicle _newTarget;
        };
        [_target, "CMFlareLauncher"] remoteExec ["BIS_fnc_fire", 0];
        _missile setMissileTarget _newTarget;
    }];
 
    waitUntil {vehicle player == player};
    vehicle player removeEventHandler ["IncomingMissile", 0];
};

When I used it single player it still works though. But when in MP server with my friends, the server crashes when he hosts, when I'm hosting, it doesn't work but it also doesn't crash. In single player mode, it works just fine.
How can I make it so it would work in MP? 
Thanks in advnace.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×