19.01.2016, 08:26
For example if a player has in his file: Luck=10 then the random will be 10% of success.
how can i do this?
how can i do this?
new PlayerLuck[playerid]; // <------- Variable that player's luck stored in.
new rand = random(100);
if(0 <= rand && rand <= PlayerLuck[playerid]) return ... //> Success
else if(rand > PlayerLuck[playerid]) return ... //> Fail
new PlayerLuck[playerid]; // <------- Variable that player's luck stored in.
if(random(100) < PlayerLuck[playerid])
//> Success (random gives a value from 0 to 9)
else
//> Fail (random gives a value from 10 to 99)
stock bool:IsDropAllow(chance){
if(chance <= 0) return false;
if(chance >= 100) return true;
if((random(100)+1) <= chance) return true;
return false;
}