Array index out of bounds
#4

Try this
Код:
SendDeathMessage(killerid,playerid,reason);
    if(IsPlayerConnected(killerid) &&  killerid != INVALID_PLAYER_ID )
    { 
        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
    // Check that the killerid is valid before doing anything with it
    if(IsPlayerConnected(killerid) &&  killerid != INVALID_PLAYER_ID )
    { 
        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] %s je ucinio double kill!", KillerName); //here, you're formatting the defined string and add the content (text)
                SendClientMessageToAll(COLOR_GREEN, str); //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] Triple Kill za %s!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 4:
            {
                format(str, sizeof(str), "[KILLINGSPREE] Quadro Kill za %s!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 5:
            {
                format(str, sizeof(str), "[KILLINGSPREE] %s dominira sa 5 ubistava!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 6:
            {
                format(str, sizeof(str), "[KILLINGSPREE] %s nezaustavljiv sa 6 ubistava!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 7:
            {
                format(str, sizeof(str), "[KILLINGSPREE] RAMPAGE za %s.  7 ubistava!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 8:
            {
                format(str, sizeof(str), "[KILLINGSPREE] %s je neverovatan, 8 ubistava!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 9:
            {
                format(str, sizeof(str), "[KILLINGSPREE] %s GODLIKE, deveta smrt!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
                case 10:
            {
                format(str, sizeof(str), "[KILLINGSPREE] %s resava sa desetom smrcu!", KillerName);
                SendClientMessageToAll(COLOR_GREEN, str);
            }
        }
    }
Reply


Messages In This Thread
Array index out of bounds - by Aleksabre - 15.08.2015, 16:18
Re: Array index out of bounds - by Dziugsas - 15.08.2015, 16:27
Re: Array index out of bounds - by Aleksabre - 15.08.2015, 16:40
Re: Array index out of bounds - by Dziugsas - 15.08.2015, 16:48
Re: Array index out of bounds - by Aleksabre - 15.08.2015, 17:00
Re: Array index out of bounds - by Dziugsas - 15.08.2015, 17:02
Re: Array index out of bounds - by Aleksabre - 15.08.2015, 17:08
Re: Array index out of bounds - by Dziugsas - 15.08.2015, 17:10

Forum Jump:


Users browsing this thread: 1 Guest(s)