15.08.2015, 16:18
Код:
[debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at index 65535 past array upper bound 999 [debug] AMX backtrace: [debug] #0 0003b8f4 in public OnPlayerDeath (2, 65535, 255) from gm.amx
Код:
new Streaks[MAX_PLAYERS];
Код:
Streaks[playerid] = 0;
Код:
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
// Check that the killerid is valid before doing anything with it
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);
}
}
return 1;
}



: error 010: invalid function or declaration