SA-MP Forums Archive
OnPlayerDeath - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerDeath (/showthread.php?tid=107179)



OnPlayerDeath - BP13 - 08.11.2009

Something weird with this. It should say the message according to the every 5 kills. But it will say it 5 times before it switches to the other one. Also since this the kills on the kill list are showing except for the Suicide picture. The Code:


pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  KILLINGSPREE[killerid]++;
    if(KILLINGSPREE[killerid] >= 5)
    {
        new string [128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid, pName, sizeof(pName));
        format(string, sizeof(string), "%s is on a killing spree!", pName);
        GameTextForAll(string, 5000, 1);
        PlayerPlaySound(killerid, 1062, -1370.2362, -256.3250, 14.1440);
        SetTimerEx("MUSICTIMER",8000,1, "i", killerid);
    }
    if(KILLINGSPREE[killerid] >= 10)
    {
        new string [128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid, pName, sizeof(pName));
        format(string, sizeof(string), "~b~%s is dominating!", pName);
        GameTextForAll(string, 5000, 1);
        PlayerPlaySound(killerid, 1062, -1370.2362, -256.3250, 14.1440);
        SetTimerEx("MUSICTIMER",8000,1, "i", killerid);
    }
    if(KILLINGSPREE[killerid] >= 15)
    {
        new string [128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid, pName, sizeof(pName));
        format(string, sizeof(string), "~g~%s is dominating!", pName);
        GameTextForAll(string, 5000, 1);
        PlayerPlaySound(killerid, 1062, -1370.2362, -256.3250, 14.1440);
        SetTimerEx("MUSICTIMER",8000,1, "i", killerid);
    }
    if(KILLINGSPREE[killerid] >= 20)
    {
        new string [128];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid, pName, sizeof(pName));
        format(string, sizeof(string), "~g~%s is ~u~God like!~u~", pName);
        GameTextForAll(string, 5000, 1);
        PlayerPlaySound(killerid, 1097, -1370.2362, -256.3250, 14.1440);
        SetTimerEx("MUSICTIMER",8000,1, "i", killerid);
    }
    if(PlayerIsInDM[playerid] == true)
    {
      SendClientMessage(playerid, COLOR_LIGHTBLUE, "You haved died in a deathmatch and your random spawning has been disabled.");
      SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /random to re enable it");
        RANDOM[playerid] = false;
    }
    if(PlayerIsInDM[playerid] == false)
    {
        RANDOM[playerid] = true;
    }
    if(killerid != INVALID_PLAYER_ID)
    {
      GivePlayerMoney(killerid, GetPlayerMoney(killerid) + 50);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    KILLINGSPREE[playerid] = 0;
    SetPlayerWantedLevel(playerid, 0);
    SendDeathMessage(killerid, playerid, reason);
  return 1;
}
EDIT: Yet in my test server it worked fine with me and 1 other person testing.


Re: OnPlayerDeath - member - 08.11.2009

You need to change:

Код:
>=
to
Код:
==



Re: OnPlayerDeath - BP13 - 09.11.2009

ok that might work. i have not tested it yet. Anywayse its still not showing the suicide icon when you suicide. I have this as you can see.

SendDeathMessage(killerid, playerid, reason);


Re: OnPlayerDeath - StrickenKid - 09.11.2009

use "else if" for every if after the first one, if you don't, lets say their killing spree var is at 15, it would so 5,10, and 15....

edit: actually, just use switch, its much better and more sexier.