Killstreak / OnPlayerDeath
#1

Could I get some help with this;

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    new KillStreak[MAX_PLAYERS];
    SetPVarInt(playerid, "JustDied", 1);
    pStats[playerid][pSkin] = GetPlayerSkin(playerid);
    pStats[playerid][pDeaths] += 1;
    pStats[killerid][pKills] += 1;
    SetPlayerScore(killerid, pStats[killerid][pKills]);
    SetPlayerScore(playerid, 0);
    Killstreak[playerid] = 0;
    Killstreak[killerid] += 1;
    SendClientMessage(playerid, COLOR_SYSTEM, "You've died, You're score and killstreak has been reset!");
    new string[128];
    format(string, sizeof(string), "You've killed a player. Current score: %s Current Killstreak: %s", GetPlayerScore(killerid), Killstreak[killerid]);
    SendClientMessage(playerid, COLOR_RED, string);
    return 1;
}
Thanks!
Reply
#2

What bit do you need help with?

Does it compile? Does it work?
Reply
#3

Getting errors with the Killstreak part of it. It is saying that Killstreak isn't defined.
Reply
#4

Try this..

pawn Код:
new KillStreak[MAX_PLAYERS]; //Maybe near the top - then its easy to find

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    SetPVarInt(playerid, "JustDied", 1);
    pStats[playerid][pSkin] = GetPlayerSkin(playerid);
    pStats[playerid][pDeaths] + 1;
    pStats[killerid][pKills] + 1;
    SetPlayerScore(killerid, pStats[killerid][pKills]);
    SetPlayerScore(playerid, 0);
    KillStreak[playerid] = 0;
    KillStreak[killerid] + 1;
    SendClientMessage(playerid, COLOR_SYSTEM, "You've died, You're score and killstreak has been reset!");
    new string[128];
    format(string, sizeof(string), "You've killed a player. Current score: %s Current Killstreak: %s", GetPlayerScore(killerid), KillStreak[killerid]);
    SendClientMessage(playerid, COLOR_RED, string);
    return 1;
}
Reply
#5

pawn Код:
C:\Users\Andy\Desktop\Scripting\San Fierro Infection\Script\Alpha\01.pwn(262) : error 017: undefined symbol "Killstreak"
C:\Users\Andy\Desktop\Scripting\San Fierro Infection\Script\Alpha\01.pwn(262) : warning 215: expression has no effect
C:\Users\Andy\Desktop\Scripting\San Fierro Infection\Script\Alpha\01.pwn(262) : error 001: expected token: ";", but found "]"
C:\Users\Andy\Desktop\Scripting\San Fierro Infection\Script\Alpha\01.pwn(262) : error 029: invalid expression, assumed zero
C:\Users\Andy\Desktop\Scripting\San Fierro Infection\Script\Alpha\01.pwn(262) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Line:
Killstreak[playerid] = 0;
Reply
#6

I just noticed something else... - KillStreak - K and S are capitals, in your code, only the K is a capital...

Try this...
pawn Код:
new KillStreak[MAX_PLAYERS]; //Maybe near the top - then its easy to find

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    SetPVarInt(playerid, "JustDied", 1);
    pStats[playerid][pSkin] = GetPlayerSkin(playerid);
    pStats[playerid][pDeaths] + 1;
    pStats[killerid][pKills] + 1;
    SetPlayerScore(killerid, pStats[killerid][pKills]);
    SetPlayerScore(playerid, 0);
    KillStreak[playerid] = 0;
    KillStreak[killerid] + 1;
    SendClientMessage(playerid, COLOR_SYSTEM, "You've died, You're score and killstreak has been reset!");
    new string[128];
    format(string, sizeof(string), "You've killed a player. Current score: %s Current Killstreak: %s", GetPlayerScore(killerid), KillStreak[killerid]);
    SendClientMessage(playerid, COLOR_RED, string);
    return 1;
}
Reply
#7

pawn Код:
KillStreak[killerid] + 1;
won't work.

use:
pawn Код:
KillStreak[killerid] ++;
Reply
#8

Ok thanks, Simple typo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)