Death thing won't work - 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: Death thing won't work (
/showthread.php?tid=298115)
Death thing won't work -
Stefand - 19.11.2011
Hi users, scripters
i want to make a system if a player dies his name comes in the chat with died or something...
this is what i maked
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if (killerid == INVALID_PLAYER_ID) {
switch (reason) {
case WEAPON_DROWN:
{
format(string, sizeof(string), " %s drowned.)", playerid);
}
default:
{
if (strlen(deathreason) > 0) {
format(string, sizeof(string), " %s died. (%s)", playerid, deathreason);
} else {
format(string, sizeof(string), " %s died.", playerid);
}
}
}
}
else {
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
if (strlen(deathreason) > 0) {
format(string, sizeof(string), " %s killed %s. (%s)", killer, playerid, deathreason);
} else {
format(string, sizeof(string), " %s killed %s.", killer, playerid);
}
}
SendClientMessageToAll(COLOR_RED, string);
{
playercash = GetPlayerMoney(playerid);
if (playercash > 0)
{
GivePlayerMoney(killerid, playercash);
ResetPlayerMoney(playerid);
}
else
{
}
}
return 1;
}
but it won't work :S
Re: Death thing won't work -
Stefand - 19.11.2011
someone help?
Re: Death thing won't work -
DayaKisteme - 19.11.2011
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if (killerid == INVALID_PLAYER_ID)
{
switch (reason)
{
case WEAPON_DROWN:
{
format(string, sizeof(string), " %s drowned.)", playerid);
}
default:
{
if (strlen(deathreason) > 0)
{
format(string, sizeof(string), " %s died. (%s)", playerid, deathreason);
}
else
{
format(string, sizeof(string), " %s died.", playerid);
}
}
}
}
else
{
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
if (strlen(deathreason) > 0)
{
format(string, sizeof(string), " %s killed %s. (%s)", killer, playerid, deathreason);
}
else
{
format(string, sizeof(string), " %s killed %s.", killer, playerid);
}
}
SendClientMessageToAll(COLOR_RED, string);
playercash = GetPlayerMoney(playerid);
if (playercash > 0)
{
GivePlayerMoney(killerid, playercash);
ResetPlayerMoney(playerid);
}
return 1;
}
Re: Death thing won't work -
Stefand - 19.11.2011
doesn't work
Re: Death thing won't work -
Wesley221 - 19.11.2011
https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/SetPlayerName
First give it a try yourself, if it didnt work post the code you have
Re: Death thing won't work -
Chrillzen - 19.11.2011
Post errors.