04.01.2017, 12:28
How can I make two options but one have 10% chance to succes and other one has 90%?
new rand = random(11); //random 11 because it will only have 10 numbers.
if(rand == 1) //if the random result is 1 or what ever number you like
{
//Do some thing here
}
new luck = random(9), panels, doors, lights, tires; if(luck == 0) { SendClientMessage(playerid, COLOR_WHITE, "Ai umflat roata prea mult si aceasta a explodat."); } else if(luck > 0) { vehicle = GetPlayerVehicleID(playerid); GetVehicleDamageStatus(vehicle, panels, doors, lights, tires); UpdateVehicleDamageStatus(vehicle, panels, doors, lights, 15); }
Make random of 10 numbers and in the if statement check only 1 number like this
PHP код:
EDIT: Marcel was fast |