How to calculate ratio ? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to calculate ratio ? (
/showthread.php?tid=169750)
How to calculate ratio ? -
kurta999 - 20.08.2010
Hello, i don't know calculate player kills/deaths ratio with PVar.
Float:GetPVarInt(playerid, "Kills") / Float:GetPVarInt(playerid, "Deaths")
This value is 0
Re: How to calculate ratio ? -
Jefff - 20.08.2010
Wiki
https://sampwiki.blast.hk/wiki/File_Functions down
pawn Код:
new Float:ratio=floatdiv(PKills[playerid], PDeaths[playerid]);
format(str, 256, "%d %d %.2f", PKills[playerid], PDeaths[playerid], ratio);
Re: How to calculate ratio ? -
kurta999 - 20.08.2010
Quote:
Originally Posted by Jefff
|
This doesn't work. Valu is 0. My Stats is: Kills 198, deaths 200.
Re: How to calculate ratio ? -
Claude - 20.08.2010
pawn Код:
new Kills = GetPVarInt(playerid, "Kills"), Deaths = GetPVarInt(playerid, "Deaths");
format(string, 128, "Ratio: %0.2f", GetPVarInt(playerid, "Kills")/GetPVarInt(playerid, "Deaths"));
SendClientMessage(playerid, GREEN, string);
Re: How to calculate ratio ? -
Jefff - 20.08.2010
Quote:
Originally Posted by kurta999
This doesn't work. Valu is 0. My Stats is: Kills 198, deaths 200.
|
Shows 0.99