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



OnPlayerDeath on /stats - OMonger - 11.05.2015

Can someone help me with the on player death section? I have a /stats command that is meant to show the deaths but it doesn't! Please can you help?

OnPlayerDeath line:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
 	if(killerid != INVALID_PLAYER_ID)
    {
        PlayerInfo[killerid][pKills]++;
    }
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}
command(stats-... line:
Код:
command(stats, playerid, params[])
{
	new string[128];
	SendClientMessage(playerid, COLOR_ORANGE, ". : : Statistics : : .");
	format(string, sizeof(string), "| Cash: $%d | Kills: %dK | Deaths: %dD |", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
	SendClientMessage(playerid, SERVERCOLOR, string);
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		format(string, sizeof(string), "| Admin Level: %d | Helper Level: %d |", PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pHelper]);
		SendClientMessage(playerid, SERVERCOLOR, string);
	}
	return 1;
}



Re : OnPlayerDeath on /stats - StreetRP - 11.05.2015

printf(%d,PlayerInfo[playerid][pKills]);
and show the result plz


Re: Re : OnPlayerDeath on /stats - OMonger - 11.05.2015

Quote:
Originally Posted by StreetRP
Посмотреть сообщение
printf(%d,PlayerInfo[playerid][pKills]);
and show the result plz
The kills work. It's just the /stat's "Deaths" section.

Thanks.


Re : OnPlayerDeath on /stats - StreetRP - 11.05.2015

%dD change to %d Death


Re: OnPlayerDeath on /stats - Luis- - 11.05.2015

I'd recommend using brackets for the K / D part, like %d(K) & %d(D) cause the "%dD" thing could be affecting the output.