25.03.2012, 13:22
A bit of redundant code, but otherwise nice. You must also assume that programmers are lazy. They don't like to type the same piece of code more than once.
Is redundant. If the killerid is connected, then it is obviously not invalid and vice versa.
Second, the switch statement can be simplified:
pawn Code:
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID )
Second, the switch statement can be simplified:
pawn Code:
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)