make a variable "x" for example and store values in it..
for example if you sent creeps, then trigger it, if someone buys a creep you detect it and add +2 to the variable (add an array if you use it for more than 1 player -> x[1], x[2], and so on)
after that, just add property to players
Add x[1] to player 1 current gold
something like that, it's pretty simple