30.07.2011, 22:34
(
Последний раз редактировалось dowster; 30.07.2011 в 23:45.
)
To save others time, and for personal use i created an array of all the deathreasons 0 - 255. The lines that say invalid are for the reason numbers that aren't used, and are basically just placeholders, 255 is a vehicle explosion, this occurs when standing next to an exploding vehicle or inside an exploding vehicle. 200 and 201 are connect/disconnect, and the lower numbers are from weapons. An example of the usage for this would be:
feel free to use the above example if you want, but you must place my name in the credits somewhere in your script.
All you need to do is
at the top of your script and it should work.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[96], deadplayer[MAX_PLAYER_NAME], killer[MAX_PLAYER_NAME], hour, minute, second, year, month, day, Float:x, Float:y, Float:z, chospital, Float:sdistance;
gettime( hour, minute, second);
getdate( year, month, day);
GetPlayerName( playerid, deadplayer, sizeof(deadplayer));
if (IsPlayerConnected(killerid))
{
GetPlayerName( killerid, killer, sizeof(killer));
format(string, sizeof(string), "[%s %i, %i] - [%i:%i:%i] - %s killed %s, with a %s\r\n", Months[month], day, year, hour, minute, second, killer, deadplayer, DeathReason[reason]);
}
else
{
format(string, sizeof(string), "[%s %i, %i] - [%i:%i:%i] - %s has died from %s\r\n", Months[month], day, year, hour, minute, second, deadplayer, DeathReason[reason]);
}
SendClientMessageToAll( COLOR_RED, string);
new File:deathlog = fopen("Logs/Death Log.txt", io_append);
fwrite(deathlog, string);
fclose(deathlog);
return 1;
}
All you need to do is
pawn Код:
#include <deathreasons>