Death thing won't work
#1

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
Reply
#2

someone help?
Reply
#3

Код:
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;
}
Reply
#4

doesn't work
Reply
#5

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
Reply
#6

Post errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)