2016-07-24 08:09:11 +00:00
|
|
|
waitUntil {!(isNil "missionInitComplete")};
|
2016-07-24 09:34:55 +00:00
|
|
|
diag_log format["initPlayer called, _this: %1", _this];
|
2016-07-24 07:57:58 +00:00
|
|
|
|
2016-07-24 08:09:11 +00:00
|
|
|
_target = _this select 0;
|
|
|
|
_playerno = _this select 1;
|
2016-07-24 10:39:43 +00:00
|
|
|
|
2016-07-24 12:09:54 +00:00
|
|
|
_killhandler = compile(format["{Null = [_this, %1] execVM 'playerkilled.sqf';}", _playerno]);
|
|
|
|
_spawnhandler = compile(format["{Null = [_this, %1] execVM 'playerspawn.sqf';}", _playerno]);
|
2016-07-24 11:27:00 +00:00
|
|
|
|
2016-07-24 12:09:54 +00:00
|
|
|
// To pass the _playerno we must compile the value into the expression instead of passing variable as pointer
|
2016-07-24 12:38:12 +00:00
|
|
|
//_target addEventHandler ["Killed", call _killhandler];
|
2016-07-24 12:09:54 +00:00
|
|
|
_target addMPEventHandler ["MPKilled", call _killhandler];
|
2016-07-24 12:38:12 +00:00
|
|
|
//_target addEventHandler ["Respawn", call _spawnhandler];
|
2016-07-24 12:09:54 +00:00
|
|
|
_target addMPEventHandler ["MPRespawn", call _spawnhandler];
|
2016-07-24 09:11:48 +00:00
|
|
|
|
2016-07-24 12:09:54 +00:00
|
|
|
[[_target], _playerno] execVM "playerspawn.sqf";
|