SA-MP Forums Archive
Problem in stock.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem in stock.. (/showthread.php?tid=532169)



Problem in stock.. - RedSnow - 16.08.2014

plz help..
Код:
stock PercentsFromNumber(number,percents)
{
        if(percents > 100) return 0;
        new string[30];
        format(string,30,"%d.%d",number/100,number%100);
        new result = floatstr(string)*percents;
        return result;
}



Re: Problem in stock.. - Dignity - 16.08.2014

So, what is the problem?


Re: Problem in stock.. - Vince - 16.08.2014

That seems like a really bloated way to do it.
pawn Код:
stock Float:PercentsFromNumber(number, percents)
    return float(number) * (float(percents) / 100.0);



Re: Problem in stock.. - RedSnow - 16.08.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
That seems like a really bloated way to do it.
pawn Код:
stock Float:PercentsFromNumber(number, percents)
    return float(number) * (float(percents) / 100.0);
ty bro
changed it to int with floatround.