Cheers Spooner, i would like to use a "respawn with what you had when you died type script".
Something simple I whipped up a while back that I use very frequently (for "respawn with what you died with"-style) is this (untested in A2... but works a charm in A1 and there is no reason why it shouldn't work):
private ["_preventLooting", "_hideBodies", "_sWeaps", "_sMags", "_oldPlayer"];
_preventLooting = _this select 0;
_hideBodies = _this select 1;
while { true } do
{
waitUntil {not alive player};
// Save weapons
_sWeaps = weapons player;
_sMags = magazines player;
if(_preventLooting) then { removeAllWeapons player; };
// In case we need to delete the body on respawn
_oldPlayer = player;
waitUntil {alive player};
// Hide body
if(_hideBodies) then { hideBody _oldPlayer; };
// Re-add weapons
removeAllWeapons player;
{ player addMagazine _x; } foreach _sMags;
{ player addWeapon _x; } foreach _sWeaps;
player selectWeapon (primaryWeapon player);
};
Call it as such (from init.sqf):
dummy = [true,true] execVM "respawnGear.sqf";
The first param. is whether to prevent looting by removing the weapons from the body when the player dies... this prevents getting more ammo simply by going back to your body.
The second param. is whether or not to hide the dead body when the player respawns. This can save some system resource if you have a lot of players dying repeatedly.
I set both params to true, most of the time, as I use this script in all of my squad's missions (to prevent us having to restart our rather long missions every time someone dies... but ensure that people still need to conserve ammo, etc. It's really only for 'accidental' deaths).