Unknown Command?
#1

This command returns Unknown command every time I run it.
How can I fix this?
Код:
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[33];
					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;
}
Reply
#2

Probably due to array index out of bounds errors.

http://forum.sa-mp.com/showpost.php?...2&postcount=16
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Probably due to array index out of bounds errors.

http://forum.sa-mp.com/showpost.php?...2&postcount=16
But which arrray? I have tried to change "boxes[33]" to "boxes[50]" but still not working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)