Killstreak
#1

I've edited a killstreak code that was based off of someone's tutorial but it doesn't seem to work, and I spent a half an hour trying to fix it but can't seem to.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);

    if(killerid != INVALID_PLAYER_ID)
    SetPlayerMoney(killerid, GetPlayerMoney(killerid) + 1000), SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    SetPlayerMoney(playerid, GetPlayerMoney(playerid) - 500), SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);

    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
      {
      KillStreak[killerid]++;
      GivePlayerMoney(killerid, 2000);
      SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
      }
	KillStreak[playerid] = 0;

    new str[256], PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(killerid, PlayerName, sizeof(PlayerName));

	switch( KillStreak[ killerid ] )
    {
    case 3:
    {
		GameTextForPlayer(killerid,"KEEP IT UP! +$2000",3000,5);
    }
    case 5:
    {
        GameTextForPlayer(killerid,"DOING NICELY SO FAR! +$2000",3000,5);
    }
    case 10:
    {
        GameTextForPlayer(killerid,"RESPECT! +$2000",3000,5);
    }
    case 15:
    {
        GameTextForPlayer(killerid,"ON FIRE! +$2000",3000,5);
    }
    case 30:
    {
        GameTextForPlayer(killerid,"ANNIHILATING! +$2000",3000,5);
    }
    case 50:
    {
        GameTextForPlayer(killerid,"DOMINATING! +$2000",3000,5);
    }
    case 75:
    {
        GameTextForPlayer(killerid,"AMAZING! +$2000",3000,5);
    }
    case 100:
    {
        GameTextForPlayer(killerid,"SECOND COMING OF JESUS! +$2000",3000,5);
    }
    
    return 1;
}
Код:
C:\Users\Shahin PC\Documents\LOS SANTOS GANGWAR TDM\gamemodes\script.pwn(140) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Shahin PC\Documents\LOS SANTOS GANGWAR TDM\gamemodes\script.pwn(140) : warning 215: expression has no effect
C:\Users\Shahin PC\Documents\LOS SANTOS GANGWAR TDM\gamemodes\script.pwn(102) : warning 204: symbol is assigned a value that is never used: "str"
How do I fix these warnings and the error?
Reply
#2

You've forgotten a closing bracket '}'.
str was defined, but you're not using that anywhere.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);

    if(killerid != INVALID_PLAYER_ID)
    {
        SetPlayerMoney(killerid, GetPlayerMoney(killerid) + 1000), SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
        SetPlayerMoney(playerid, GetPlayerMoney(playerid) - 500), SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
    }
    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
      KillStreak[killerid]++;
      GivePlayerMoney(killerid, 2000);
      SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    KillStreak[playerid] = 0;

    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(killerid, PlayerName, sizeof(PlayerName));

    switch( KillStreak[ killerid ] )
    {
        case 3:
        {
            GameTextForPlayer(killerid,"KEEP IT UP! +$2000",3000,5);
        }
        case 5:
        {
            GameTextForPlayer(killerid,"DOING NICELY SO FAR! +$2000",3000,5);
        }
        case 10:
        {
            GameTextForPlayer(killerid,"RESPECT! +$2000",3000,5);
        }
        case 15:
        {
            GameTextForPlayer(killerid,"ON FIRE! +$2000",3000,5);
        }
        case 30:
        {
            GameTextForPlayer(killerid,"ANNIHILATING! +$2000",3000,5);
        }
        case 50:
        {
            GameTextForPlayer(killerid,"DOMINATING! +$2000",3000,5);
        }
        case 75:
        {
            GameTextForPlayer(killerid,"AMAZING! +$2000",3000,5);
        }
        case 100:
        {
            GameTextForPlayer(killerid,"SECOND COMING OF JESUS! +$2000",3000,5);
        }
    } // here
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)