I'm not sure how you put them in jail...
It is very simple though. In the trigger that you use to put the units in jail put this right after you put the unit in jail.
-
Set jailCounter = jailCounter + 1
In the trigger you use to take the units out of jail do this right after you take the unit out.
-
Set jailCounter = jailCounter - 1
In a periodic trigger to give the players money do this.
-
Set tempInt = jailCounter x 10
Then do add tempInt to current players gold.