I am trying to add a capability to my event addon where by the player can get a random ammount of money between 2 numbers, the way i have done this is using math.random but
i am then confronted with the issue of being able to figure out how much was picked up so i can notify the player of how much they have found.
Here is what i have:
if activator:IsPlayer() then activator:addMoney(math.random(25,5000)) activator:EmitSound("npc/crow/alert2.wav",self:GetPos()) DarkRP.notify(activator, 1, 4, "You have found ".. GAMEMODE.Config.currency .. math.random(25,5000) .."!") end
Edit: Just figured it out myself, but for anyone who is in this situation like i was just make a local variable using math.random then call them both and you’ll get the same result
local pickedAmmount = math.random(MoneyMin,MoneyMax)
then i called it like this:
addMoney(pickedAmmount) DarkRP.notify(activator, 1, 4, "You have found ".. GAMEMODE.Config.currency .. pickedAmmount .."!")