SA-MP Forums Archive
/stats - 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: /stats (/showthread.php?tid=606517)



/stats - TheSimpleGuy - 05.05.2016

Код:
CMD:stats(playerid, params[])
{
	new string1[256], string2[256];
	format(string1, sizeof(string1), ""COL_WHITE"Name: %s (%d) | $%d | Score: %d\n", GetName(playerid), playerid, GetPlayerMoney(playerid), GetPlayerScore(playerid));
	format(string2, sizeof(string2), "Kills: %d | Deaths: %d | K/D Ratio: %.1f\n", pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][Kills] / pInfo[playerid][Deaths]);
	strcat(string1, string2);
	format(string2, sizeof(string2), "Admin Level: %d | VIP Level: %d | Hours Played: %.2f", pInfo[playerid][AdminLevel], pInfo[playerid][VIPLevel], pInfo[playerid][HoursPlayed]);
	strcat(string1, string2);
	ShowPlayerDialog(playerid, d_stats, DIALOG_STYLE_MSGBOX, "Statistics", string1, "OK", "");
	return 1;
}
Returns 0 with me. d_stats is good.


Re: /stats - Dayrion - 05.05.2016

What is wrong here ?


Re: /stats - TheSimpleGuy - 05.05.2016

It returns 0 with me, which means "ERROR: command not found"


Re: /stats - Konstantinos - 05.05.2016

That is probably a Runtime error 11: "Divide by zero" on pInfo[playerid][Kills] / pInfo[playerid][Deaths]

You can load crashdetect for more information about crashes and run time errors. If that is the cause of it, then change to:
pawn Код:
floatdiv(pInfo[playerid][Kills], pInfo[playerid][Deaths])