Put this in Mafia's /scripts folder, and call it either from the gCLI by typing "call d12.ash" or from the Scripts menu.
Mafia will ask you to input a value for num_dice (enter the number of dice to throw), then it will ask a value for num_rolls (enter the number of times you want to throw the dice).
As a bonus, it will stop if you get the bullseye.
For your information, I copied the code posted by Veracity that Theraze linked to, modified it slightly so you could specify the number of throws, and saved it in a .ash file with notepad.