Hi, I need help with one thing.
TriggerClientEvent(“pNotify:SendNotification”, source, {text = “” … " You caught a fish, weight is (random) kilos… " … “”,
How do I make it show a random number in a sentence?
Hi, I need help with one thing.
TriggerClientEvent(“pNotify:SendNotification”, source, {text = “” … " You caught a fish, weight is (random) kilos… " … “”,
How do I make it show a random number in a sentence?
use math.random to generate a random number.
So I should write
TriggerClientEvent(“pNotify:SendNotification”, source, {text = “” … " You caught a fish, weight is Math.floor(Math.random() * 10); kilos… " … “”,
If I’m right the sentence will show You caught a fish, weight is Math.floor(Math.random() * 10); kilos…
You can make it even easier rather than using Math.random() * 10
just use Math.random(lowerValue, maxValue)
and it will pick a number in between the lowerValue
and maxValue
.
Okay, so it will be for example You caught a fish, weight is 12 kilos
Feels like it will be like i wrote before