15.09.2013, 16:48
I thought I replied to your previous thread, but it got deleted? Anyways, you need to check if the killer is valid to use it as index (in arrays, otherwise it will crash your server). Also, to insert a string into format you need to use %s. You used %d which is for integers.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[playerid][pDeaths]++;
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][pKills]++;
new wstring[128], aname[MAX_PLAYER_NAME], dname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(killerid, dname, sizeof(dname));
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
format(wstring,sizeof(wstring),"~g~ You killed %s !",aname);
GameTextForPlayer(killerid, wstring, 2000, 5);
format(wstring,sizeof(wstring),"~r~ %s killed you !",dname);
GameTextForPlayer(playerid, wstring, 2000, 5);
}
return 1;
}

