19.07.2011, 17:05
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new name[MAX_PLAYER_NAME];
new string[256];
new deathreason[20];
GetPlayerName(playerid, name, sizeof(name));
GetWeaponName(reason, deathreason, 20);
if (killerid == INVALID_PLAYER_ID)
{
switch (reason)
{
case WEAPON_DROWN:
{
format(string, sizeof(string), "*** %s drowned.)", name);
}
default:
{
if (strlen(deathreason) > 0)
{
format(string, sizeof(string), "*** %s died. (%s)", name, deathreason);
}
else
{
format(string, sizeof(string), "*** %s died.", name);
}
}
}
}
else
{
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
if (strlen(deathreason) > 0)
{
format(string, sizeof(string), "*** %s killed %s. (%s)", killer, name, deathreason);
}
else
{
format(string, sizeof(string), "*** %s killed %s.", killer, name);
}
SendClientMessageToAll(-1, string);
}
return 1;
}