There you go:
/*
killLegs.sqf
by Deadfast
Spawn a bullet at unit's legs to render it unable to walk.
SYNTAX: [unit name] execVM "killLegs.sqf"
*/
_unit = _this select 0;
if ((!canStand _unit) || (!alive _unit)) exitWith {}; //unit has damaged legs already or is dead
_i = 0;
while {(canStand _unit) && (_i < 20)} do
{
_pos = _unit ModelToWorld [0.2, -1, 0.01];
_dir = direction _unit;
_bullet = "B_556x45_SD" createVehicleLocal _pos;
_bullet setVelocity [(sin _dir*100),(cos _dir*100),0];
_i = _i + 1;
sleep 0.1;
};
A little disclaimer: script doesn't work if the unit is moving or if the unit is human and is prone (works fine with AI). I'll take a look into it.