![]() |
|
[Pawn] How do I get a percentage? - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) +--- Thread: [Pawn] How do I get a percentage? (/showthread.php?tid=1377) |
How do I get a percentage? - Ryder Sixz - 2020-11-25 Hello, I would like to know how to get the percentage of a figure, so far I have tried this: Code: new percentage1 = 10;
new percentage2 = 8000;
CMD:cent(playerid, params[])
{
? ? new string[256];
? ? format(string, sizeof(string), "The result was %d", percentage1%percentage2);
? ? SendClientMessage(playerid,-1,string);
? ? return 1;
}but it does not work (it gives me the figure of 10). Does anyone know how to do it correctly? thanks! RE: How do I get a percentage? - Pinch - 2020-11-25 (percentage2 * percentage1) / 100 RE: How do I get a percentage? - Ryder Sixz - 2020-11-25 (2020-11-25, 07:40 PM)Pinch Wrote: (percentage2 * percentage1) / 100 Excellent thanks! RE: How do I get a percentage? - Awide - 2020-11-25 100/full*amount |