13.04.2015, 09:40
Hybris' code can be simplified to this:
Code:
public OnPlayerDeath(playerid, killerid, reason) { new string[145], fName[MAX_PLAYER_NAME]; GetPlayerName(playerid,fName,MAX_PLAYER_NAME); if (killerid != INVALID_PLAYER_ID) { switch (reason) { case 1: format(string, sizeof(string), "Player %s died. (Drowned)", fName); case 2: format(string, sizeof(string), "Player %s died. (Collision)", fName); default: format(string, sizeof(string), "Player %s died.", fName); } } else { new sName[MAX_PLAYER_NAME], gunname[32]; GetWeaponName(reason,gunname,sizeof gunname); GetPlayerName(killerid,sName,MAX_PLAYER_NAME); format(string,sizeof string,"%s has been killed by %s with %s",fName,sName,gunname); } SendClientMessageToAll(COLOR_RED,string); GameTextForPlayer(playerid, "~r~Wasted", 5000, 6); SendDeathMessage(killerid, playerid, reason); return 1; }