Help me plz :) rep
#1

Solved ----- Thanks deathtone
Reply
#2

First of all, your if statement will have times when it will never happen, because you are calling the random number generation function twice, so if it happens to pick the same number twice, neither of the if statements will occur. You can solve this by simply changing the structure a little bit.

pawn Код:
if(returnOddsResult(50)) // 50% chance to return true
{
    SetPlayerWantedLevel(playerid, 6);
    SendClientMessageToAll(AMARILLO, " Failed On Rob Bank.");
}
else
{
    SetPlayerWantedLevel(playerid, 6);
    SendClientMessageToAll(AMARILLO, " CRIME COMMITED (ROBBING BANK) STAY ON THE CHECKPOINT.");
}
As for the robbery function itself, you're not even using the min/max parameters so you might as well get rid of them in this case. You should make a better function altogether for generation random odds, for example:

pawn Код:
returnOddsResult(amount)
{
    if(random(100) >= (100 - amount)) return true;
    return false;
}
Then you can adapt it anyway you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)