#1

Hello, I was wondering how would I make a kill death ratio(k/d) for my stats, if you know how please show me, thank you!
Reply
#2

kill/deaths
(divide)
literally
Reply
#3

pawn Код:
new totalkills, totaldeaths, Float:kdratio;
@OnPlayerDeath update the kills and deaths accordingly:
pawn Код:
totalkills++; totaldeaths++;
To calculate the ratio, just divide the kills with the deaths.
pawn Код:
kdratio = floatdiv(totalkills, totaldeaths);
Reply
#4

@Schneider, You do know that this is the same as using ' / ' (refering to floatdiv)
Reply
#5

@Kaperstone: I know I'm not the best scripter out here, but I tested both ways but using '/' didn't work.

I've put this under main()
pawn Код:
new kills = 50, deaths = 100, Float:kdratio1, Float:kdratio2;
kdratio1 = kills/deaths;
kdratio2 = floatdiv(kills, deaths);
printf("KD1: %.2f", kdratio1);
printf("KD2: %.2f", kdratio2);
Result:
KD1: 0.00
KD2: 0.50

So floatdiv is working, but '/' does not.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)