Scoring [HELP]
#1

This is really weird. The Score is adding to the Victim not the Killer. So if I killed a player 4 times. The Score is given to my victim not to me. Whats the problem in the script?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ClearAnimations(playerid);
    SetPlayerHealth( playerid, 1.0 );
   
    pSpawned[playerid] = 0;
   
    KillStreak[playerid] = 0;

    if(killerid != INVALID_PLAYER_ID)
        {
                new text[128];
                KillStreak[killerid] ++;

                if(KillStreak[killerid] == 4)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is starting to OWN PEOPLE! Killing 4 people in a Row", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $300 and +1 Score (Killing spree bonus)");
                    GivePlayerMoney(playerid, 300);
                    GivePlayerScore(playerid, 1);
                }
                if(KillStreak[killerid] == 6)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is on a RAMPAGE Wanted Level 6!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $500 and +2 Score (Killing spree bonus)");
                    GivePlayerMoney(playerid, 500);
                    GivePlayerScore(playerid, 2);
                }
                if(KillStreak[killerid] == 10)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s has Mastered the art of Killing! Killing 10 People in a Row", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $800 and +3 Score (Killing spree bonus)");
                    GivePlayerMoney(playerid, 800);
                    GivePlayerScore(playerid, 3);
                }
                if(KillStreak[killerid] == 15)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is UNDEFEATABLE! Leaving 15 Dead bodies in the Field!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $1000 and +4 Score (Killing spree bonus)");
                    GivePlayerMoney(playerid, 1000);
                    GivePlayerScore(playerid, 4);
                }
                if(KillStreak[killerid] == 20)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is on a GodLike! Save your own life!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $1500 and +5 Score (Killing spree bonus)");
                    GivePlayerMoney(playerid, 1500);
                    GivePlayerScore(playerid, 5);
                }
                if(KillStreak[killerid] == 25)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is OWNING! Somebody kill this man! Killing 25 People in a Row!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You get $2300 and +6 Score (Killing spree bonus)");
                    GivePlayerMoney(playerid, 2300);
                    GivePlayerScore(playerid, 6);
                }
    }
    return 1;
}
Reply
#2

use killerid not playerid...
Reply
#3

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ClearAnimations(playerid);
    SetPlayerHealth( playerid, 1.0 );
   
    pSpawned[playerid] = 0;
   
    KillStreak[playerid] = 0;

    if(killerid != INVALID_PLAYER_ID)
        {
                new text[128];
                KillStreak[killerid] ++;

                if(KillStreak[killerid] == 4)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is starting to OWN PEOPLE! Killing 4 people in a Row", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $300 and +1 Score (Killing spree bonus)");
                    GivePlayerMoney(killerid, 300);
                    GivePlayerScore(killerid, 1);
                }
                if(KillStreak[killerid] == 6)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is on a RAMPAGE Wanted Level 6!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $500 and +2 Score (Killing spree bonus)");
                    GivePlayerMoney(killerid, 500);
                    GivePlayerScore(killerid, 2);
                }
                if(KillStreak[killerid] == 10)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s has Mastered the art of Killing! Killing 10 People in a Row", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $800 and +3 Score (Killing spree bonus)");
                    GivePlayerMoney(killerid, 800);
                    GivePlayerScore(killerid, 3);
                }
                if(KillStreak[killerid] == 15)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is UNDEFEATABLE! Leaving 15 Dead bodies in the Field!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $1000 and +4 Score (Killing spree bonus)");
                    GivePlayerMoney(killerid, 1000);
                    GivePlayerScore(killerid, 4);
                }
                if(KillStreak[killerid] == 20)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is on a GodLike! Save your own life!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You have received $1500 and +5 Score (Killing spree bonus)");
                    GivePlayerMoney(killerid, 1500);
                    GivePlayerScore(killerid, 5);
                }
                if(KillStreak[killerid] == 25)
                {
                    format(text, sizeof(text), "{6699FF}Deathmatch: %s is OWNING! Somebody kill this man! Killing 25 People in a Row!", Name(killerid));
                    SendClientMessageToAll(0xFFFFFFFF, text);
                    SendClientMessage(killerid, 0xFFFFFFFF, "{6699FFFF}You get $2300 and +6 Score (Killing spree bonus)");
                    GivePlayerMoney(killerid, 2300);
                    GivePlayerScore(killerid, 6);
                }
    }
    return 1;
}
Try that because made it give the killers rewards go to their victim by using playerid. This code should work fine.
Reply
#4

thanks cookie thanks sniperwars +rep both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)