killstreak
#1

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
Reply
#2

Use == instead of >

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

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

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

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

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!!!
Reply
#6

Not:
Killstreak[killerid] = ++;

This:
Killstreak[killerid]++;
Reply
#7

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

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;
}
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)