So I'm currently working on a lucky plugin for someone, and I was wondering If it would be possible to take a percanteage(or a number) from the config and that's the chance of code executing. Would it be possible?
yes, you can use PHP: mt_rand(1, 100); as 1% to 100%, then check if rand result is less than or equal to the number on the config
Equate it to 100 PHP: if(mt_rand(percentage, 100) === 100) But this wont work with floating percentages as you can already tell.