KillStreak System Need HELP FAST! [REP+]
#1

Hello all, i need help with this system.. its not working and these message not loading up either.. please help!

Code:
new KillStreakCount[MAX_PLAYERS];
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
	pInfo[killerid][Kills]++;
    KillStreak(killerid, playerid);
    KillStreakCount[playerid] = 0;
    KillStreakCount[playerid] ++;
    SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    pInfo[playerid][Deaths]++;
    return 1;
}
Code:
stock KillStreak(killerid, playerid)
{
 	new stockstring[128];
    KillStreakCount[playerid] ++;
    if(KillStreakCount[playerid] == 2)
 	{
    PlayAudioStreamForPlayer(killerid, "http://uploads3.mp3songurls.com/1351108.mp3");
	format(stockstring, sizeof(stockstring), "%s has slain %s for a double kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessage(playerid, COLOR_RED, stockstring);
 	}
 	if(KillStreakCount[playerid] == 3)
 	{
    format(stockstring, sizeof(stockstring), "%s has slain %s for a triple kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessage(playerid, COLOR_RED, stockstring);
 	}
 	if(KillStreakCount[playerid] == 4)
 	{
    format(stockstring, sizeof(stockstring), "%s has slain %s for a quadra kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessage(playerid, COLOR_RED, stockstring);
 	}
 	if(KillStreakCount[playerid] == 5)
 	{
    format(stockstring, sizeof(stockstring), "%s has slain %s for a penta kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessage(playerid, COLOR_RED, stockstring);
 	}
  	return 1;
}
Reply
#2

Because of this

pawn Code:
KillStreakCount[playerid] = 0;
KillStreakCount[playerid] ++;
I think it should be

pawn Code:
KillStreakCount[playerid] = 0;
KillStreakCount[killerid]++;
Reply
#3

You have put 'playerid' instead of 'killerid'

pawn Code:
stock KillStreak(killerid, playerid)
{
     new stockstring[128];
    KillStreakCount[killerid] ++;
    if(KillStreakCount[killerid] == 2)
     {
    PlayAudioStreamForPlayer(killerid, "http://uploads3.mp3songurls.com/1351108.mp3");
    format(stockstring, sizeof(stockstring), "%s has slain %s for a double kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessageToAll(COLOR_RED, stockstring);
     }
     if(KillStreakCount[killerid] == 3)
     {
    format(stockstring, sizeof(stockstring), "%s has slain %s for a triple kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessage(playerid, COLOR_RED, stockstring);
     }
     if(KillStreakCount[killerid] == 4)
     {
    format(stockstring, sizeof(stockstring), "%s has slain %s for a quadra kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessageToAll(COLOR_RED, stockstring);
     }
     if(KillStreakCount[killerid] == 5)
     {
    format(stockstring, sizeof(stockstring), "%s has slain %s for a penta kill!", PlayerName(killerid), PlayerName(playerid));
    SendClientMessageToAll(COLOR_RED, stockstring);
     }
      return 1;
}
Try this code.
I edited something, you were putting SendClientMessage instead of SendClientMessageToAll, so I changed it for you, so the message can be sent to all players.

EDIT: And change this:
pawn Code:
KillStreakCount[killerid]++;
instead of:
pawn Code:
KillStreakCount[playerid]++;
Reply
#4

[EDITED] it's still not working, when i get 3 kills its goes up to 5 kills and says, penta kill and some guy killed me and he gets quadra kill..
Reply
#5

If the killer is INVALID_PLAYER_ID and using it in arrays, it will make the code to stop.

pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    if (killerid != INVALID_PLAYER_ID)
    {
        pInfo[killerid][Kills]++;
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
        KillStreak(killerid, playerid);
    }
    KillStreakCount[playerid] = 0;
    pInfo[playerid][Deaths]++;
    return 1;
}

stock KillStreak(killerid, playerid)
{
    new stockstring[80];
    PlayAudioStreamForPlayer(killerid, "http://uploads3.mp3songurls.com/1351108.mp3");
    switch (++KillStreakCount[killerid])
    {
        case 2: format(stockstring, sizeof(stockstring), "%s has slain %s for a double kill!", PlayerName(killerid), PlayerName(playerid));
        case 3: format(stockstring, sizeof(stockstring), "%s has slain %s for a triple kill!", PlayerName(killerid), PlayerName(playerid));
        case 4: format(stockstring, sizeof(stockstring), "%s has slain %s for a quadra kill!", PlayerName(killerid), PlayerName(playerid));
        case 5: format(stockstring, sizeof(stockstring), "%s has slain %s for a penta kill!", PlayerName(killerid), PlayerName(playerid));
    }
    SendClientMessageToAll(COLOR_RED, stockstring);
}
Reply
#6

Thanks so much Konstantinos, heres the rep.
Reply
#7

By the way, how do i give them the money, score and put the voice of saying double kill etc.
Reply
#8

It gives the score in OnPlayerDeath (inside the if statement). If you want to give a specific amount of money, add it there too. If you want different amount of money according to the killstreak's value, use it in the switch (inside the case label but you'll have to use curly brackets).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)