How to calculate ratio ?
#1

Hello, i don't know calculate player kills/deaths ratio with PVar.

Float:GetPVarInt(playerid, "Kills") / Float:GetPVarInt(playerid, "Deaths")

This value is 0
Reply
#2

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);
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
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);
This doesn't work. Valu is 0. My Stats is: Kills 198, deaths 200.
Reply
#4

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);
Reply
#5

Quote:
Originally Posted by kurta999
Посмотреть сообщение
This doesn't work. Valu is 0. My Stats is: Kills 198, deaths 200.
Shows 0.99
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)