ratio td once again not working ! - 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)
+--- Thread: ratio td once again not working ! (
/showthread.php?tid=648851)
ratio td once again not working ! -
wallen - 29.01.2018
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
Re: ratio td once again not working ! -
Mugala - 29.01.2018
place ints into the float first.
you can find usage here -
https://sampwiki.blast.hk/wiki/Float
Re: ratio td once again not working ! -
wallen - 30.01.2018
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?
Re: ratio td once again not working ! -
ISmokezU - 30.01.2018
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(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);
Re: ratio td once again not working ! -
wallen - 30.01.2018
Okay, i will try that once ill get some testers cuz my mate is atm inactive.
Re: ratio td once again not working ! -
poxer - 30.01.2018
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);