new Streaks[MAX_PLAYERS];
Streaks[playerid] = 0;
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, 500); //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)+1); //not really necessary, would increase the player's score by 1 point
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 2: // we won't start with the first kill (case 1), because it wouldn't be countable as streak
{
format(str, sizeof(str), "[KILLINGSPREE] ~g~%s has performed a ~y~double kill!", KillerName); //here, you're formatting the defined string and add the content (text)
GameTextForAll(str,4000,4); //this is a function, which will show a short, colored big text for all the players (str, 4000ms, stylenumber 4)
}
case 3:
{
format(str, sizeof(str), "[KILLINGSPREE] ~y~Triple Kill for ~b~%s!", KillerName);
GameTextForAll(str,4000,4);
}
case 4:
{
format(str, sizeof(str), "[KILLINGSPREE] ~p~Quadro Kill for ~r~%s!", KillerName);
GameTextForAll(str,4000,4);
}
case 5:
{
format(str, sizeof(str), "[KILLINGSPREE] ~r~%s is dominating with ~p~five kills!", KillerName);
GameTextForAll(str,4000,4);
}
case 6:
{
format(str, sizeof(str), "[KILLINGSPREE] ~w~%s is godlike with ~y~six kills!", KillerName);
GameTextForAll(str,4000,4);
}
case 7:
{
format(str, sizeof(str), "[KILLINGSPREE] ~r~RAMPAGE for %s with ~w~seven kills!", KillerName);
GameTextForAll(str,4000,4);
}
case 8:
{
format(str, sizeof(str), "[KILLINGSPREE] ~p~%s is unbelievable with ~y~eight kills!", KillerName);
GameTextForAll(str,4000,4);
}
case 9:
{
format(str, sizeof(str), "[KILLINGSPREE] ~g~%s is worldclass, ~b~nine kills!", KillerName);
GameTextForAll(str,4000,4);
}
case 10:
{
format(str, sizeof(str), "[KILLINGSPREE] ~b~%s is annihilating with ~g~ten kills!", KillerName);
GameTextForAll(str,4000,4);
}
/*
case 11:
{
just continue however you want, just in the same way as above
}*/
SendClientMessageToAll(COLOR, str);
GivePlayerMoney(killerid, 500); //if you like, give the player money, else comment this line out
Rep[Twisted_Insane] += 1;
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID )
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 2: format(str, sizeof(str), "[KILLINGSPREE] ~g~%s has performed a ~y~double kill!", KillerName);
case 3: format(str, sizeof(str), "[KILLINGSPREE] ~y~Triple Kill for ~b~%s!", KillerName);
case 4: format(str, sizeof(str), "[KILLINGSPREE] ~p~Quadro Kill for ~r~%s!", KillerName);
// etc ..
}
GameTextForAll(str,4000,4); //this is a function, which will show a short, colored big text for all the players (str, 4000ms, stylenumber 4)
if(killerid != INVALID_PLAYER_ID ) {
To the switching:
DIDN'T EVEN KNOW THAT! I might correct it right now, it's way more simple, just as you said, you've taught me something new. ^^ |