I'm too lazy to make a code for you atm, so i'll quote flipside's guide. Like i said, the entity does not work properly right now.

Misc_TurretG2

Spawns a turret that will fire at a person

Spawnflags:

1 - Turret will start off and toggle turning on and off when used, requires the entity to have a targetname2 - Turret will be upside-down (with foot part on floor).4 - will respawn after being killed (use count)8 - Big-donkey, Boxy Death Star Turbo Laser version (yes this is a direct quote from ravensofts notes)16 - Turret will aim in front of the enemy, or lead the entity, increases chance to hit.32 - Turret will appear on radar.64 - Target Fighters (I Believe This Means Air Vehicles)128 - Target Ground Vehicles256 - Target Players Who Are Armed

Keys:

radius - Maximum distance of targeting enemies (default 512).wait - Time to wait between firing (default 150 ms).dmg - Damage per shot (default 5).health - Hit points of the turret (default 100).count - Time to wait before respawningpaintarget - In the words of Lugor: target to fire off upon being hurtpainwait - In the words of Lugor: ms to wait between firing off pain targetsrandom - Random value (in degrees) of aiming off target when firing at targets (default 2)shotspeed - Speed of the projectile the Turret fired (default is for 1100 regular Turrets, or 20000 for Turbo-Laser Turrets)splashDamage - How much the damage the explosion doessplashRadius - How far the explosion will reachtargetname - Name to be used if using a switch to activate or deactivate.target - Target to activate upon being destroyed (E.g. Opening a door when turret is destroyed)target2 - Target to activate upon firing at targetsshowhealth - Will show health when person aims at the turret, if this has the value "1"customscale - Custom scaling, 100 is default, 1024 is maximum, watch out with thisprofession - Will target only selected profesions (1 Jedi, 2 Merc, 4 Tech [Combainable])property - this entity will only work for people with access to the property set here