SA-MP Forums Archive
Killstreak / 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: Killstreak / OnPlayerDeath (/showthread.php?tid=195980)



Killstreak / OnPlayerDeath - acade - 04.12.2010

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!


Re: Killstreak / OnPlayerDeath - Ash. - 04.12.2010

What bit do you need help with?

Does it compile? Does it work?


Re: Killstreak / OnPlayerDeath - acade - 04.12.2010

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


Re: Killstreak / OnPlayerDeath - Ash. - 04.12.2010

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;
}



Re: Killstreak / OnPlayerDeath - acade - 04.12.2010

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;


Re: Killstreak / OnPlayerDeath - Ash. - 04.12.2010

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;
}



Re: Killstreak / OnPlayerDeath - Jeffry - 04.12.2010

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

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



Re: Killstreak / OnPlayerDeath - acade - 04.12.2010

Ok thanks, Simple typo