public OnPlayerDeath(playerid, killerid, reason) - 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: public OnPlayerDeath(playerid, killerid, reason) (
/showthread.php?tid=659073)
public OnPlayerDeath(playerid, killerid, reason) -
Zeus666 - 22.09.2018
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
if(!IsPlayerNPC(playerid))
{
new name[24], kname[30], string[64];
GetPlayerName(playerid, name, 24);
GetPlayerName(killerid, kname, 30);
format(string, sizeof(string), "%s has been killed by %s with weapon: %s", name,kname,reason);
SendMessageToAllAdmins(string, -1);
But at weapon name it shows "t"
Re: public OnPlayerDeath(playerid, killerid, reason) -
solstice_ - 22.09.2018
Reason is the reason of death. example died from falling etc, not the name of the weapon
Re: public OnPlayerDeath(playerid, killerid, reason) -
VVWVV - 22.09.2018
The reason isn't an array. You need use
GetWeaponName to get weapon name.
Re: public OnPlayerDeath(playerid, killerid, reason) -
v1k1nG - 22.09.2018
Reason is an integer you were printing a string.
You need to check if the player died by fall/fire/drown etc aka killerid = INVALID_PLAYER_ID.
Otherwise if player died by a weapon just get the weapon name.
Re: public OnPlayerDeath(playerid, killerid, reason) -
TheToretto - 23.09.2018
You should assign manually the weaponid it's name, and that by using a list.