well, it just returns the index of the weapon you wanna buy ... actual buying has to be done elsewhere and since it's everywhere in CS the same, no need to post this here
nice idea to put the weapons prizes on a logarithmic scale and then select them via random function on this scale ... does that give good results ?
and why do you use this RANDOM_LONG with the prize ? I think one should avoid this here for the sake of clear code, since you already have a random function later on, so why here ?
the data structures to which the p points are updated when the actual weapon is bought ?