Hitmarker display when hit

How do i make a script when the player shoots an enemy and when he gets the hit it shows a cross in the middle of the screen which is a hit marker like call of duty how do i do that?

Assuming you already have a working gun you can add the properties lastHitTime and hitDisplayDuration. Then every time a shot hits a target, update this to the current time (Time.time)

Now add an OnGUI function and use a GUITexture to render your crosshair/skull/hit icon if (Time.time - lastHitTime < hitDisplayDuration)

You could make it fade out using something like Mathf.Max(0, (hitDisplayDuration - (Time.time - lastHitTime)) / hitDisplayDuration) to get the alpha for the texture