[HELP] OnPlayerDeath
#1

Hi all

I have this script:

pawn Код:
new killer[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killer, sizeof(killer));
    if (strlen(deathreason) > 0)
    {
        format(string, sizeof(string), "%s kills %s [%s] ",killer ,name ,deathreason);
       
        if(DMArena[playerid]==1 && DMArena[killerid]==1)
        {
            GivePlayerMoney(killerid, 3000);
            GivePlayerMoney(playerid, -3000);
           
            if(AccInfo[killerid][LoggedIn] == 1)
            {
                new KScore;
                KScore = GetPlayerScore(killerid);
                SetPlayerScore(killerid, KScore +200);
            }
            else
            {
            }
            if(AccInfo[playerid][LoggedIn] == 1)
            {
                new PScore;
                PScore = GetPlayerScore(playerid);
                SetPlayerScore(killerid, PScore +200);
            }
        }
        else
        {
        }
       
    }
    else
    {
        format(string, sizeof(string), "%s kills %s", killer, name);
    }
        }
        SendClientMessageToAll(RED, string);
        {
    }

But, when Player and Killer in DM .. the money/score system dont work

Can some one fix that, please

[I have the rest of this script, But this is where the problem is ]

Sorry for my bad English :$
Reply
#2

pawn Код:
if(killerid != 255)
{

    new killer[24];
    GetPlayerName(killerid, killer, 24);
    format(string, sizeof(string), "%s kills %s [%s] ",killer ,name ,deathreason);
   
    if(DMArena[playerid] && DMArena[killerid])
    {
        GivePlayerMoney(killerid, 3000);
        GivePlayerMoney(playerid, -3000);

        if(AccInfo[killerid][LoggedIn])
        {
            new KScore;
            KScore = GetPlayerScore(killerid);
            SetPlayerScore(killerid, KScore +200);
        }
        if(AccInfo[playerid][LoggedIn] == 1)
        {
            new PScore;
            PScore = GetPlayerScore(playerid);
            SetPlayerScore(killerid, PScore +200);
        }
    }
}
I'm a little bit confused in parts. You add onto the killer's score if he's logged in and then again if the player is logged in? Also, I didn't understand the bottom at all so it's not included.
Reply
#3

Thanks for your help

When Killer kills another: +200pts to the killer and -200pts to the second peson
The same way for giving money

Loser -3000
Winner +3000
Reply
#4

@Backwardsman97: I had explain what I want look up
Reply
#5

Here try this.

pawn Код:
if(killerid != 255)
{

    new killer[24];
    GetPlayerName(killerid, killer, 24);
    format(string, sizeof(string), "%s kills %s [%s] ",killer ,name ,deathreason);

    if(DMArena[playerid] && DMArena[killerid])
    {
        GivePlayerMoney(killerid, 3000);
        GivePlayerMoney(playerid, -3000);

        if(AccInfo[killerid][LoggedIn])
            SetPlayerScore(killerid, GetPlayerScore(killerid) + 200);
           
        if(AccInfo[playerid][LoggedIn])
            SetPlayerScore(killerid, GetPlayerScore(playerid) - 200);
    }
}
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)