CMD:getgift(playerid, params[])
{
if(playerVariables[playerid][pPlayingHours] >= 3)
{
if(boxVariables[1][boxStatus] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, boxVariables[1][boxX], boxVariables[1][boxY], boxVariables[1][boxZ]))
{
format(szMessage, 256, "Poti folosi /getgift peste %d ore.", playerVariables[playerid][pGiftHours]);
/*if(playerVariables[playerid][pGiftHours] == 0)
{*/
new string[256];
new gift = random(30);
new count, boxes[50];
if(gift >= 0 && gift < 2 && boxVariables[1][boxVehicle] == 0) gift = random(30);
if(boxVariables[1][boxVehicle] == 1) { boxes[count] = 1; count++; }
else if(boxVariables[1][boxPP] == 1) { boxes[count] = 4; count += 3; }
else if(boxVariables[1][boxHidden] == 1) { boxes[count] = 8; count += 4; }
else if(boxVariables[1][boxLic] == 1) { boxes[count] = 12; count += 4; }
else if(boxVariables[1][boxMoney] == 1) { boxes[count] = 18; count += 6; }
else if(boxVariables[1][boxFireWorks] == 1) { boxes[count] = 24; count += 6; }
else if(boxVariables[1][boxClearWarns] == 1 && playerVariables[playerid][pWarns] > 0) { boxes[count] = 27; count += 3; }
else if(boxVariables[1][boxMats] == 1) { boxes[count] = 33; count += 6; }
switch(boxes[random(count)])
{
case 0, 1:
{
format(string, sizeof(string), "GiftBox: %s a castigat un %s din giftbox. Felicitari!", GetName(playerid), VehicleNames[boxVariables[1][boxVehicle] - 400]);
SendClientMessageToAll(COLOR_LIGHT, string);
}
case 2, 3, 4:
{
new pp = 10 + random(50);
format(string, sizeof(string), "GiftBox: %s a castigat %d puncte premium din giftbox. Felicitari!", GetName(playerid), pp);
SendClientMessageToAll(COLOR_LIGHT, string);
}
case 5, 6, 7, 8:
{
SendClientMessage(playerid, COLOR_YELLOW, "* Ai castigat o culoare hidden din giftbox!");
}
case 9, 10, 11, 12:
{
SendClientMessage(playerid, COLOR_YELLOW, "* Ai castigat taote licentele +200h la giftbox!");
}
case 13, 14, 15, 16, 17, 18:
{
new money = 200000 + random(1000000);
format(string, sizeof(string), "* Ai castigat $%s din giftbox.", NumberFormat(money));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
case 19, 20, 21, 22, 23, 24:
{
new fireworks = 10 + random(30);
format(string, sizeof(string), "* Ai castigat %s artificii din giftbox.", NumberFormat(fireworks));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
case 25, 26, 27:
{
SendClientMessage(playerid, COLOR_YELLOW, "* Ai castigat clear warns la giftbox!");
}
case 28, 29, 30, 31, 32, 33:
{
new mats = 5000 + random(30000);
format(string, sizeof(string), "* Ai castigat %s materiale din giftbox.", NumberFormat(mats));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
printf("%d", gift);
playerVariables[playerid][pGiftHours] = 3;
/* }
else SCM(playerid,COLOR_YELLOW, szMessage);*/
}
else
{
SCM(playerid,COLOR_WHITE, "You are not at giftbox location. Go to checkpoint.");
SetPlayerCheckpoint(playerid, 1129.31531, -1448.38330, 15.43760, 5.0);
}
}
else SCM(playerid,COLOR_YELLOW,"The gift is not active.");
}
else SCM(playerid,COLOR_WHITE, "Ai nevoie de 3 ore jucate pentru a folosi comanda /getgift.");
return 1;
}
[16:32:28] [debug] Run time error 4: "Array index out of bounds" [16:32:28] [debug] Accessing element at index 106304000 past array upper bound 49 [16:32:28] [debug] AMX backtrace: [16:32:28] [debug] #0 00227990 in public cmd_getgift (playerid=0, params[]=@014ae214 "") at ../withal/w_giftbox.inc:276 [16:32:28] [debug] #1 native CallLocalFunction () from samp-server.exe [16:32:28] [debug] #2 00008080 in public OnPlayerCommandText (playerid=0, cmdtext[]=@014ae1f0
switch(boxes[random(count)])
VehicleNames[boxVariables[1][boxVehicle] - 400]
|
would help to know which line the error is on so we dont have to look at all this code -_-
|
|
pawn Код:
|
|
I don't know which line it is.. As I said, I'm getting this error with crashdetect.
|