SA-MP Forums Archive
killstreak - 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 (/showthread.php?tid=204353)



killstreak [SOLVED] - park4bmx - 29.12.2010

i got a problem with this
public OnPlayerDeath(playerid, killerid, reason)
{
pawn Код:
if(Killstreak[killerid] > 1){
SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
//Script//
Killstreak[killerid] ++;
return 1;
}
if(Killstreak[killerid] > 2){
print("Killstreak=2");
SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
ResetPlayerWeapons(killerid);
GivePlayerWeapon(killerid, 27, 4);
//script//
Killstreak[killerid]++;
return 1;
}
The problem is that when the player dies he goes to if(Killstreak[killerid] > 1)
But it doesnt go to if(Killstreak[killerid] > 2) and i dont know why



Re: killstreak - MadeMan - 29.12.2010

Use == instead of >

pawn Код:
if(Killstreak[killerid] == 1){



Re: killstreak - park4bmx - 29.12.2010

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Use == instead of >

pawn Код:
if(Killstreak[killerid] == 1){
Still dont work !!! WTH


Re: killstreak - Marricio - 29.12.2010

pawn Код:
OnPlayerDeath(playerid,killerid)
{
       Killstreak[playerid] = 0;
}
it sets the dead player kill streak to 0 and not to 1


Re: killstreak - park4bmx - 30.12.2010

Quote:
Originally Posted by Marricio
Посмотреть сообщение
pawn Код:
OnPlayerDeath(playerid,killerid)
{
       Killstreak[playerid] = 0;
}
it sets the dead player kill streak to 0 and not to 1
yeah thats for the player that is dead
But i need for the player that killes someone
So it would be
Killstreak[killerid]++;

and then the problem is that
If the player killes someone twice
this function doesnt work
if(Killstreak[killerid] > 2){ or if(Killstreak[killerid] == 2){
it only works for
if(Killstreak[killerid] > 1){ and it just stays like that even if you kill someone again!!!


Re: killstreak - Lorenc_ - 30.12.2010

Not:
Killstreak[killerid] = ++;

This:
Killstreak[killerid]++;


Re: killstreak - Macluawn - 30.12.2010

Код:
OnPlayerDeath(playerid,killerid)
{
    Killstreak[playerid] = 0;
    Killstreak[killerid]++;
    return 1;
}



Re: killstreak - park4bmx - 30.12.2010

oh soory i copyed and past it and i forgot to remove the =
And im my script is exactly like this and still dont work
pawn Код:
OnPlayerDeath(playerid,killerid)
{
    Killstreak[playerid] = 0;
    Killstreak[killerid]++;
    return 1;
}



Re: killstreak - _rAped - 30.12.2010

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
oh soory i copyed and past it and i forgot to remove the =
And im my script is exactly like this and still dont work
pawn Код:
OnPlayerDeath(playerid,killerid)
{
    Killstreak[playerid] = 0;
    Killstreak[killerid]++;
    return 1;
}
Sorry to break it to you, but then there's something wrong somewhere else in your script.


Re: killstreak - [NWA]Hannes - 30.12.2010

Be sure you have this somewhere at the top.
new Killstreak[MAX_PLAYERS];

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Killstreak[killerid]++;
    Killstreak[playerid]=0;

    if(Killstreak[killerid] == 1)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+2);
    }

    if(Killstreak[killerid] == 2)
    {
        print("Killstreak=2");
        SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
        ResetPlayerWeapons(killerid);
        GivePlayerWeapon(killerid, 27, 4);
    }
    return 1;
}