Код:
new text[128];
Streak[killerid] ++;
if(Streak[killerid] == 3)
{
format(text, sizeof(text), "%s is is on (3 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $1500 and +2 score! (killing spree bonus)");
GivePlayerMoney(playerid, 1500);
GivePlayerScore(playerid, 2);
}
if(Streak[killerid] == 5)
{
format(text, sizeof(text), "%s is is on (5 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $2500 and +3 score! (killing spree bonus)");
GivePlayerMoney(playerid, 2500);
GivePlayerScore(playerid, 3);
}
if(Streak[killerid] == 10)
{
format(text, sizeof(text), "%s is on (10 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $5000 and +4 score! (killing spree bonus)");
GivePlayerMoney(playerid, 5000);
GivePlayerScore(playerid, 4);
}
if(Streak[killerid] == 15)
{
format(text, sizeof(text), "%s is is on (15 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $7 500 and +6 score! (killing spree bonus)");
GivePlayerMoney(playerid, 7500);
GivePlayerScore(playerid, 6);
}
if(Streak[killerid] == 20)
{
format(text, sizeof(text), "%s is is on (20 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $12 500 and +10 score! (killing spree bonus)");
GivePlayerMoney(playerid, 12500);
GivePlayerScore(playerid, 10);
}
if(Streak[killerid] == 25)
{
format(text, sizeof(text), "%s is is on (25 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $20 000 and +15 score! (killing spree bonus)");
GivePlayerMoney(playerid, 20000);
GivePlayerScore(playerid, 15);
}
if(Streak[killerid] == 50)
{
format(text, sizeof(text), "%s is on (50 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $50 000 and +20 score! (killing spree bonus)");
GivePlayerMoney(playerid, 50000);
GivePlayerScore(playerid, 20);
}
if(Streak[killerid] == 100)
{
format(text, sizeof(text), "%s is on (100 killing spree)!", PlayerName2(killerid));
SendClientMessageToAll(orange, text);
SendClientMessage(killerid, lightblue, "You get $1 00 000 and +20 score! (killing spree bonus)");
GivePlayerMoney(playerid, 100000);
GivePlayerScore(playerid, 20);
}
}
Anti_heal[playerid] = 0;
Anti_Give[playerid] = 0;
PlayerInfo[playerid][Deaths] ++;
PlayerInfo[killerid][Kills] ++;
#if defined ENABLE_SPEC
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
#endif
}
return 1;
}
stock GivePlayerScore(playerid, score)
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+score);
return 1;
}
My Error Is That The Person Who Kill Not Get Scores As Bonus But The Other Player Who Got Killed Got The Scores As Bonus
Because you use "playerid" in GivePlayerMoney/GivePlayerScore instead of "killerid".
- Check if "killerid" isn't equal to INVALID_PLAYER_ID (65535) before using it in array otherwise you will get run time error 4.