OnPlayerDeath
#1

Hi SA-MP Community,
I have a problem. When I kill a player it also kills me and all my weapons also go. On my re-spawn the weapons are vanished.
Help me
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{

        if(killerid == INVALID_PLAYER_ID) {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
        } else {
        if(gTeam[killerid] != gTeam[playerid]) {
            // Valid kill
            SendDeathMessage(killerid,playerid,reason);
            SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        } else {
            // Team kill
            SendDeathMessage(killerid,playerid,reason);
            SetPlayerHealth(killerid,-250);
            SendClientMessage(killerid,COLOR_BRIGHTRED,"You have killed your team mate and lost 25 HP due to depression of the tragic loss.");
            SendClientMessage(playerid,COLOR_BRIGHTRED,"You were killed by your own team mate! Maybe it was a mistake.");
        }
    }
        for(new i=0; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        new szString[128];
        new string[128];
        new pname[24];
        kills[killerid]++;
        format(szString,sizeof(szString),"Kills :%d",kills[killerid]);
        SendClientMessageToAll(playerid, string);
        TextDrawSetString(Kill_Streak[killerid],szString);
        SetPlayerScore(killerid,GetPlayerScore(killerid) +1);
        KSC1[playerid] = 0;
        NC[playerid] = 0;
        {
            if(GetPlayerScore(killerid) == 3)
            {
                GetPlayerName(killerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has killed 3 players in a row!", pname);
                SetPlayerScore(killerid, 1);
                GivePlayerMoney(killerid, 300);
                SendClientMessageToAll(COLOR_YELLOW, string);
                SendClientMessage(killerid,COLOR_BLUE,"You got +1 score and +$300 for killing 3 in a row");
                label3[playerid] = Create3DTextLabel("Got 3 kills", 0xE10000FF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label3[playerid], playerid, 0.0, 0.0, 0.7);
                return 1;
            }
            if(GetPlayerScore(killerid) == 5)
            {
                GetPlayerName(killerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has killed 5 players in a row!", pname);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid,500);
                SetPlayerScore(killerid,2);
                SendClientMessage(killerid,COLOR_BLUE,"You earned +2 score and +$500 for killing 5 in a row!");
                label5[playerid] = Create3DTextLabel("Got 5 kills", 0xE10000FF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label5[playerid], playerid, 0.0, 0.0, 0.7);
                return 1;
            }
            if(GetPlayerScore(killerid) == 10)
            {
                GetPlayerName(killerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has killed 10 players in a row!", pname);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid,1000);
                SetPlayerScore(killerid,5);
                SendClientMessage(killerid,COLOR_BLUE,"You earned +5 score and +$1000 for killing 10 in a row!");
                label7[playerid] = Create3DTextLabel("Got 10 kills", 0xE10000FF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label7[playerid], playerid, 0.0, 0.0, 0.7);
                return 1;
            }
            if(GetPlayerScore(killerid) == 15)
            {
                GetPlayerName(killerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has killed 15 players in a row!", pname);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid,1500);
                SetPlayerScore(killerid,8);
                SendClientMessage(killerid,COLOR_BLUE,"You earned +8 score and +$1500 for killing 15 in a row!");
                label13[playerid] = Create3DTextLabel("Got 13 kills", 0xE10000FF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label13[playerid], playerid, 0.0, 0.0, 0.7);
                return 1;
            }
            if(GetPlayerScore(killerid) == 25)
            {
                GetPlayerName(killerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has killed 25 players in a row!", pname);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid,2500);
                SetPlayerScore(killerid,15);
                SendClientMessage(killerid,COLOR_BLUE,"You earned +15 score and +$2500 for killing 25 in a row!");
                label20[playerid] = Create3DTextLabel("Got 25 kills", 0xE10000FF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label20[playerid], playerid, 0.0, 0.0, 0.7);
                return 1;
            }
            if(GetPlayerScore(killerid) == 30)
            {
                GetPlayerName(killerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has killed 30 players in a row!", pname);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid,3000);
                SetPlayerScore(killerid,18);
                SendClientMessage(killerid,COLOR_BLUE,"You earned +18 score and +$3000 for killing 30 in a row!");
                label30[playerid] = Create3DTextLabel("Got 30 kills", 0xE10000FF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label30[playerid], playerid, 0.0, 0.0, 0.7);
                SendClientMessage(playerid,0xE10000FF,"You can use /rocket and you will get 2 rackets from rocket launcher");
                return 1;
            }
        }
//===================KILLERID SECTION=====================//
        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        GivePlayerMoney(killerid, 500);
        SendClientMessage(killerid,COLOR_GREEN ,"You won ~b~+1 score for killing");
        SendClientMessage(killerid, COLOR_WHITE, "You won ~g~500$ for killing him");
    //===========PLAYERID SECTION=================//
        GivePlayerMoney(playerid, -500);
        SendClientMessage(playerid, COLOR_WHITE, "You lost ~r~-500$ for getting ~r~killed");
        ShowPlayerDialog(playerid, 500, DIALOG_STYLE_LIST, "Classes", "Assault\nSniper\nPilot\nEngineer\nFlameThrower\nDemolition", "Select", "Cancel");
        return 0;
    }
Reply


Messages In This Thread
OnPlayerDeath - by Faisal_khan - 16.03.2012, 13:37
Re: OnPlayerDeath - by GNGification - 16.03.2012, 13:49
Re: OnPlayerDeath - by Reklez - 16.03.2012, 13:59
Re: OnPlayerDeath - by Faisal_khan - 16.03.2012, 14:05
Re: OnPlayerDeath - by GNGification - 16.03.2012, 14:09
Re: OnPlayerDeath - by Faisal_khan - 16.03.2012, 14:12
Re: OnPlayerDeath - by Reklez - 16.03.2012, 14:13
Re: OnPlayerDeath - by Faisal_khan - 16.03.2012, 14:18
Re: OnPlayerDeath - by GNGification - 16.03.2012, 14:20
Re: OnPlayerDeath - by Reklez - 16.03.2012, 14:20

Forum Jump:


Users browsing this thread: 1 Guest(s)