PDA

View Full Version : K/D Ratio



buLLeT_
11th June 2018, 11:06
https://image.ibb.co/gjPqoT/Untitled.png (https://imgbb.com/)

Is it possible to delete the last 4 numbers?

To display only 0.30....
I tried this way https://killtube.org/showthread.php?1766-Subtract-text-from-variable&highlight=getSubStr
but it does not work


if(self.pers["die"] == 0)
self.kdratio = self.pers["kills"] / 1;
else if(self.pers["die"] == 1)
self.kdratio = self.pers["kills"] / 1.5;
else
self.kdratio = self.pers["kills"] / self.pers["die"];

self.kdratiohud setValue(self.kdratio);

vanfreddy
11th June 2018, 14:39
try this
iprintlnbold("\n *** Test:"+getSubStr( (3/11) , 0 , 3 ));

u should also add a check if its greater then 10 or 100 and then increase the endindex

end = 3;

if (kd >= 10) end = 4;
elseif (kd >= 100) end = 5 ;

IzNoGoD
11th June 2018, 16:49
iprintlnbold(int(kdratio*100)/100);

buLLeT_
12th June 2018, 11:08
iprintlnbold(int(kdratio*100)/100);
It works :)


problem with headshots doesn't work

https://www.youtube.com/watch?v=-4XwJQq9-EI


no errors with developer 1

maxdamage99
12th June 2018, 18:21
very ez method (maybe no work :D):


/*
kda - your var with 0.302564
*/

final_kda = "";
temp = ""+kda;

for (i = 0; i < 3; i++)
final_kda+=temp[i];

/*
final_kda - var with 0.30;
*/