Killstreak[killerid] ++ ;
Killstreak[playerid] = 0 ;
if(Killstreak[killerid] >= 2)
{
format(string,sizeof(string),"* Your Killstreak is %s", Killstreak[killerid]);
SendClientMessage(killerid,LIGHTGREEN,string);
return 1;
}
if(Killstreak[killerid] >= 5)
{
GivePlayerMoney(killerid,1000);
SendClientMessage(killerid,LIGHTGREEN,"Here's an Extra $1000!");
return 1;
}
if(Killstreak[killerid] == 6)
{
GivePlayerWeapon(playerid,24,100);
SendClientMessage(killerid,LIGHTGREEN,"Here's a Extra Desert Eagle Ammo!");
return 1;
}
Killstreak[playerid] = 0 ;
Because every time the OnPlayerDeath been called, it's reseting the variable.
pawn Код:
|
Killstreak[ killerid ] ++;
Killstreak[ playerid ] = 0;
switch( Killstreak[ killerid ] )
{
case 2:
{
format(string,sizeof(string),"* Your Killstreak is %s", Killstreak[killerid]);
SendClientMessage(killerid,LIGHTGREEN,string);
return 1;
}
case 5:
{
GivePlayerMoney(killerid,1000);
SendClientMessage(killerid,LIGHTGREEN,"Here's an Extra $1000!");
return 1;
}
case 6:
{
GivePlayerWeapon(playerid,24,100);
SendClientMessage(killerid,LIGHTGREEN,"Here's a Extra Desert Eagle Ammo!");
return 1;
}
}
Killstreak[killerid] += 1;
Killstreak[killerid] += 1;
Killstreak[ playerid ] = 0;
/* switch( Killstreak[ killerid ] )
{
case 2:
{
format(string,sizeof(string),"* Your Killstreak is %s", Killstreak[killerid]);
SendClientMessage(killerid,LIGHTGREEN,string);
return 1;
}
case 5:
{
GivePlayerMoney(killerid,1000);
SendClientMessage(killerid,LIGHTGREEN,"Here's an Extra $1000!");
return 1;
}
case 6:
{
GivePlayerWeapon(playerid,24,100);
SendClientMessage(killerid,LIGHTGREEN,"Here's a Extra Desert Eagle Ammo!");
return 1;
}
}*/
if(Killstreak[killerid] >= 2)
{
format(string,sizeof(string),"* Your Killstreak is %s", Killstreak[killerid]);
SendClientMessage(killerid,LIGHTGREEN,string);
return 1;
}
if(Killstreak[killerid] >= 5)
{
GivePlayerMoney(killerid,1000);
SendClientMessage(killerid,LIGHTGREEN,"Here's an Extra $1000!");
return 1;
}
if(Killstreak[killerid] == 6)
{
GivePlayerWeapon(playerid,24,100);
SendClientMessage(killerid,LIGHTGREEN,"Here's a Extra Desert Eagle Ammo!");
return 1;
}
I'm using the code exactly like you, except that I have
pawn Код:
|
++ and += 1 are the same thing
++ = incrementally increase the value of the variable += 1 = increase it by one - in other words increment it |