The onplayerkilled.sqs automatically gets passed a couple of arguements... as Grendel pointed out, (_this select 1) will give you the unit that killed the player.
So in my onplayerkilled.sqs, I used something like this:
killer = _this select 1
[player] join grpnull
0 fademusic 1
titletext ["","BLACK OUT", 3]
~4
playmusic "track10"
enableradio false
enableenddialog
titletext ["","BLACK IN", 1]
killer switchcamera "gunner"
killer addeventhandler ["Fired",{killer switchcamera "gunner"}]
#aliveloop
_now = _time
@ (_time > (_now + 10)) or (not (alive killer))
? not (alive killer): goto "kded"
killer switchcamera "external"
_now = _time
@ (_time > (_now + 5)) or (not (alive killer))
? not (alive killer): goto "kded"
? _time > 75: goto "notalive"
goto "aliveloop"
...
Basically, that detects if the killer still lives, and if so switches the camera to a view of their gunsights (killer switchcamera "gunner"). It will then wait 10 seconds, and switch camera to "external" (3rd person view). If they fire their weapon, it will switch back to gunsights, and wait 10 seconds.
There's also code in there that will trigger the rest of the death cutscene if the killer unit is killed (not much point staring at a dead guy the whole time
), but I omitted where it goes for clarity.
As for replacing the 'You are dead' text, it looks something like this:
[img removed]Suicourtmartial.jpg[/img]
With resources, you can set how transparent they are so the 'You are dead' doesn't show through even though it's still beneath the 'You have been Courtmartialled'.
To find out how to work custom resources, I suggest you take a look at a
dialog/resouce tutorial.
In a nutshell, what you need to do is create the picture you're going to use (I suggest create a tga and
convert it to .paa). Then you'll need to make an entry for it in your description.ext.
You can then call it from a trigger (under the 'effects' section), or from a script using cutrsc or titlersc.
Anyway, have a look through some tutorials and see how you go