pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID ) { //check if the player is connected and it's a VALID KILL
if(GetPlayerWantedLevel(killerid) < 6) //if the player's wantedlevel is under 6
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1); //increase it by 1
}
Streaks[killerid] ++; //the sign '++' means, increase the variable for the killerid by 1
GivePlayerMoney(killerid, 1500); //if you like, give the killer some money, else comment this line out
}
SetPlayerWantedLevel(playerid, 0); //the player who died will get his wanted level reset to 0
Streaks[playerid] = 0; //and his streak will end, while giving the value '0' to this variable
SetPlayerScore(killerid,GetPlayerScore(killerid)+2); //not really necessary, would increase the player's score by 1 point
GameTextForPlayer(playerid,"~g~ +2 Score",3000,1);
new str[ 256 ], KillerName[MAX_PLAYER_NAME]; //here, you're defining a string and the killername
GetPlayerName(killerid, KillerName, sizeof(KillerName)); //receive the information of the killer's name
switch(Streaks[killerid]) //IMPORTANT: with the function "switch", you're switching / toggling through the killstreaks of a player (Streals). you need the killerid here, because the playerid is the one which is GETTING killed
{
case 3:
{
format(str, sizeof(str), ""white"["red"KS"white"] "green"%s "grey"is on a kill streak with 3 kills", KillerName);
SendClientMessageToAll(-1, str);
GameTextForPlayer(playerid,"REWARD ~n~ ~g~ +3 additional score",3000,6);
SetPlayerScore(killerid,GetPlayerScore(killerid)+3);
}
case 5:
{
format(str, sizeof(str), ""white"["red"KS"white"] "green"%s "white"is on a kill streak with 5 kills", KillerName);
SendClientMessageToAll(-1, str);
GameTextForPlayer(playerid,"REWARD ~n~ ~g~ +5 additional score",3000,6);
SetPlayerScore(killerid,GetPlayerScore(killerid)+5);
}
case 10:
{
format(str, sizeof(str), ""white"["red"KS"white"] "green"%s "white"is on a kill streak with 10 kills", KillerName);
SendClientMessageToAll(-1, str);
GameTextForPlayer(playerid,"REWARD ~n~ ~g~ +7 additional score",3000,6);
SetPlayerScore(killerid,GetPlayerScore(killerid)+7);
}
case 15:
{
format(str, sizeof(str), ""white"["red"KS"white"] "green"%s "white"is on a kill streak with 15 kills", KillerName);
SendClientMessageToAll(-1, str);
GameTextForPlayer(playerid,"REWARD ~n~ ~g~ +10 additional score",3000,6);
SetPlayerScore(killerid,GetPlayerScore(killerid)+10);
}
case 30:
{
format(str, sizeof(str), ""white"["red"KS"white"] "green"%s "white"is on a kill streak with 30 kills", KillerName);
SendClientMessageToAll(-1, str);
GameTextForPlayer(playerid,"REWARD ~n~ ~g~ +15 additional score",3000,6);
SetPlayerScore(killerid,GetPlayerScore(killerid)+15);
}
case 50:
{
format(str, sizeof(str), ""white"["red"KS"white"] "green"%s "white"is on a kill streak with 50 kills", KillerName);
SendClientMessageToAll(-1, str);
GameTextForPlayer(playerid,"REWARD ~n~ ~g~ +20 additional score",3000,6);
SetPlayerScore(killerid,GetPlayerScore(killerid)+20);
}
}
return 1;
}
This is something like killstreak system but when a player kill me it says that I got +2 score but in fact I didn't how to fix it?