Well there are two ways to approach this. The first is to create a variable or line in a text file which will keep track of the number of tickets per nick or address. So for instance, if I buy 5 the first time, you create a variable or line in a file of "Martyr2 5" and then when I come and again (let's say 10 this time), you read the line for my given nick, read in the 5, subtract it from 10 and see that I can't buy 10 because that would be over the limit. Now if I bought only 2 the second time, you would read in the five, add the 2, see that is below my 10 limit and add the 2 to my nick in the file making it "Martyr2 7". Now obviously if the person changes their nick or address they would be allowed to buy more again.
A second less efficient choice would be to write my nick/address to a file 5 times. If I go to buy more again I would just count the number of times my nick is in your raffle.txt and subtract that from 10 to know if I can buy more.
Either way, you have to keep a running sum for each nick/address of how many tickets they have bought and are trying to buy now. That is all there is to it. :)