ratio td once again not working !
#1

I did that on OnPlayerDeath

Код:
	// Kills Deaths & Ratio TD.
	PlayerKills[killerid]++; // Addes a score to player killed.
	PlayerDeaths[playerid]++; // Addes a score to player death.
	new iString[100]; // string cells.
	new Float:ratio = PlayerKills[playerid]/PlayerDeaths[playerid];
	format(iString, sizeof iString, "Kills: %i", PlayerKills[killerid]); // Here we put the amout of Killed players.
	TextDrawSetString(KILLS[killerid], iString);
	format(iString, sizeof iString, "Deaths: %i", PlayerDeaths[playerid]); // Here we put the amout of Deaths.
	TextDrawSetString(DEATHS[playerid], iString);
	format( iString, sizeof( iString ), "Ratio: %.2f", ratio);
	TextDrawSetString(RATIO[playerid], iString);
https://i.imgur.com/ishmaxh.png
Reply
#2

place ints into the float first.
you can find usage here - https://sampwiki.blast.hk/wiki/Float
Reply
#3

new Float:ratio = PlayerKills[playerid]/PlayerDeaths[playerid];

thats the float i used or its not used good? anyone here doesnt know how to make that shit fixed?
Reply
#4

Debug your code, print your results.

PHP код:

    PlayerKills
[killerid]++; // Addes a score to player killed.
        
printf("Kills: %i"PlayerKills[killerid]);

    
PlayerDeaths[playerid]++; // Addes a score to player death.
        
printf("Deaths: %i"PlayerDeaths[playerid]);

    new 
iString[100]; // string cells.
    
new ratio PlayerKills[playerid] / PlayerDeaths[playerid];
        
printf("Ratio: %i"ratio);

    
format(iStringsizeof iString"Kills: %i"PlayerKills[killerid]); // Here we put the amout of Killed players.
    
TextDrawSetString(KILLS[killerid], iString);

    
format(iStringsizeof iString"Deaths: %i"PlayerDeaths[playerid]); // Here we put the amout of Deaths.
    
TextDrawSetString(DEATHS[playerid], iString);

    
formatiStringsizeofiString ), "Ratio: %.2f"ratio);
    
TextDrawSetString(RATIO[playerid], iString); 
Reply
#5

Okay, i will try that once ill get some testers cuz my mate is atm inactive.
Reply
#6

Change this:

Код:
	
	format( iString, sizeof( iString ), "Ratio: %.2f", ratio);
	TextDrawSetString(RATIO[playerid], iString);
For this:

Код:
	
	format( iString, sizeof( iString ), "Ratio: %.2f", floatdiv(PlayerKills[playerid], PlayerDeaths[playerid]));
	TextDrawSetString(RATIO[playerid], iString);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)