Muzzle flashes are displayed using events 5001 (attachment 0), 5011 (attachment 1), 5021 (attachment 2), 5031 (attachment 3).
The muzzleflash to use is determined by the event options. 0 uses muzzleflash1.spr, 1 uses muzzleflash2.spr, 2 uses muzzleflash3.spr.
The option value is moduled twice: first by 10 and then by 3, in effect constraining the value to [ -2, 2 ]. It can be negative because performing modulo on negative values produces negative values. So make sure you never use negative values there.
The scale of the sprite is encoded in the option as well. The scale is value / 10 * 0.1, so a value of 10 uses muzzleflash1.spr:
10 % 10 = 0
0 % 3 = 0
scale = 10 / 10 = 1
A value of 11 would be scale 1, muzzleflash2.spr:
11 % 10 = 1
1 % 3 = 1
11 / 10 = 1
So as a rule of thumb:
Scale * 10 + muzzleflash
So if you want a scale of 3, muzzleflash2.spr:
3 * 10 + 1 = 31
31 % 10 = 1
1 % 3 = 1
31 / 10 = 3
Scale can only be a whole number because it's converted to an integer, see R_MuzzleFlash for the function that is used. You should also be able to find the code that handles the events and passes them into R_MuzzleFlash in entity.cpp, function HUD_StudioEvent.