percentage function
#1

I wanted to make a function that when called her, she calculated a random number of 100%

Ai would fall 1%, 10%, 40%, and always falling larger numbers, I do not know what I did wrong, but always falls 12:10!

pawn Код:
public TestePCT(playerid) {
    new Float: p =  float(random(1000)/ 1000 * 100);

    if(p <= 0.10)
    {
        SendClientMessage(playerid, -1, "0.10");
    }
    else if(p <= 1.90)
    {
        SendClientMessage(playerid, -1, "1.90");
    }
    else if(p <= 3.00)
    {
        SendClientMessage(playerid, -1, "3");
    }
    else if(p <= 5.00)
    {
        SendClientMessage(playerid, -1, "5");
    }
    else if(p <= 10.00)
    {
        SendClientMessage(playerid, -1, "10");
    }
    else if(p <= 15.00)
    {
        SendClientMessage(playerid, -1, "15");
    }
    else if(p <= 25.00)
    {
        SendClientMessage(playerid, -1, "25");
    }
    else if(p <= 40.00)
    {
        SendClientMessage(playerid, -1, "40");
    }
    return 1;
}
Reply


Messages In This Thread
percentage function - by pedrotvr - 31.12.2014, 14:32
Re: percentage function - by rickisme - 31.12.2014, 14:45
AW: percentage function - by Nero_3D - 31.12.2014, 16:01

Forum Jump:


Users browsing this thread: 1 Guest(s)